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:
authortedd pasta <37799569+resession@users.noreply.github.com>2022-09-12 18:55:29 +0300
committerGitHub <noreply@github.com>2022-09-12 18:55:29 +0300
commit05d27bfd449aa705cefefe74d4a9eef327f63b4a (patch)
treee02d3d630d385a32192f28e86a50cec5bf4ac64c
parentf17a40f42ea3f3c5dae7e267b3ab7bd47eee21d1 (diff)
fix: return duplicate torrent on Webtorrent.add() (#2372)
* Update index.js if the there is a duplicate torrent, return the torrent * no more emitting 'torrent' for duplicate torrents
-rw-r--r--index.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/index.js b/index.js
index 1476004..00920e0 100644
--- a/index.js
+++ b/index.js
@@ -286,6 +286,7 @@ class WebTorrent extends EventEmitter {
for (const t of this.torrents) {
if (t.infoHash === torrent.infoHash && t !== torrent) {
torrent._destroy(new Error(`Cannot add duplicate torrent ${torrent.infoHash}`))
+ ontorrent(t)
return
}
}