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:
authorJulen Garcia Leunda <hicom150@gmail.com>2020-11-12 19:04:53 +0300
committerJulen Garcia Leunda <hicom150@gmail.com>2020-11-12 19:04:53 +0300
commit0ba67b8e8f54d888ba0dd14a6e5f4a18d46e1294 (patch)
tree4d831e47fcec3182e9cc33830143bcaef5be685f
parente5445be2f5d64bc545211c604e106dc3bcb10385 (diff)
Add lsd option to client
-rw-r--r--index.js1
-rw-r--r--lib/torrent.js6
2 files changed, 5 insertions, 2 deletions
diff --git a/index.js b/index.js
index 5b69b1c..9544691 100644
--- a/index.js
+++ b/index.js
@@ -70,6 +70,7 @@ class WebTorrent extends EventEmitter {
this.torrentPort = opts.torrentPort || 0
this.dhtPort = opts.dhtPort || 0
this.tracker = opts.tracker !== undefined ? opts.tracker : {}
+ this.lsd = opts.lsd === true
this.torrents = []
this.maxConns = Number(opts.maxConns) || 55
this.utp = opts.utp === true
diff --git a/lib/torrent.js b/lib/torrent.js
index 0db32e3..8787e53 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -334,14 +334,16 @@ class Torrent extends EventEmitter {
dht: !this.private && this.client.dht,
tracker: trackerOpts,
port: this.client.torrentPort,
- userAgent: USER_AGENT
+ userAgent: USER_AGENT,
+ lsd: this.client.lsd
})
this.discovery.on('error', (err) => {
this._destroy(err)
})
- this.discovery.on('peer', (peer) => {
+ this.discovery.on('peer', (peer, source) => {
+ this._debug('peer %s discovered via %s', peer, source)
// Don't create new outgoing TCP connections when torrent is done
if (typeof peer === 'string' && this.done) return
this.addPeer(peer)