diff --git a/examples/multipro/echo.go b/examples/multipro/echo.go index e9b58bcf..214242e3 100644 --- a/examples/multipro/echo.go +++ b/examples/multipro/echo.go @@ -86,6 +86,7 @@ func (e *EchoProtocol) onEchoRequest(s network.Stream) { if ok { log.Printf("%s: Echo response to %s sent.", s.Conn().LocalPeer().String(), s.Conn().RemotePeer().String()) } + e.done <- true } // remote echo response handler diff --git a/examples/multipro/main.go b/examples/multipro/main.go index 27b49735..fbfe4990 100644 --- a/examples/multipro/main.go +++ b/examples/multipro/main.go @@ -57,7 +57,7 @@ func run(h1, h2 *Node, done <-chan bool) { h2.Echo(h1.Host) // block until all responses have been processed - for i := 0; i < 4; i++ { + for i := 0; i < 8; i++ { <-done } } diff --git a/examples/multipro/ping.go b/examples/multipro/ping.go index 43666bc9..e5820a9d 100644 --- a/examples/multipro/ping.go +++ b/examples/multipro/ping.go @@ -82,6 +82,7 @@ func (p *PingProtocol) onPingRequest(s network.Stream) { if ok { log.Printf("%s: Ping response to %s sent.", s.Conn().LocalPeer().String(), s.Conn().RemotePeer().String()) } + p.done <- true } // remote ping response handler