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

rewrite FindProvidersAsync #440

Merged
merged 2 commits into from
Dec 11, 2014
Merged

rewrite FindProvidersAsync #440

merged 2 commits into from
Dec 11, 2014

Conversation

whyrusleeping
Copy link
Member

This PR implements a better FindProvidersAsync call that uses the query framework and actually takes advantage of closer peers.

@whyrusleeping whyrusleeping added the status/in-progress In progress label Dec 11, 2014
provs := dht.providers.GetProviders(ctx, key)
for _, p := range provs {
count--
// NOTE: assuming that this list of peers is unique
Copy link
Member

Choose a reason for hiding this comment

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

what if this assumption isn't true? could it make it hang?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nah, it wont hang, we just might send a request to the same peer twice. But im very certain that GetProviders from our provider manager returns a unique list.

Copy link
Member

Choose a reason for hiding this comment

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

easy to do the ps.Contains check here too.

Copy link
Member Author

Choose a reason for hiding this comment

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

that it is... i think not doing that is a result of my shitty-programmer-copy-paste-itis

@jbenet
Copy link
Member

jbenet commented Dec 11, 2014

some comments, otherwise lgtm

@whyrusleeping
Copy link
Member Author

Addressed comments, will merge when tests finish

whyrusleeping added a commit that referenced this pull request Dec 11, 2014
@whyrusleeping whyrusleeping merged commit ba1a6c0 into master Dec 11, 2014
@whyrusleeping whyrusleeping removed the status/in-progress In progress label Dec 11, 2014
@whyrusleeping whyrusleeping deleted the findprovs-rewrite branch December 11, 2014 05:54
@btc btc mentioned this pull request Dec 15, 2014
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