Skip to content

Commit

Permalink
Mafintosh's feedback x2
Browse files Browse the repository at this point in the history
  • Loading branch information
LuKks committed Jul 6, 2023
1 parent 5de8a21 commit 6f07eb4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/replicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ class Peer {

this.remoteFork = 0
this.remoteLength = 0
this.remoteContiguousLength = 0
this.remoteCanUpgrade = false
this.remoteUploading = true
this.remoteDownloading = true
Expand All @@ -326,6 +325,10 @@ class Peer {
replicator._ifAvailable++
}

get remoteContiguousLength () {
return this.remoteBitfield.findFirst(false, 0)
}

getMaxInflight () {
const stream = this.stream.rawStream
if (!stream.udx) return Math.min(this.inflightRange[1], this.inflightRange[0] * 3)
Expand Down Expand Up @@ -680,9 +683,6 @@ class Peer {
}

onrange ({ drop, start, length }) {
if (start === 0) this.remoteContiguousLength = length
if (drop) this.remoteContiguousLength = Math.min(this.remoteContiguousLength, start)

const has = drop === false
const rangeStart = this.remoteBitfield.findFirst(!has, start)
const rangeLength = length - (rangeStart - start)
Expand Down

0 comments on commit 6f07eb4

Please sign in to comment.