Skip to content

Commit

Permalink
Merge pull request #1149 from libp2p/fix/deflake-echo-test
Browse files Browse the repository at this point in the history
fix: deflake multipro echo test
  • Loading branch information
Stebalien authored Aug 3, 2021
2 parents aaef2e0 + 8217b1f commit 159a6fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/multipro/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/multipro/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
1 change: 1 addition & 0 deletions examples/multipro/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 159a6fc

Please sign in to comment.