hypercore 10.30.3 → 10.30.4
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/batch.js +9 -0
- package/lib/replicator.js +4 -2
- package/package.json +1 -1
package/lib/batch.js
CHANGED
|
@@ -317,6 +317,15 @@ module.exports = class HypercoreBatch extends EventEmitter {
|
|
|
317
317
|
const flushingLength = Math.min(length - this._sessionLength, this._appends.length)
|
|
318
318
|
if (flushingLength <= 0) return true
|
|
319
319
|
|
|
320
|
+
if (this.session.replicator._upgrade) {
|
|
321
|
+
for (const req of this.session.replicator._upgrade.inflight) {
|
|
322
|
+
// yield to the remote inflight upgrade, TODO: if the remote upgrade fails, retry flushing...
|
|
323
|
+
if (req.upgrade && (req.upgrade.start + req.upgrade.length) > length) {
|
|
324
|
+
return false
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
320
329
|
const batch = this.createTreeBatch(this._sessionLength + flushingLength)
|
|
321
330
|
if (batch === null) return false
|
|
322
331
|
|
package/lib/replicator.js
CHANGED
|
@@ -688,8 +688,10 @@ class Peer {
|
|
|
688
688
|
safetyCatch(err)
|
|
689
689
|
if (this.core.closed && !isCriticalError(err)) return
|
|
690
690
|
|
|
691
|
-
|
|
692
|
-
|
|
691
|
+
if (err.code !== 'INVALID_OPERATION') {
|
|
692
|
+
// might be a fork, verify
|
|
693
|
+
this._checkIfConflict(err)
|
|
694
|
+
}
|
|
693
695
|
this.replicator._onnodata(this, req)
|
|
694
696
|
return
|
|
695
697
|
} finally {
|