New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DHT: improve iterative find #3562
Conversation
self.exclude = exclude or [] | ||
|
||
self.active: typing.Set['KademliaPeer'] = set() | ||
self.active: typing.Dict['KademliaPeer', int] = {} # peer: distance, sorted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be an ordered dict to be explicit
self.delayed_call.cancel() # ensure anything scheduled gets cancelled | ||
self._search_round() | ||
#if self.running: | ||
# self.delayed_call = self.loop.call_later(delay, self._search) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can delayed_call
be deleted?
self.tasks.append(self.loop.create_task(self._search_task(0.0))) | ||
for peer in [peer for peer, task in self.running_probes.items() if task.done() or task == t]: | ||
del self.running_probes[peer] | ||
self._search_task(0.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the delay isn't needed as an arg anymore
|
||
def _search(self): | ||
self.tasks.append(self.loop.create_task(self._search_task())) | ||
self._search_task() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this method?
@@ -4885,20 +4885,16 @@ async def jsonrpc_blob_delete(self, blob_hash): | |||
""" | |||
|
|||
@requires(DHT_COMPONENT) | |||
async def jsonrpc_peer_list(self, blob_hash, search_bottom_out_limit=None, page=None, page_size=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be documented as a breaking change
max_result
closest nodes) = less packets, same precision, more concurrency expecteddepends: #3559