From 4309d70fb2473e0097bed3b0b7525579de4a52a4 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sun, 17 May 2015 16:35:11 -0700 Subject: remove torrent from client on fatal torrent error also, fixed a bug with choking where we were inspecting wire._destroyed instead of wire.destroyed. --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'index.js') diff --git a/index.js b/index.js index 7de7edb..62183af 100644 --- a/index.js +++ b/index.js @@ -168,6 +168,7 @@ WebTorrent.prototype.download = function (torrentId, opts, ontorrent) { torrent.on('error', function (err) { self.emit('error', err, torrent) + self.remove(torrent) }) torrent.on('listening', function (port) { @@ -231,7 +232,7 @@ WebTorrent.prototype.seed = function (input, opts, onseed) { /** * Remove a torrent from the client. - * @param {string|Buffer} torrentId + * @param {string|Buffer|Torrent} torrentId * @param {function} cb */ WebTorrent.prototype.remove = function (torrentId, cb) { -- cgit v1.2.3