Skip to content

Commit 7b79511

Browse files
committed
Pass inflightRange as arg to new Peer()
1 parent e425930 commit 7b79511

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/replicator.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,15 @@ class BlockTracker {
268268
}
269269

270270
class Peer {
271-
constructor (replicator, protomux, channel, session, opts = {}) {
271+
constructor (replicator, protomux, channel, session, inflightRange) {
272272
this.tracer = createTracer(this, { parent: replicator.core.tracer })
273273
this.core = replicator.core
274274
this.replicator = replicator
275275
this.stream = protomux.stream
276276
this.protomux = protomux
277277
this.remotePublicKey = this.stream.remotePublicKey
278278
this.remoteSupportsSeeks = false
279-
this.inflightRange = opts.inflightRange || DEFAULT_MAX_INFLIGHT
279+
this.inflightRange = inflightRange
280280

281281
this.paused = false
282282

@@ -1242,7 +1242,7 @@ module.exports = class Replicator {
12421242
this.downloading = false
12431243
this.activeSessions = 0
12441244

1245-
this.inflightRange = inflightRange
1245+
this.inflightRange = inflightRange || DEFAULT_MAX_INFLIGHT
12461246

12471247
this._attached = new Set()
12481248
this._inflight = new InflightTracker()
@@ -2093,8 +2093,7 @@ module.exports = class Replicator {
20932093

20942094
if (channel === null) return onnochannel()
20952095

2096-
const opts = { inflightRange: this.inflightRange }
2097-
const peer = new Peer(replicator, protomux, channel, session, opts)
2096+
const peer = new Peer(replicator, protomux, channel, session, this.inflightRange)
20982097
const stream = protomux.stream
20992098

21002099
peer.channel.open({

0 commit comments

Comments
 (0)