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:
authorAlex <alxmorais8@msn.com>2020-03-15 00:11:40 +0300
committerAlex <alxmorais8@msn.com>2020-03-15 00:11:40 +0300
commit1feb4b6f9aad2793c662c9fb55993edfa83f8079 (patch)
tree7b385ded17be43145e580a23daff51fd65ced17f /lib
parent31f5166d9ee807d181ab547fcc58421ea85efdf5 (diff)
Add tests for private option
Diffstat (limited to 'lib')
-rw-r--r--lib/torrent.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index 9375d99..765678c 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -69,11 +69,12 @@ class Torrent extends EventEmitter {
this.urlList = opts.urlList
this.path = opts.path
- this.private = !!opts.private
this.skipVerify = !!opts.skipVerify
this._store = opts.store || FSChunkStore
this._getAnnounceOpts = opts.getAnnounceOpts
+ if (typeof opts.private === 'boolean') this.private = opts.private
+
this.strategy = opts.strategy || 'sequential'
this.maxWebConns = opts.maxWebConns || 4
@@ -253,6 +254,14 @@ class Torrent extends EventEmitter {
_processParsedTorrent (parsedTorrent) {
this._debugId = parsedTorrent.infoHash.toString('hex').substring(0, 7)
+ if (typeof this.private !== 'undefined') {
+ // `private` option overrides default, only if it's defined
+ parsedTorrent.private = this.private
+ } else {
+ // use default value
+ this.private = !!parsedTorrent.private
+ }
+
if (this.announce) {
// Allow specifying trackers via `opts` parameter
parsedTorrent.announce = parsedTorrent.announce.concat(this.announce)