diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-05-11 19:30:39 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-05-11 19:30:39 +0300 |
commit | 5ebba786d50077365b55c193df2d570bf5498b6e (patch) | |
tree | 61caef5bb43b6171405649f9fe88a09edcd26341 /index.js | |
parent | d144dfcb3622761f661a9a2628ef8f07f6bf5f87 (diff) |
On duplicate torrent add, don't emit 'infoHash'
Private 'infoHash' event allows client.add to check for duplicate
torrents and destroy them before the normal 'infoHash' event is
emitted. Prevents user applications from needing to deal with duplicate
'infoHash' events.
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -240,7 +240,7 @@ WebTorrent.prototype.add = function (torrentId, opts, ontorrent) { var torrent = new Torrent(torrentId, self, opts) self.torrents.push(torrent) - torrent.once('infoHash', onInfoHash) + torrent.once('_infoHash', onInfoHash) torrent.once('ready', onReady) torrent.once('close', onClose) @@ -262,7 +262,7 @@ WebTorrent.prototype.add = function (torrentId, opts, ontorrent) { } function onClose () { - torrent.removeListener('infoHash', onInfoHash) + torrent.removeListener('_infoHash', onInfoHash) torrent.removeListener('ready', onReady) torrent.removeListener('close', onClose) } |