Fix race in TextPexConnState

This commit is contained in:
Matt Joiner 2021-12-16 11:07:19 +11:00
parent 48fa9b59fd
commit 12c77bc410
1 changed files with 2 additions and 1 deletions

View File

@ -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()
@ -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)