diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-04-11 12:48:27 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-04-11 12:48:27 +0300 |
commit | 252a7199f80c6cb3f8454505e8479691d1a13568 (patch) | |
tree | 57146cf931aa8edf1cc40af6985528cebf5658a7 | |
parent | 3e21b1bcac40ca3645d3b5c7253ffe8aae16cc3d (diff) |
unref timers
-rw-r--r-- | lib/torrent.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index 6c65383..2b21459 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -480,7 +480,7 @@ Torrent.prototype._onWire = function (wire) { }) // Timeout for piece requests to this peer - wire.setTimeout(self.pieceTimeout) + wire.setTimeout(self.pieceTimeout, true) if (self.metadata) { self._onWireWithMetadata(wire) @@ -500,6 +500,7 @@ Torrent.prototype._onWireWithMetadata = function (wire) { wire.destroy() } else { timeoutId = setTimeout(onChokeTimeout, timeoutMs) + if (timeoutId.unref) timeoutId.unref() } } @@ -534,6 +535,7 @@ Torrent.prototype._onWireWithMetadata = function (wire) { wire.on('choke', function () { clearTimeout(timeoutId) timeoutId = setTimeout(onChokeTimeout, timeoutMs) + if (timeoutId.unref) timeoutId.unref() }) wire.on('unchoke', function () { @@ -555,6 +557,7 @@ Torrent.prototype._onWireWithMetadata = function (wire) { wire.interested() // always start out interested timeoutId = setTimeout(onChokeTimeout, timeoutMs) + if (timeoutId.unref) timeoutId.unref() wire.isSeeder = false updateSeedStatus() |