autobee 2.0.0-rc.4 → 2.0.0-rc.6

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 CHANGED
@@ -229,6 +229,7 @@ module.exports = class Autobee extends ReadyResource {
229
229
  await this.local.close()
230
230
  await this.system.close()
231
231
  await this._wakeup.close()
232
+ if (this.bootstrap && !this.bootstrap.closed) await this.bootstrap.close()
232
233
  await this._workingBee.close()
233
234
  await this.bee.close()
234
235
  await this.store.close()
@@ -478,6 +479,8 @@ module.exports = class Autobee extends ReadyResource {
478
479
  }
479
480
 
480
481
  async _drain() {
482
+ if (this._updating) await this._updating
483
+
481
484
  if (this.bootFrom) {
482
485
  await this._initFromHead(this.bootFrom)
483
486
  this.bootFrom = null
@@ -527,7 +530,15 @@ module.exports = class Autobee extends ReadyResource {
527
530
  if (this._interrupting) return
528
531
 
529
532
  if (this._needsUpdate) {
530
- await this._update(changes)
533
+ const updating = rrp()
534
+ this._updating = updating.promise
535
+
536
+ try {
537
+ await this._update(changes)
538
+ } finally {
539
+ this._updating = null
540
+ updating.resolve()
541
+ }
531
542
  }
532
543
  }
533
544
 
package/lib/writers.js CHANGED
@@ -214,7 +214,10 @@ class ActiveWriters {
214
214
  return
215
215
  }
216
216
 
217
- w = new Writer(this, this.auto.system, false, bootstrap, id)
217
+ const session = bootstrap.session()
218
+ session.setEncryption(this.auto._getEncryptionProvider())
219
+
220
+ w = new Writer(this, this.auto.system, false, session, id)
218
221
  w.attach()
219
222
  w.couple()
220
223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autobee",
3
- "version": "2.0.0-rc.4",
3
+ "version": "2.0.0-rc.6",
4
4
  "description": "Bee based autobase",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Holepunch Inc.",