Skip to content
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

if bucket doesnt have enough peers, grab more elsewhere #1967

Merged
merged 1 commit into from
Nov 20, 2015

Conversation

whyrusleeping
Copy link
Member

If the bucket chosen by the common prefix length doesnt have as many peers as we are requesting, grab some from the buckets on either side, This should help dht queries complete faster as they are more likely to query a larger number of peers.

License: MIT
Signed-off-by: Jeromy jeromyj@gmail.com

@jbenet jbenet added the status/in-progress In progress label Nov 13, 2015
@whyrusleeping whyrusleeping added RFCR and removed status/in-progress In progress labels Nov 16, 2015
peerArr = copyPeersFromList(id, peerArr, bucket.list)
if len(peerArr) < count {
// In the case of an unusual split, one bucket may be short or empty.
// if this happens, search both surrounding buckets for nearby peers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will end up with "more than count" peers, as it will copy from both other buckets, and copy doesn't have a limit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbenet right, read the rest of the function, especially line 177.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok

@jbenet
Copy link
Member

jbenet commented Nov 16, 2015

we need to go through the dht carefully cc @diasdavid

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
@jbenet
Copy link
Member

jbenet commented Nov 20, 2015

rerunning tests

@whyrusleeping
Copy link
Member Author

mmm... i'll take some time next week to flush out those random test failures

jbenet added a commit that referenced this pull request Nov 20, 2015
if bucket doesnt have enough peers, grab more elsewhere
@jbenet jbenet merged commit d46c0d4 into dev0.4.0 Nov 20, 2015
@jbenet jbenet deleted the fix/kbucket-fill branch November 20, 2015 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants