-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
provs := dht.providers.GetProviders(ctx, key) | ||
for _, p := range provs { | ||
count-- | ||
// NOTE: assuming that this list of peers is unique |
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.
what if this assumption isn't true? could it make it hang?
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.
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.
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.
easy to do the ps.Contains
check here too.
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.
that it is... i think not doing that is a result of my shitty-programmer-copy-paste-itis
some comments, otherwise lgtm |
Addressed comments, will merge when tests finish |
rewrite FindProvidersAsync
This PR implements a better
FindProvidersAsync
call that uses the query framework and actually takes advantage of closer peers.