hypercore 11.21.0 → 11.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/replicator.js +4 -5
- package/package.json +1 -1
package/lib/replicator.js
CHANGED
|
@@ -187,7 +187,7 @@ class RangeRequest extends Attachable {
|
|
|
187
187
|
this.ifAvailable = ifAvailable
|
|
188
188
|
this.blocks = blocks
|
|
189
189
|
this.ranges = ranges
|
|
190
|
-
|
|
190
|
+
ranges.push(this)
|
|
191
191
|
|
|
192
192
|
if (this.end === -1) {
|
|
193
193
|
this.replicator._alwaysLatestBlock++
|
|
@@ -199,13 +199,12 @@ class RangeRequest extends Attachable {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
_unref() {
|
|
202
|
-
|
|
203
|
-
if (
|
|
202
|
+
const rangeIndex = this.ranges.indexOf(this)
|
|
203
|
+
if (rangeIndex === -1) return
|
|
204
204
|
|
|
205
205
|
const h = this.ranges.pop()
|
|
206
206
|
if (h !== this) {
|
|
207
|
-
this.ranges[
|
|
208
|
-
h.rangeIndex = this.rangeIndex
|
|
207
|
+
this.ranges[rangeIndex] = h
|
|
209
208
|
}
|
|
210
209
|
|
|
211
210
|
if (this.end === -1) {
|