@@ -268,14 +268,15 @@ class BlockTracker {
268
268
}
269
269
270
270
class Peer {
271
- constructor ( replicator , protomux , channel , session ) {
271
+ constructor ( replicator , protomux , channel , session , inflightRange ) {
272
272
this . tracer = createTracer ( this , { parent : replicator . core . tracer } )
273
273
this . core = replicator . core
274
274
this . replicator = replicator
275
275
this . stream = protomux . stream
276
276
this . protomux = protomux
277
277
this . remotePublicKey = this . stream . remotePublicKey
278
278
this . remoteSupportsSeeks = false
279
+ this . inflightRange = inflightRange
279
280
280
281
this . paused = false
281
282
@@ -299,7 +300,6 @@ class Peer {
299
300
this . receiverBusy = false
300
301
301
302
this . inflight = 0
302
- this . inflightRange = DEFAULT_MAX_INFLIGHT
303
303
this . dataProcessing = 0
304
304
305
305
this . canUpgrade = true
@@ -1221,6 +1221,7 @@ module.exports = class Replicator {
1221
1221
notDownloadingLinger = NOT_DOWNLOADING_SLACK ,
1222
1222
eagerUpgrade = true ,
1223
1223
allowFork = true ,
1224
+ inflightRange = null ,
1224
1225
onpeerupdate = noop ,
1225
1226
onupload = noop ,
1226
1227
oninvalid = noop
@@ -1241,6 +1242,8 @@ module.exports = class Replicator {
1241
1242
this . downloading = false
1242
1243
this . activeSessions = 0
1243
1244
1245
+ this . inflightRange = inflightRange || DEFAULT_MAX_INFLIGHT
1246
+
1244
1247
this . _attached = new Set ( )
1245
1248
this . _inflight = new InflightTracker ( )
1246
1249
this . _blocks = new BlockTracker ( )
@@ -2090,7 +2093,7 @@ module.exports = class Replicator {
2090
2093
2091
2094
if ( channel === null ) return onnochannel ( )
2092
2095
2093
- const peer = new Peer ( replicator , protomux , channel , session )
2096
+ const peer = new Peer ( replicator , protomux , channel , session , this . inflightRange )
2094
2097
const stream = protomux . stream
2095
2098
2096
2099
peer . channel . open ( {
0 commit comments