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>2016-05-11 19:30:39 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-05-11 19:30:39 +0300
commit5ebba786d50077365b55c193df2d570bf5498b6e (patch)
tree61caef5bb43b6171405649f9fe88a09edcd26341 /index.js
parentd144dfcb3622761f661a9a2628ef8f07f6bf5f87 (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.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/index.js b/index.js
index f8194da..3a69d3c 100644
--- a/index.js
+++ b/index.js
@@ -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)
}