hypercore 11.1.1 → 11.2.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 +3 -3
- package/lib/replicator.js +7 -4
- package/package.json +4 -2
package/lib/messages.js
CHANGED
|
@@ -141,7 +141,7 @@ const manifestv0 = {
|
|
|
141
141
|
hash: c.fixed32.decode(state),
|
|
142
142
|
length: 0
|
|
143
143
|
},
|
|
144
|
-
linked:
|
|
144
|
+
linked: null
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -153,7 +153,7 @@ const manifestv0 = {
|
|
|
153
153
|
quorum: 1,
|
|
154
154
|
signers: [signer.decode(state)],
|
|
155
155
|
prologue: null,
|
|
156
|
-
linked:
|
|
156
|
+
linked: null
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -166,7 +166,7 @@ const manifestv0 = {
|
|
|
166
166
|
quorum: c.uint.decode(state),
|
|
167
167
|
signers: signerArray.decode(state),
|
|
168
168
|
prologue: null,
|
|
169
|
-
linked:
|
|
169
|
+
linked: null
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
}
|
package/lib/replicator.js
CHANGED
|
@@ -1109,7 +1109,9 @@ class Peer {
|
|
|
1109
1109
|
: { start: this.core.state.length, length: this.remoteLength - this.core.state.length },
|
|
1110
1110
|
// remote manifest check can be removed eventually...
|
|
1111
1111
|
manifest: this.core.header.manifest === null && this.remoteHasManifest === true,
|
|
1112
|
-
priority
|
|
1112
|
+
priority,
|
|
1113
|
+
timestamp: Date.now(),
|
|
1114
|
+
elapsed: 0
|
|
1113
1115
|
}
|
|
1114
1116
|
}
|
|
1115
1117
|
|
|
@@ -2097,9 +2099,10 @@ module.exports = class Replicator {
|
|
|
2097
2099
|
}
|
|
2098
2100
|
|
|
2099
2101
|
_ondata (peer, req, data) {
|
|
2102
|
+
req.elapsed = Date.now() - req.timestamp
|
|
2100
2103
|
if (data.block !== null) {
|
|
2101
2104
|
this._resolveBlockRequest(this._blocks, data.block.index, data.block.value, req)
|
|
2102
|
-
this._ondownload(data.block.index, data.block.value.byteLength, peer)
|
|
2105
|
+
this._ondownload(data.block.index, data.block.value.byteLength, peer, req)
|
|
2103
2106
|
}
|
|
2104
2107
|
|
|
2105
2108
|
if (data.hash !== null && (data.hash.index & 1) === 0) {
|
|
@@ -2492,12 +2495,12 @@ module.exports = class Replicator {
|
|
|
2492
2495
|
}
|
|
2493
2496
|
}
|
|
2494
2497
|
|
|
2495
|
-
_ondownload (index, byteLength, from) {
|
|
2498
|
+
_ondownload (index, byteLength, from, req) {
|
|
2496
2499
|
const sessions = this.core.monitors
|
|
2497
2500
|
|
|
2498
2501
|
for (let i = sessions.length - 1; i >= 0; i--) {
|
|
2499
2502
|
const s = sessions[i]
|
|
2500
|
-
s.emit('download', index, byteLength - s.padding, from)
|
|
2503
|
+
s.emit('download', index, byteLength - s.padding, from, req)
|
|
2501
2504
|
}
|
|
2502
2505
|
}
|
|
2503
2506
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypercore",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Hypercore is a secure, distributed append-only log",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "standard && node test/all.js",
|
|
8
|
+
"test:bare": "bare test/all.js",
|
|
8
9
|
"test:generate": "brittle -r test/all.js test/*.js"
|
|
9
10
|
},
|
|
10
11
|
"repository": {
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
"standard": "^17.0.0",
|
|
74
75
|
"test-tmp": "^1.0.2",
|
|
75
76
|
"tiny-byte-size": "^1.1.0",
|
|
76
|
-
"udx-native": "^1.6.1"
|
|
77
|
+
"udx-native": "^1.6.1",
|
|
78
|
+
"uncaughts": "^1.1.0"
|
|
77
79
|
}
|
|
78
80
|
}
|