network: fix logging data race in the package

Nested goroutines could cause logging race.

Close #3316

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
Ekaterina Pavlova 2024-03-19 19:21:28 +03:00
parent 7e12cc11e4
commit 31548dc28f

View file

@ -335,16 +335,7 @@ func TestServerNotSendsVerack(t *testing.T) {
p2 = newLocalPeer(t, s)
)
s.id = 1
finished := make(chan struct{})
go func() {
go s.run()
close(finished)
}()
t.Cleanup(func() {
// close via quit as server was started via `run()`, not `Start()`
close(s.quit)
<-finished
})
startWithCleanup(t, s)
na, _ := net.ResolveTCPAddr("tcp", "0.0.0.0:3000")
p.netaddr = *na