don't probe peers too far from the top closest
This commit is contained in:
parent
7d4966e2ae
commit
c14915df29
1 changed files with 3 additions and 1 deletions
|
@ -86,7 +86,7 @@ class IterativeFinder:
|
|||
|
||||
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
|
||||
|
@ -229,6 +229,8 @@ class IterativeFinder:
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue