diff options
-rw-r--r-- | shared/extra-utils/miscs/webtorrent.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/shared/extra-utils/miscs/webtorrent.ts b/shared/extra-utils/miscs/webtorrent.ts index b610fdda8..0683f8893 100644 --- a/shared/extra-utils/miscs/webtorrent.ts +++ b/shared/extra-utils/miscs/webtorrent.ts | |||
@@ -10,8 +10,8 @@ let webtorrent: WebTorrent.Instance | |||
10 | function webtorrentAdd (torrentId: string, refreshWebTorrent = false) { | 10 | function webtorrentAdd (torrentId: string, refreshWebTorrent = false) { |
11 | const WebTorrent = require('webtorrent') | 11 | const WebTorrent = require('webtorrent') |
12 | 12 | ||
13 | if (!webtorrent) webtorrent = new WebTorrent() | 13 | if (webtorrent && refreshWebTorrent) webtorrent.destroy() |
14 | if (refreshWebTorrent === true) webtorrent = new WebTorrent() | 14 | if (!webtorrent || refreshWebTorrent) webtorrent = new WebTorrent() |
15 | 15 | ||
16 | webtorrent.on('error', err => console.error('Error in webtorrent', err)) | 16 | webtorrent.on('error', err => console.error('Error in webtorrent', err)) |
17 | 17 | ||