New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't send 'completed' event to tracker on client.seed #991
Changes from 1 commit
File filter...
Jump to…
don't emit 'completed' on client.seed
- Loading branch information
| @@ -1532,7 +1532,7 @@ Torrent.prototype._request = function (wire, index, hotswap) { | ||
| wire.have(index) | ||
| }) | ||
|
|
||
| self._checkDone() | ||
| self._checkDone(onDone) | ||
|
||
| } else { | ||
| self.pieces[index] = new Piece(piece.length) | ||
| self.emit('warning', new Error('Piece ' + index + ' failed verification')) | ||
| @@ -1541,16 +1541,21 @@ Torrent.prototype._request = function (wire, index, hotswap) { | ||
| }) | ||
| }) | ||
|
|
||
| function onDone () { | ||
| self.discovery.complete() | ||
| } | ||
|
|
||
| function onUpdateTick () { | ||
| process.nextTick(function () { self._update() }) | ||
| } | ||
|
|
||
| return true | ||
| } | ||
|
|
||
| Torrent.prototype._checkDone = function () { | ||
| Torrent.prototype._checkDone = function (cb) { | ||
feross
Member
|
||
| var self = this | ||
| if (self.destroyed) return | ||
| if (!cb) cb = noop | ||
|
|
||
| // are any new files done? | ||
| self.files.forEach(function (file) { | ||
| @@ -1579,7 +1584,7 @@ Torrent.prototype._checkDone = function () { | ||
| if (!self.done && done) { | ||
| self.done = true | ||
| self._debug('torrent done: ' + self.infoHash) | ||
| self.discovery.complete() | ||
| cb(null) | ||
| self.emit('done') | ||
sidd
Author
Contributor
|
||
| } | ||
|
||
|
|
||
If this returns
true, then we can callself.discovery.complete().