1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00

p2p/test/reconnect: fixed race condition

This commit is contained in:
Juan Batiz-Benet
2015-01-20 10:57:45 -08:00
parent 0b9bef1ea9
commit 239e82390f

View File

@ -188,16 +188,16 @@ func SubtestConnSendDisc(t *testing.T, hosts []host.Host) {
defer wg.Done()
go sF(s)
log.Debugf("getting handle %d", i)
log.Debugf("getting handle %d", j)
sc := <-ss // wait to get handle.
log.Debugf("spawning worker %d", i)
log.Debugf("spawning worker %d", j)
for i := 0; i < numMsgs; i++ {
for k := 0; k < numMsgs; k++ {
sc.send <- struct{}{}
<-sc.sent
log.Debugf("%d sent %d", j, i)
log.Debugf("%d sent %d", j, k)
<-sc.read
log.Debugf("%d read %d", j, i)
log.Debugf("%d read %d", j, k)
}
sc.close_ <- struct{}{}
<-sc.closed