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

Choose closest nodes without calculating distance? #55

Open
ltzmaxwell opened this issue Mar 12, 2018 · 1 comment
Open

Choose closest nodes without calculating distance? #55

ltzmaxwell opened this issue Mar 12, 2018 · 1 comment

Comments

@ltzmaxwell
Copy link

It seems that function "lookupFiltered" is only choosing nodes that "wasContactedRecently", without calculating distance, right?

@nictuku
Copy link
Owner

nictuku commented Mar 12, 2018

Hi @ltzmaxwell. It's been a while since I wrote that code, but I assume that lookupFiltered uses traverse, which is by itself the distance calculation method.

Since the tree can be traversed multiple times for the same infohash, we skip the nodes that have been contacted already. So we specifically try to avoid a node that wasContactedRecently.

That's in this line:

dht/routing.go

Line 225 in b0d0998

if recent {

So I think the function is working. What do you think?

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

No branches or pull requests

2 participants