aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-12-18 06:28:27 +0800
committerFelix Lange <fjl@twurst.com>2015-12-18 06:44:56 +0800
commitb3f1f4c673271258f18c61d8b6e5cda9849da27a (patch)
tree444157ed1ef1251eb77b4b7b3422b1d325aeb86a /p2p
parent6c41e675ec6fc720a1e8429fa4ef035a476e26d8 (diff)
downloaddexon-b3f1f4c673271258f18c61d8b6e5cda9849da27a.tar
dexon-b3f1f4c673271258f18c61d8b6e5cda9849da27a.tar.gz
dexon-b3f1f4c673271258f18c61d8b6e5cda9849da27a.tar.bz2
dexon-b3f1f4c673271258f18c61d8b6e5cda9849da27a.tar.lz
dexon-b3f1f4c673271258f18c61d8b6e5cda9849da27a.tar.xz
dexon-b3f1f4c673271258f18c61d8b6e5cda9849da27a.tar.zst
dexon-b3f1f4c673271258f18c61d8b6e5cda9849da27a.zip
p2p/discover: attempt to deflake TestUDP_responseTimeouts
The test expected the timeout to fire after a matcher for the response was added, but the timeout is random and fired sooner sometimes.
Diffstat (limited to 'p2p')
-rw-r--r--p2p/discover/udp_test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/p2p/discover/udp_test.go b/p2p/discover/udp_test.go
index 55d6d564a..8ed12b8ec 100644
--- a/p2p/discover/udp_test.go
+++ b/p2p/discover/udp_test.go
@@ -167,16 +167,17 @@ func TestUDP_responseTimeouts(t *testing.T) {
binary.BigEndian.PutUint64(p.from[:], uint64(i))
if p.ptype <= 128 {
p.errc = timeoutErr
+ test.udp.addpending <- p
nTimeouts++
} else {
p.errc = nilErr
+ test.udp.addpending <- p
time.AfterFunc(randomDuration(60*time.Millisecond), func() {
if !test.udp.handleReply(p.from, p.ptype, nil) {
t.Logf("not matched: %v", p)
}
})
}
- test.udp.addpending <- p
time.Sleep(randomDuration(30 * time.Millisecond))
}