diff options
author | Felix Lange <fjl@twurst.com> | 2015-04-14 00:08:11 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-04-14 00:08:11 +0800 |
commit | 0217652d1b7e8f0c1c3002837d9f1277de27ef46 (patch) | |
tree | 65d0236488a2fbbef0cc8d9adeb7a1dabc30369f /p2p | |
parent | b8aeb04f6f55b03edb6998107f8480031e23b22f (diff) | |
download | go-tangerine-0217652d1b7e8f0c1c3002837d9f1277de27ef46.tar go-tangerine-0217652d1b7e8f0c1c3002837d9f1277de27ef46.tar.gz go-tangerine-0217652d1b7e8f0c1c3002837d9f1277de27ef46.tar.bz2 go-tangerine-0217652d1b7e8f0c1c3002837d9f1277de27ef46.tar.lz go-tangerine-0217652d1b7e8f0c1c3002837d9f1277de27ef46.tar.xz go-tangerine-0217652d1b7e8f0c1c3002837d9f1277de27ef46.tar.zst go-tangerine-0217652d1b7e8f0c1c3002837d9f1277de27ef46.zip |
p2p/discover: improve timer handling for reply timeouts
Diffstat (limited to 'p2p')
-rw-r--r-- | p2p/discover/udp.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index d37260e7d..61a0abed9 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -267,11 +267,12 @@ func (t *udp) loop() { defer timeout.Stop() rearmTimeout := func() { - if len(pending) == 0 || nextDeadline == pending[0].deadline { + now := time.Now() + if len(pending) == 0 || now.Before(nextDeadline) { return } nextDeadline = pending[0].deadline - timeout.Reset(nextDeadline.Sub(time.Now())) + timeout.Reset(nextDeadline.Sub(now)) } for { |