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
Do not choke on web seeds #972
Changes from 1 commit
File filter...
Jump to…
Do not choke on web seeds
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
- Loading branch information
| @@ -1026,7 +1026,7 @@ Torrent.prototype._onWireWithMetadata = function (wire) { | ||
| var timeoutId = null | ||
|
|
||
| function onChokeTimeout () { | ||
| if (self.destroyed || wire.destroyed) return | ||
| if (self.destroyed || wire.destroyed || wire.type === 'webSeed') return | ||
|
|
||
| if (self._numQueued > 2 * (self._numConns - self.numPeers) && | ||
| wire.amInterested) { | ||
| @@ -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 | ||
DiegoRBaquero
Member
|
||
| timeoutId = setTimeout(onChokeTimeout, CHOKE_TIMEOUT) | ||
| if (timeoutId.unref) timeoutId.unref() | ||
| } | ||
|
|
||
| wire.isSeeder = false | ||
| updateSeedStatus() | ||
Given that
onChokeTimeoutwill do nothing ifwire.type === 'webSeed', is this guard necessary?