Skip to content
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

Merged
merged 2 commits into from Jan 18, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

Address feross's feedback

  • Loading branch information
feross committed Jan 18, 2017
commit 6f3d4a54007909f9a22e4dc3bdefd40af0d39d6b
@@ -1532,7 +1532,7 @@ Torrent.prototype._request = function (wire, index, hotswap) {
wire.have(index)
})

self._checkDone(onDone)
if (self._checkDone()) self.discovery.complete()
} else {
self.pieces[index] = new Piece(piece.length)
self.emit('warning', new Error('Piece ' + index + ' failed verification'))
@@ -1541,21 +1541,16 @@ 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 (cb) {
Torrent.prototype._checkDone = function () {
var self = this
if (self.destroyed) return
if (!cb) cb = noop

// are any new files done?
self.files.forEach(function (file) {
@@ -1584,11 +1579,11 @@ Torrent.prototype._checkDone = function (cb) {
if (!self.done && done) {
self.done = true
self._debug('torrent done: ' + self.infoHash)
cb(null)
self.emit('done')

This comment has been minimized.

Copy link
@feross

feross Dec 8, 2016

Member

Let's return true at the very end of this if statement.

This comment has been minimized.

Copy link
@sidd

sidd Dec 8, 2016

Author Contributor

Returning true before _gcSelections seems to be causing tests to hang. getBuffer never calls its callback: https://github.com/feross/webtorrent/blob/master/test/node/download-dht-magnet.js#L77. return done after _gcSelections the function resolves this. Thoughts?

This comment has been minimized.

Copy link
@feross

feross Jan 18, 2017

Member

Yeah, good point

}

This comment has been minimized.

Copy link
@feross

feross Dec 8, 2016

Member

Otherwise, return false.


self._gcSelections()

return done
}

Torrent.prototype.load = function (streams, cb) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.