Skip to content

Commit

Permalink
Fix race in TextPexConnState
Browse files Browse the repository at this point in the history
  • Loading branch information
anacrolix committed Dec 16, 2021
1 parent 48fa9b5 commit 12c77bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pexconn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestPexConnState(t *testing.T) {
t.Log(err)
}

connWriteCond := c.messageWriter.writeCond.Signaled()
c.pex.Init(c)
require.True(t, c.pex.IsEnabled(), "should get enabled")
defer c.pex.Close()
Expand All @@ -37,7 +38,7 @@ func TestPexConnState(t *testing.T) {
out = m
return true
}
<-c.messageWriter.writeCond.Signaled()
<-connWriteCond
c.pex.Share(testWriter)
require.True(t, writerCalled)
require.EqualValues(t, pp.Extended, out.Type)
Expand Down

0 comments on commit 12c77bc

Please sign in to comment.