hypercore 11.12.0 → 11.12.2
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/audit.js +1 -1
- package/lib/replicator.js +4 -1
- package/package.json +1 -1
package/lib/audit.js
CHANGED
|
@@ -112,7 +112,7 @@ module.exports = async function auditCore (core, { tree = true, blocks = true, b
|
|
|
112
112
|
core.bitfield.set(index, false)
|
|
113
113
|
|
|
114
114
|
const page = core.bitfield.getBitfield(index)
|
|
115
|
-
if (page.bitfield) tx.
|
|
115
|
+
if (page.bitfield) tx.putBitfieldPage(page.index, page.bitfield)
|
|
116
116
|
else tx.deleteBitfieldPage(page.idnex)
|
|
117
117
|
continue
|
|
118
118
|
}
|
package/lib/replicator.js
CHANGED
|
@@ -235,10 +235,11 @@ class InflightTracker {
|
|
|
235
235
|
constructor () {
|
|
236
236
|
this._requests = []
|
|
237
237
|
this._free = []
|
|
238
|
+
this._active = 0
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
get idle () {
|
|
241
|
-
return this.
|
|
242
|
+
return this._active === 0
|
|
242
243
|
}
|
|
243
244
|
|
|
244
245
|
* [Symbol.iterator] () {
|
|
@@ -251,6 +252,7 @@ class InflightTracker {
|
|
|
251
252
|
const id = this._free.length ? this._free.pop() : this._requests.push(null)
|
|
252
253
|
req.id = id
|
|
253
254
|
this._requests[id - 1] = req
|
|
255
|
+
this._active++
|
|
254
256
|
return req
|
|
255
257
|
}
|
|
256
258
|
|
|
@@ -260,6 +262,7 @@ class InflightTracker {
|
|
|
260
262
|
|
|
261
263
|
remove (id, roundtrip) {
|
|
262
264
|
if (id > this._requests.length) return
|
|
265
|
+
if (this._requests[id - 1]) this._active--
|
|
263
266
|
this._requests[id - 1] = null
|
|
264
267
|
if (roundtrip === true) this._free.push(id)
|
|
265
268
|
}
|