Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-01-26 22:18:47 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-01-26 22:18:47 +0300
commitdf77c9474303167485525946a62163d009efc6f8 (patch)
tree52f46eca6fc1935365e1f66ac4714bc64c5b5cc6 /index.js
parent2570b37e1f7b90ae89530c4b4fb58d90b048aa7a (diff)
after client.destroy(), no "torrent" event should be emitted
Fixes #254
Diffstat (limited to 'index.js')
-rw-r--r--index.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/index.js b/index.js
index 6015104..27f7f48 100644
--- a/index.js
+++ b/index.js
@@ -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)