Skip to content

Commit

Permalink
don't probe peers too far from the top closest
Browse files Browse the repository at this point in the history
  • Loading branch information
shyba committed Feb 8, 2022
1 parent 0dc56fd commit 24cab73
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lbry/dht/protocol/iterative_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self, loop: asyncio.AbstractEventLoop, peer_manager: 'PeerManager',

self.key = key
self.bottom_out_limit = bottom_out_limit
self.max_results = max_results
self.max_results = max(constants.K, max_results)
self.exclude = exclude or []

self.active: typing.Dict['KademliaPeer', int] = {} # peer: distance, sorted
Expand Down Expand Up @@ -229,6 +229,8 @@ async def _search_round(self):
continue
if added >= constants.ALPHA:
break
if index > self.max_results:
break
origin_address = (peer.address, peer.udp_port)
if origin_address in self.exclude:
continue
Expand Down

0 comments on commit 24cab73

Please sign in to comment.