From 6fb810adaa539a2fa97cf4481588b339ab5279ae Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 22 Jun 2015 00:01:56 +0200 Subject: 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 --- p2p/server.go | 1 + 1 file changed, 1 insertion(+) (limited to 'p2p/server.go') 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 -- cgit v1.2.3