From 05d27bfd449aa705cefefe74d4a9eef327f63b4a Mon Sep 17 00:00:00 2001 From: tedd pasta <37799569+resession@users.noreply.github.com> Date: Mon, 12 Sep 2022 10:55:29 -0500 Subject: 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 --- index.js | 1 + 1 file changed, 1 insertion(+) 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 } } -- cgit v1.2.3