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:
authorFeross Aboukhadijeh <feross@feross.org>2015-12-29 19:24:17 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-12-29 19:46:10 +0300
commit210741b62b2f9dbab5ce43c10f1473bd8c85b850 (patch)
tree23fcfa971550d8667fa19d77a5b77c57840ef11b
parent8518ea886ae0af22f89b62d000dfd9d43e3e9a20 (diff)
BREAKING: rename opts.maxPeers -> opts.maxConns
- The underlying option on the `bittorrent-swarm` instance is named `maxConns` which is a more accurate name - Let `bittorrent-swarm` handle non-number maxConns values
-rw-r--r--README.md2
-rw-r--r--index.js4
-rw-r--r--lib/torrent.js4
3 files changed, 5 insertions, 5 deletions
diff --git a/README.md b/README.md
index edb0535..1a6a09a 100644
--- a/README.md
+++ b/README.md
@@ -229,7 +229,7 @@ If `opts` is specified, then the default options (shown below) will be overridde
``` js
{
dht: Boolean|Object, // Enable DHT (default=true), or options object for DHT
- maxPeers: Number, // Max number of peers to connect to per torrent (default=100)
+ maxConns: Number, // Max number of connections per torrent (default=55)
nodeId: String|Buffer, // DHT protocol node ID (default=randomly generated)
peerId: String|Buffer, // Wire protocol peer ID (default=randomly generated)
rtcConfig: Object, // RTCPeerConnection configuration object (default=STUN only)
diff --git a/index.js b/index.js
index 6e1bf4a..2281a91 100644
--- a/index.js
+++ b/index.js
@@ -42,7 +42,7 @@ var VERSION_PREFIX = '-WW' + VERSION_STR + '-'
/**
* WebTorrent Client
- * @param {Object} opts
+ * @param {Object=} opts
*/
function WebTorrent (opts) {
var self = this
@@ -64,7 +64,7 @@ function WebTorrent (opts) {
self.downloadSpeed = speedometer()
self.uploadSpeed = speedometer()
- self.maxPeers = (Number(opts.maxPeers) && opts.maxPeers !== 0) ? opts.maxPeers : undefined
+ self.maxConns = opts.maxConns
self.peerId = typeof opts.peerId === 'string'
? opts.peerId
diff --git a/lib/torrent.js b/lib/torrent.js
index 3f41c09..8af4b68 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -50,7 +50,7 @@ inherits(Torrent, EventEmitter)
/**
* @param {string|Buffer|Object} torrentId
- * @param {Object} opts
+ * @param {Object=} opts
*/
function Torrent (torrentId, opts) {
EventEmitter.call(this)
@@ -204,7 +204,7 @@ Torrent.prototype._onParsedTorrent = function (parsedTorrent) {
handshake: {
dht: self.private ? false : !!self.client.dht
},
- maxConns: self.client.maxPeers
+ maxConns: self.client.maxConns
})
self.swarm.on('error', self._onError.bind(self))
self.swarm.on('wire', self._onWire.bind(self))