diff options
author | Bruce Hopkins <behopkinsjr@gmail.com> | 2022-02-03 23:32:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 23:32:52 +0300 |
commit | 051fea3223d85f3d1a681b98b8d889810d7ad38d (patch) | |
tree | 9f0eed4ae0e4cfe88de0af1c5a35bcf38d33bbbf /index.js | |
parent | ef52a00e5bd987ef7f86bb6fb2c48572d5e6dcc2 (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.js | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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) } |