hypercore 10.37.5 → 10.37.7

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.
Files changed (2) hide show
  1. package/lib/replicator.js +14 -2
  2. package/package.json +1 -1
package/lib/replicator.js CHANGED
@@ -300,9 +300,14 @@ class RoundtripQueue {
300
300
  }
301
301
 
302
302
  clear () {
303
- const q = this.queue
303
+ const ids = new Array(this.queue.length)
304
+ for (let i = 0; i < ids.length; i++) {
305
+ ids[i] = this.queue[i][1]
306
+ }
307
+
304
308
  this.queue = []
305
- return q
309
+
310
+ return ids
306
311
  }
307
312
 
308
313
  add (id) {
@@ -754,7 +759,10 @@ class Peer {
754
759
 
755
760
  this.inflight--
756
761
  this.replicator._requestDone(req.id, false)
762
+
763
+ // clear inflight state
757
764
  if (isBlockRequest(req)) this.replicator._unmarkInflight(req.block.index)
765
+ if (isUpgradeRequest(req)) this.replicator._clearInflightUpgrade(req)
758
766
 
759
767
  if (this.roundtripQueue === null) this.roundtripQueue = new RoundtripQueue()
760
768
  this.roundtripQueue.add(req.id)
@@ -2407,3 +2415,7 @@ function setDownloadingLater (repl, downloading, session) {
2407
2415
  function isBlockRequest (req) {
2408
2416
  return req !== null && req.block !== null
2409
2417
  }
2418
+
2419
+ function isUpgradeRequest (req) {
2420
+ return req !== null && req.upgrade !== null
2421
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.37.5",
3
+ "version": "10.37.7",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {