From 4c7e345f267ba981212d3ee5d3e70d9ba136aea8 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Sat, 12 Feb 2022 03:28:26 -0300 Subject: [PATCH] allow running some extra probes for k replacements --- lbry/dht/protocol/iterative_find.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lbry/dht/protocol/iterative_find.py b/lbry/dht/protocol/iterative_find.py index 68c04692de..bbfc93bd6b 100644 --- a/lbry/dht/protocol/iterative_find.py +++ b/lbry/dht/protocol/iterative_find.py @@ -184,11 +184,12 @@ def _search_round(self): for index, peer in enumerate(self.active.keys()): if index == 0: log.debug("closest to probe: %s", peer.node_id.hex()[:8]) + if peer in self.contacted: continue if len(self.running_probes) >= constants.ALPHA: break - if index > (constants.K - 1): + if index > (constants.K + len(self.running_probes)): break origin_address = (peer.address, peer.udp_port) if origin_address in self.exclude: