diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-01-26 22:18:47 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-01-26 22:18:47 +0300 |
commit | df77c9474303167485525946a62163d009efc6f8 (patch) | |
tree | 52f46eca6fc1935365e1f66ac4714bc64c5b5cc6 /index.js | |
parent | 2570b37e1f7b90ae89530c4b4fb58d90b048aa7a (diff) |
after client.destroy(), no "torrent" event should be emitted
Fixes #254
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -207,6 +207,9 @@ WebTorrent.prototype.seed = function (input, opts, onseed) { createTorrent(input, opts, function (err, torrentBuf) { if (err) return self.emit('error', err) + // if client was destroyed asyncronously, bail early (or `add` will throw) + if (self.destroyed) return + self.add(torrentBuf, opts, function (torrent) { var tasks = [function (cb) { torrent.storage.load(streams, cb) |