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
path: root/lib
diff options
context:
space:
mode:
authorJulen Garcia Leunda <hicom150@gmail.com>2020-08-15 23:39:15 +0300
committerJulen Garcia Leunda <hicom150@gmail.com>2020-11-04 00:10:35 +0300
commit559544469f9a8969ad37675cc617cd94bebb2797 (patch)
tree6b281959ae980be4486b59012ff10b3eb9a622cb /lib
parentcb22ffe697a128030fa06b08b93d7d0106065637 (diff)
Fix BEP53 implementation
Diffstat (limited to 'lib')
-rw-r--r--lib/torrent.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index 077edcb..12ec6ee 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -25,7 +25,6 @@ const speedometer = require('speedometer')
const utMetadata = require('ut_metadata')
const utPex = require('ut_pex') // browser exclude
const utp = require('utp-native') // browser exclude
-const parseRange = require('parse-numeric-range')
const File = require('./file')
const Peer = require('./peer')
@@ -486,10 +485,12 @@ class Torrent extends EventEmitter {
// Select only specified files (BEP53) http://www.bittorrent.org/beps/bep_0053.html
if (this.so) {
- const selectOnlyFiles = parseRange(this.so)
-
this.files.forEach((v, i) => {
- if (selectOnlyFiles.includes(i)) this.files[i].select(true)
+ if (this.so.includes(i)) {
+ this.files[i].select()
+ } else {
+ this.files[i].deselect()
+ }
})
} else {
// start off selecting the entire torrent with low priority