Skip to content

Commit

Permalink
Merge pull request #31 from libp2p/fix/reset-test-race
Browse files Browse the repository at this point in the history
fix race in reset test
  • Loading branch information
Stebalien committed Mar 11, 2018
2 parents 2ba1319 + b78f145 commit 3f15e2c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions p2p/protocol/internal/circuitv1-deprecated/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ func TestRelayReset(t *testing.T) {
t.Fatal(err)
}

ready := make(chan struct{})

msg := []byte("relay works!")
go func() {
list := r3.Listener()
Expand All @@ -152,6 +154,8 @@ func TestRelayReset(t *testing.T) {
t.Error(err)
return
}
<-ready

hosts[2].Close()
}()

Expand All @@ -166,6 +170,8 @@ func TestRelayReset(t *testing.T) {
t.Fatal(err)
}

close(ready)

_, err = ioutil.ReadAll(con)
if err == nil {
t.Fatal("expected error for reset relayed connection")
Expand Down

0 comments on commit 3f15e2c

Please sign in to comment.