From 4643ec3b8952ef4c304d722ae04d2f7387fbbf1b Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 22 Jan 2015 17:18:33 +0100 Subject: [PATCH] torrent: cancelBlocks on wire 'close' --- lib/torrent.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/torrent.js b/lib/torrent.js index 1ab3eb82..d8a96eb6 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -514,6 +514,9 @@ Torrent.prototype._onWireWithMetadata = function (wire) { wire.on('close', function () { clearTimeout(timeoutId) + wire.requests.forEach(function (req) { + self.storage.cancelBlock(req.piece, req.offset) + }) }) wire.on('choke', function () {