Commit 239e8239 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

p2p/test/reconnect: fixed race condition

parent 0b9bef1e
...@@ -188,16 +188,16 @@ func SubtestConnSendDisc(t *testing.T, hosts []host.Host) { ...@@ -188,16 +188,16 @@ func SubtestConnSendDisc(t *testing.T, hosts []host.Host) {
defer wg.Done() defer wg.Done()
go sF(s) go sF(s)
log.Debugf("getting handle %d", i) log.Debugf("getting handle %d", j)
sc := <-ss // wait to get handle. 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.send <- struct{}{}
<-sc.sent <-sc.sent
log.Debugf("%d sent %d", j, i) log.Debugf("%d sent %d", j, k)
<-sc.read <-sc.read
log.Debugf("%d read %d", j, i) log.Debugf("%d read %d", j, k)
} }
sc.close_ <- struct{}{} sc.close_ <- struct{}{}
<-sc.closed <-sc.closed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment