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.
Files changed (2) hide show
  1. package/index.js +7 -0
  2. 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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.0.0-alpha.35",
3
+ "version": "10.0.0-alpha.36",
4
4
  "description": "Hypercore 10",
5
5
  "main": "index.js",
6
6
  "scripts": {