hypercore 10.0.0-alpha.35 → 10.0.0-alpha.36
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/index.js +7 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -329,6 +329,13 @@ module.exports = class Hypercore extends EventEmitter {
|
|
|
329
329
|
const noiseStream = protocolStream.noiseStream
|
|
330
330
|
const protocol = noiseStream.userData
|
|
331
331
|
|
|
332
|
+
// If the user wants to, we can make this replication run in a session
|
|
333
|
+
// that way the core wont close "under them" during replication
|
|
334
|
+
if (opts.session) {
|
|
335
|
+
const s = this.session()
|
|
336
|
+
protocolStream.on('close', () => s.close().catch(noop))
|
|
337
|
+
}
|
|
338
|
+
|
|
332
339
|
if (this.opened) {
|
|
333
340
|
this.replicator.attachTo(protocol)
|
|
334
341
|
} else {
|