Skip to content

Conversation

@autarc
Copy link
Contributor

@autarc autarc commented Mar 14, 2016

Currently the client waits for the callback signal of all trackers - including the ones which were previously unable to connect and destroyed. Since the process stays open, the torrents which reference them as their discovery won't be destroyed either and in the end prevent closing the webtorrent client.

@yciabaud
Copy link
Contributor

+1

HTTPTracker.prototype.destroy = function (cb) {
var self = this
if (self.destroyed) return
if (self.destroyed) return cb && cb()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for cb &&. You can see that we just call cb() directly below. This is an internal function, so we're always sure that it's called with a cb parameter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should be cb(null) for consistency with how it's called below.

feross added a commit that referenced this pull request Mar 15, 2016
invoke callbacks of destroyed trackers
@feross feross merged commit 2fee125 into webtorrent:master Mar 15, 2016
feross added a commit that referenced this pull request Mar 15, 2016
@feross
Copy link
Member

feross commented Mar 15, 2016

Thanks for catching this issue and sending an excellent PR! I made a few changes here: 6df64ff

@feross
Copy link
Member

feross commented Mar 15, 2016

Released as 7.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants