Skip to content

Commit 6f07eb4

Browse files
committed
Mafintosh's feedback x2
1 parent 5de8a21 commit 6f07eb4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/replicator.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ class Peer {
308308

309309
this.remoteFork = 0
310310
this.remoteLength = 0
311-
this.remoteContiguousLength = 0
312311
this.remoteCanUpgrade = false
313312
this.remoteUploading = true
314313
this.remoteDownloading = true
@@ -326,6 +325,10 @@ class Peer {
326325
replicator._ifAvailable++
327326
}
328327

328+
get remoteContiguousLength () {
329+
return this.remoteBitfield.findFirst(false, 0)
330+
}
331+
329332
getMaxInflight () {
330333
const stream = this.stream.rawStream
331334
if (!stream.udx) return Math.min(this.inflightRange[1], this.inflightRange[0] * 3)
@@ -680,9 +683,6 @@ class Peer {
680683
}
681684

682685
onrange ({ drop, start, length }) {
683-
if (start === 0) this.remoteContiguousLength = length
684-
if (drop) this.remoteContiguousLength = Math.min(this.remoteContiguousLength, start)
685-
686686
const has = drop === false
687687
const rangeStart = this.remoteBitfield.findFirst(!has, start)
688688
const rangeLength = length - (rangeStart - start)

0 commit comments

Comments
 (0)