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 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
- this.rangeIndex = ranges.push(this) - 1
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
- if (this.rangeIndex >= this.ranges.length) return
203
- if (this.ranges[this.rangeIndex] !== this) return
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[this.rangeIndex] = h
208
- h.rangeIndex = this.rangeIndex
207
+ this.ranges[rangeIndex] = h
209
208
  }
210
209
 
211
210
  if (this.end === -1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "11.21.0",
3
+ "version": "11.21.1",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {