Perfect your code
With built-in code review tools, GitHub makes it easy to raise the quality bar before you ship. Join the 40 million developers who've merged over 200 million pull requests.
Sign up for free See pricing for teams and enterprisesDo not choke on web seeds #972
Conversation
Web seeds should be considered as pure uncheked seeds according to BEP19 So we should never choke on them. Otherwise when there are no other seeds, the downloads will hang
|
I have one inline nitpick, but this LGTM regardless :) |
| @@ -1093,8 +1093,10 @@ Torrent.prototype._onWireWithMetadata = function (wire) { | |||
| wire.port(self.client.dht.address().port) | |||
| } | |||
|
|
|||
| timeoutId = setTimeout(onChokeTimeout, CHOKE_TIMEOUT) | |||
| if (timeoutId.unref) timeoutId.unref() | |||
| if (wire.type !== 'webSeed') { // do not choke on webseeds | |||
This comment has been minimized.
This comment has been minimized.
josephfrazier
Nov 11, 2016
Member
Given that onChokeTimeout will do nothing if wire.type === 'webSeed', is this guard necessary?
This comment has been minimized.
This comment has been minimized.
DiegoRBaquero
Nov 11, 2016
Member
I'd rather have this line and remove the change in onChokeTimeout. Never setting the timeout is better.
This comment has been minimized.
This comment has been minimized.
josephfrazier
Nov 11, 2016
Member
Good point. I noticed there's one other place where the timeout could be set, but I'm assuming it won't actually happen for web seeds? https://github.com/gpetrov/webtorrent/blob/a6a52cf436dfaa078dfa58dabcc2d4ac01bbbf2a/lib/torrent.js#L1070
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
gpetrov
Nov 12, 2016
Author
Contributor
After further diving into the webseed logic, I think it should be even better if the webseed kicks in as last, when for example there are no other peers. Currently if webseed is given it is directly used as first peer and when this is a fast website connection, most downloads will go through the webseed and other peers will be used very little.
So I would suggest that webseeds also get the lowest priority (maybe as option).
I solved this currently in my case by adding the webseed dynamically 3 seconds after the torrent has being activated, so all client peers are exhausted first, but it is not an optimal solution.
What do you think?
This comment has been minimized.
This comment has been minimized.
josephfrazier
Nov 17, 2016
Member
I'm not too familiar with the logic/code that handles webseed priority, but it sounds like a technically separate issue. I think we should go ahead and land this PR (once the required change has been made), then discuss webseed priority in a new issue/PR :-)
| @@ -1093,8 +1093,10 @@ Torrent.prototype._onWireWithMetadata = function (wire) { | |||
| wire.port(self.client.dht.address().port) | |||
| } | |||
|
|
|||
| timeoutId = setTimeout(onChokeTimeout, CHOKE_TIMEOUT) | |||
| if (timeoutId.unref) timeoutId.unref() | |||
| if (wire.type !== 'webSeed') { // do not choke on webseeds | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
After the PR is updated to address the feedback, feel free to land this PR |
This comment has been minimized.
This comment has been minimized.
|
are we good now? :) |
This comment has been minimized.
This comment has been minimized.
|
Looks great, thanks! |
This comment has been minimized.
This comment has been minimized.
|
Great! Something we needed. @feross Can we get this published? |
This comment has been minimized.
This comment has been minimized.
|
@DiegoRBaquero Sorry for the delay. Just published this as 0.98.1. |
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
May 4, 2018
|
This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue. |
gpetrov commentedNov 6, 2016
Web seeds should be considered as pure uncheked seeds according to BEP19
So we should never choke on them. Otherwise when there are no other
seeds, the downloads will hang