diff options
author | tedd pasta <37799569+resession@users.noreply.github.com> | 2022-09-12 18:55:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-12 18:55:29 +0300 |
commit | 05d27bfd449aa705cefefe74d4a9eef327f63b4a (patch) | |
tree | e02d3d630d385a32192f28e86a50cec5bf4ac64c | |
parent | f17a40f42ea3f3c5dae7e267b3ab7bd47eee21d1 (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.js | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -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 } } |