diff options
-rw-r--r-- | lib/torrent.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index 0b69556..ad0785d 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -1532,7 +1532,7 @@ Torrent.prototype._request = function (wire, index, hotswap) { wire.have(index) }) - self._checkDone() + if (self._checkDone()) self.discovery.complete() } else { self.pieces[index] = new Piece(piece.length) self.emit('warning', new Error('Piece ' + index + ' failed verification')) @@ -1579,11 +1579,11 @@ Torrent.prototype._checkDone = function () { if (!self.done && done) { self.done = true self._debug('torrent done: ' + self.infoHash) - self.discovery.complete() self.emit('done') } - self._gcSelections() + + return done } Torrent.prototype.load = function (streams, cb) { |