diff options
author | Felix Lange <fjl@twurst.com> | 2015-06-22 06:01:56 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-06-22 07:07:58 +0800 |
commit | 6fb810adaa539a2fa97cf4481588b339ab5279ae (patch) | |
tree | fb5f5809b2641a06cbc4caba22f37687b26730b8 /p2p/server.go | |
parent | 3deded28a50398b8ce108c72f27ea861c1bce178 (diff) | |
download | go-tangerine-6fb810adaa539a2fa97cf4481588b339ab5279ae.tar.gz go-tangerine-6fb810adaa539a2fa97cf4481588b339ab5279ae.tar.zst go-tangerine-6fb810adaa539a2fa97cf4481588b339ab5279ae.zip |
p2p: throttle all discovery lookups
Lookup calls would spin out of control when network connectivity was
lost. The throttling that was in place only took effect when the table
returned zero results, which doesn't happen very often.
The new throttling should not have a negative impact when the host is
online. Lookups against the network take some time and dials for all
results must complete or hit the cache before a new one is started. This
usually takes longer than four seconds, leaving online lookups
unaffected.
Fixes #1296
Diffstat (limited to 'p2p/server.go')
-rw-r--r-- | p2p/server.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/p2p/server.go b/p2p/server.go index 59b97a0aa..5eff70345 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -115,6 +115,7 @@ type Server struct { ntab discoverTable listener net.Listener ourHandshake *protoHandshake + lastLookup time.Time // These are for Peers, PeerCount (and nothing else). peerOp chan peerOpFunc |