blind-peer 2.8.0 → 2.8.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/bin.js +7 -5
- package/index.js +3 -2
- package/package.json +2 -2
package/bin.js
CHANGED
|
@@ -79,13 +79,13 @@ const cmd = command('blind-peer',
|
|
|
79
79
|
})
|
|
80
80
|
|
|
81
81
|
blindPeer.on('announce-core', core => {
|
|
82
|
-
logger.info(`Started announcing core ${coreToInfo(core)}`)
|
|
82
|
+
logger.info(`Started announcing core ${coreToInfo(core, true)}`)
|
|
83
83
|
})
|
|
84
84
|
blindPeer.on('core-downloaded', core => {
|
|
85
|
-
logger.info(`Announced core fully downloaded: ${coreToInfo(core)}`)
|
|
85
|
+
logger.info(`Announced core fully downloaded: ${coreToInfo(core, true)}`)
|
|
86
86
|
})
|
|
87
87
|
blindPeer.on('core-append', core => {
|
|
88
|
-
logger.info(`Detected announced-core length update: ${coreToInfo(core)}`)
|
|
88
|
+
logger.info(`Detected announced-core length update: ${coreToInfo(core, true)}`)
|
|
89
89
|
})
|
|
90
90
|
|
|
91
91
|
blindPeer.on('gc-start', ({ bytesToClear }) => {
|
|
@@ -229,9 +229,11 @@ function streamToStr (stream) {
|
|
|
229
229
|
return `${pubKey}`
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
function coreToInfo (core) {
|
|
232
|
+
function coreToInfo (core, includePublicKey = false) {
|
|
233
233
|
const discKey = hypCrypto.discoveryKey(core.key)
|
|
234
|
-
|
|
234
|
+
let res = `Discovery key ${idEnc.normalize(discKey)} (${core.contiguousLength} / ${core.length}, ${core.peers.length} peers)`
|
|
235
|
+
if (includePublicKey) res += `. Public key: ${idEnc.normalize(core.key)}`
|
|
236
|
+
return res
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
cmd.parse()
|
package/index.js
CHANGED
|
@@ -426,10 +426,11 @@ class BlindPeer extends ReadyResource {
|
|
|
426
426
|
record.announce = false
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
// We only add it to the db the first time
|
|
429
|
+
// We only add it to the db the first time, except if announce changed
|
|
430
430
|
// Note: not race condition safe, but it's no problem if we do add the same core twice
|
|
431
431
|
const existing = await this.db.getCoreRecord(record.key)
|
|
432
|
-
|
|
432
|
+
const upgradeToAnnounce = existing && !existing.announce && record.announce
|
|
433
|
+
if (!existing || upgradeToAnnounce) {
|
|
433
434
|
this.db.addCore(record)
|
|
434
435
|
await this.flush() // flush now as important data
|
|
435
436
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blind-peer",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"description": "Blind peers help keep hypercores available",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"tiny-byte-size": "^1.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"blind-peering": "^1.
|
|
36
|
+
"blind-peering": "^1.13.0",
|
|
37
37
|
"brittle": "^3.7.0",
|
|
38
38
|
"debounceify": "^1.1.0",
|
|
39
39
|
"hyperdht": "^6.20.1",
|