hypercore 10.24.7 → 10.24.9
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/replicator.js +4 -5
- package/package.json +1 -1
package/lib/replicator.js
CHANGED
|
@@ -295,7 +295,6 @@ class Peer {
|
|
|
295
295
|
this.dataProcessing = 0
|
|
296
296
|
|
|
297
297
|
this.canUpgrade = true
|
|
298
|
-
this.reopenMaybe = false
|
|
299
298
|
|
|
300
299
|
this.needsSync = false
|
|
301
300
|
this.syncsProcessing = 0
|
|
@@ -376,7 +375,6 @@ class Peer {
|
|
|
376
375
|
}
|
|
377
376
|
|
|
378
377
|
this.needsSync = false
|
|
379
|
-
if (this.replicator.downloading === false) this.reopenMaybe = true
|
|
380
378
|
|
|
381
379
|
this.wireSync.send({
|
|
382
380
|
fork: this.core.tree.fork,
|
|
@@ -421,8 +419,9 @@ class Peer {
|
|
|
421
419
|
onclose (isRemote) {
|
|
422
420
|
// we might have signalled to the remote that we are done (ie not downloading) and the remote might agree on that
|
|
423
421
|
// if that happens, the channel might be closed by the remote. if so just renegotiate it.
|
|
422
|
+
// TODO: add a CLOSE_REASON to mux to we can make this cleaner...
|
|
424
423
|
const reopen = isRemote === true && this.remoteOpened === true && this.remoteDownloading === false &&
|
|
425
|
-
this.remoteUploading === true && this.replicator.downloading === true
|
|
424
|
+
this.remoteUploading === true && this.replicator.downloading === true
|
|
426
425
|
|
|
427
426
|
if (this.session && !reopen) this.replicator._closeSession(this.session)
|
|
428
427
|
|
|
@@ -452,7 +451,7 @@ class Peer {
|
|
|
452
451
|
this.remoteDownloading = downloading
|
|
453
452
|
this.remoteHasManifest = hasManifest
|
|
454
453
|
|
|
455
|
-
if (this.remoteDownloading === false && this.replicator.
|
|
454
|
+
if (this.remoteDownloading === false && this.replicator.isDownloading() === false) {
|
|
456
455
|
// idling, shut it down...
|
|
457
456
|
this.channel.close()
|
|
458
457
|
return
|
|
@@ -1094,7 +1093,7 @@ module.exports = class Replicator {
|
|
|
1094
1093
|
for (const protomux of this._attached) {
|
|
1095
1094
|
if (!protomux.stream.handshakeHash) continue
|
|
1096
1095
|
if (protomux.opened({ protocol: 'hypercore/alpha', id: this.discoveryKey })) continue
|
|
1097
|
-
this._makePeer(protomux, session && session.session())
|
|
1096
|
+
this._makePeer(protomux, session && session.session({ active: false }))
|
|
1098
1097
|
}
|
|
1099
1098
|
}
|
|
1100
1099
|
}
|