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:
authorBruce Hopkins <behopkinsjr@gmail.com>2022-02-03 23:32:52 +0300
committerGitHub <noreply@github.com>2022-02-03 23:32:52 +0300
commit051fea3223d85f3d1a681b98b8d889810d7ad38d (patch)
tree9f0eed4ae0e4cfe88de0af1c5a35bcf38d33bbbf /index.js
parentef52a00e5bd987ef7f86bb6fb2c48572d5e6dcc2 (diff)
refactor: Return Torrent when client.seed finds a duplicate (#2239)
* refactor: passes duplicate torrent in cb when creating seed * refactor: seed method passes torrent if duplicate * refactor: seed method passes torrent if duplicate * refactor: return Torrent when client.seed finds a duplicate * fix:changed warning Co-authored-by: Diego Rodríguez Baquero <github@diegorbaquero.com> Co-authored-by: Bruce-Hopkins <behopkins@gmail.com> Co-authored-by: Diego Rodríguez Baquero <github@diegorbaquero.com>
Diffstat (limited to 'index.js')
-rw-r--r--index.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/index.js b/index.js
index 3e07d04..26bf323 100644
--- a/index.js
+++ b/index.js
@@ -393,7 +393,9 @@ class WebTorrent extends EventEmitter {
const existingTorrent = this.get(torrentBuf)
if (existingTorrent) {
- torrent._destroy(new Error(`Cannot add duplicate torrent ${existingTorrent.infoHash}`))
+ console.warn('A torrent with the same id is already being seeded')
+ torrent._destroy()
+ if (typeof onseed === 'function') onseed(existingTorrent)
} else {
torrent._onTorrentId(torrentBuf)
}