From 1b6b6e44c7e636043372795d840848e5a7ec71f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20Baquero?= Date: Tue, 8 Mar 2016 23:19:12 -0300 Subject: [PATCH 1/2] Lower max requests of webseeds to real value `getPipelineLength` adds 2 extra more requests possible to each wire. In the case of a webseed, if it already has speed, let the webseed handle its real max requests. --- lib/torrent.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/torrent.js b/lib/torrent.js index 46f31063..c1d08e31 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -1127,6 +1127,7 @@ Torrent.prototype._request = function (wire, index, hotswap) { if (self.bitfield.get(index)) return false var maxOutstandingRequests = getPipelineLength(wire, PIPELINE_MAX_DURATION) + if (isWebSeed && maxOutstandingRequests > 2) maxOutstandingRequests -= 2; // A webseed will handle it's real max requests if (numRequests >= maxOutstandingRequests) return false // var endGame = (wire.requests.length === 0 && self.store.numMissing < 30) From 841004e88dea703b272f7149fbf20a52d61d10b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20Baquero?= Date: Tue, 8 Mar 2016 23:22:51 -0300 Subject: [PATCH 2/2] Standard fix --- lib/torrent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/torrent.js b/lib/torrent.js index c1d08e31..206cd4c3 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -1127,7 +1127,7 @@ Torrent.prototype._request = function (wire, index, hotswap) { if (self.bitfield.get(index)) return false var maxOutstandingRequests = getPipelineLength(wire, PIPELINE_MAX_DURATION) - if (isWebSeed && maxOutstandingRequests > 2) maxOutstandingRequests -= 2; // A webseed will handle it's real max requests + if (isWebSeed && maxOutstandingRequests > 2) maxOutstandingRequests -= 2 // A webseed will handle it's real max requests if (numRequests >= maxOutstandingRequests) return false // var endGame = (wire.requests.length === 0 && self.store.numMissing < 30)