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

penalize duplicates #35

Merged
merged 2 commits into from Aug 27, 2016

Conversation

Projects
None yet
2 participants
@arvidn
Copy link
Contributor

arvidn commented Aug 27, 2016

The idea behind this patch is primarily to save upload bandwidth by sending fewer nodes back to duplicate requests from IPs. It only affects nodes that actually make it into the ping_queue, but any request from an IP that's in the queue receives 3 nodes, instead of the configured number (16 by default).

My experience is that at least a 1/3rd of all incoming requests fall into this category.

@@ -920,6 +923,46 @@ struct router_thread
|| cmd == "get_peers"
|| cmd == "get")
{
insert_response inserted = insert_response::inserted;

This comment has been minimized.

@arvidn

arvidn Aug 27, 2016

Author Contributor

I flipped around sending the response and inserting into the queue, since inserting is what tells us whether it's a duplicate or not. note that I removed your duplicate check against the last source IP. did you get a lot of hits on that one? should I put it back?

This comment has been minimized.

@ssiloti

ssiloti Aug 27, 2016

Contributor

I didn't add that check you did, see 465def2.

This comment has been minimized.

@arvidn

arvidn Aug 27, 2016

Author Contributor

oh I see :)

@@ -43,6 +43,13 @@ struct queued_node_t
int sock_idx;
};

enum class insert_response

This comment has been minimized.

@arvidn

arvidn Aug 27, 2016

Author Contributor

maybe this enum is poorly named

@ssiloti

This comment has been minimized.

Copy link
Contributor

ssiloti commented Aug 27, 2016

lgtm

@arvidn arvidn merged commit ad72eef into bittorrent:master Aug 27, 2016

@arvidn arvidn deleted the arvidn:penalize-duplicates branch Aug 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment