Fix race in TextPexConnState
This commit is contained in:
parent
48fa9b59fd
commit
12c77bc410
|
@ -26,6 +26,7 @@ func TestPexConnState(t *testing.T) {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connWriteCond := c.messageWriter.writeCond.Signaled()
|
||||||
c.pex.Init(c)
|
c.pex.Init(c)
|
||||||
require.True(t, c.pex.IsEnabled(), "should get enabled")
|
require.True(t, c.pex.IsEnabled(), "should get enabled")
|
||||||
defer c.pex.Close()
|
defer c.pex.Close()
|
||||||
|
@ -37,7 +38,7 @@ func TestPexConnState(t *testing.T) {
|
||||||
out = m
|
out = m
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
<-c.messageWriter.writeCond.Signaled()
|
<-connWriteCond
|
||||||
c.pex.Share(testWriter)
|
c.pex.Share(testWriter)
|
||||||
require.True(t, writerCalled)
|
require.True(t, writerCalled)
|
||||||
require.EqualValues(t, pp.Extended, out.Type)
|
require.EqualValues(t, pp.Extended, out.Type)
|
||||||
|
|
Loading…
Reference in New Issue