From fd20dfa766c8fbd24831e7c9ad08e5f81e0e2b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20Baquero?= Date: Sun, 20 Dec 2015 21:21:14 -0500 Subject: [PATCH 1/2] Update file.js for deselected fix --- lib/file.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/file.js b/lib/file.js index 340ff37f..6881676a 100644 --- a/lib/file.js +++ b/lib/file.js @@ -26,6 +26,7 @@ function File (torrent, file) { this.offset = file.offset this.done = false + this.deselected = false var start = file.offset var end = start + file.length - 1 @@ -45,6 +46,7 @@ function File (torrent, file) { */ File.prototype.select = function () { if (this.length === 0) return + this.deselected = false this._torrent.select(this._startPiece, this._endPiece, false) } @@ -54,6 +56,7 @@ File.prototype.select = function () { */ File.prototype.deselect = function () { if (this.length === 0) return + this.deselected = true this._torrent.deselect(this._startPiece, this._endPiece, false) } From 33b2f473b3876df2664e818016a42b75e2a89dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20Baquero?= Date: Sun, 20 Dec 2015 21:22:16 -0500 Subject: [PATCH 2/2] Update torrent.js for deselected fix --- lib/torrent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/torrent.js b/lib/torrent.js index 00415f39..aadec486 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -1153,7 +1153,7 @@ Torrent.prototype._checkDone = function () { }) // is the torrent done? - if (self.files.every(function (file) { return file.done })) { + if (self.files.every(function (file) { return file.done || file.deselected })) { self.done = true self.emit('done') debug('torrent done: ' + self.infoHash)