hypercore 11.36.0 → 11.37.0
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/messages.js +1 -1
- package/lib/replicator.js +5 -8
- package/package.json +1 -1
package/lib/messages.js
CHANGED
|
@@ -215,7 +215,7 @@ const manifest = (exports.manifest = {
|
|
|
215
215
|
const version = c.uint.decode(state)
|
|
216
216
|
|
|
217
217
|
if (version === 0) return manifestv0.decode(state)
|
|
218
|
-
if (version >
|
|
218
|
+
if (version > 3) throw new Error('Unknown version: ' + version)
|
|
219
219
|
|
|
220
220
|
const flags = c.uint.decode(state)
|
|
221
221
|
const hash = hashes.decode(state)
|
package/lib/replicator.js
CHANGED
|
@@ -978,8 +978,7 @@ class Peer {
|
|
|
978
978
|
this.remoteOpened &&
|
|
979
979
|
this.protomux.drained &&
|
|
980
980
|
this.receiverQueue.length > 0 &&
|
|
981
|
-
!this.removed
|
|
982
|
-
this.core.closing === null
|
|
981
|
+
!this.removed
|
|
983
982
|
) {
|
|
984
983
|
const msg = this.receiverQueue.shift()
|
|
985
984
|
await this._handleRequest(msg)
|
|
@@ -990,7 +989,7 @@ class Peer {
|
|
|
990
989
|
}
|
|
991
990
|
|
|
992
991
|
async push(index) {
|
|
993
|
-
if (this.
|
|
992
|
+
if (this.destroyed) return
|
|
994
993
|
if (!this.remoteAllowPush) return
|
|
995
994
|
if (!this.remoteDownloading) return
|
|
996
995
|
if (this.core.state.length <= index) return
|
|
@@ -1271,7 +1270,7 @@ class Peer {
|
|
|
1271
1270
|
return
|
|
1272
1271
|
}
|
|
1273
1272
|
|
|
1274
|
-
if (
|
|
1273
|
+
if (this.core.closed && !isCriticalError(err)) return
|
|
1275
1274
|
|
|
1276
1275
|
if (err.code !== 'INVALID_OPERATION') {
|
|
1277
1276
|
// might be a fork, verify
|
|
@@ -1407,8 +1406,6 @@ class Peer {
|
|
|
1407
1406
|
}
|
|
1408
1407
|
|
|
1409
1408
|
async onrange({ drop, start, length }) {
|
|
1410
|
-
if (this.core.closing !== null) return
|
|
1411
|
-
|
|
1412
1409
|
const has = drop === false
|
|
1413
1410
|
|
|
1414
1411
|
if (drop === true && start < this._remoteContiguousLength) {
|
|
@@ -1960,8 +1957,8 @@ class Peer {
|
|
|
1960
1957
|
}
|
|
1961
1958
|
}
|
|
1962
1959
|
} catch (err) {
|
|
1963
|
-
if (this.
|
|
1964
|
-
|
|
1960
|
+
if (!this.removed) this.stream.destroy(err)
|
|
1961
|
+
|
|
1965
1962
|
return
|
|
1966
1963
|
}
|
|
1967
1964
|
|