diff --git a/dist b/dist index afa05b62..b613630c 160000 --- a/dist +++ b/dist @@ -1 +1 @@ -Subproject commit afa05b62a1698be509bf5d93a2aea3d4b46cf93a +Subproject commit b613630cef15fc641d5def0db5513fa19234e0a9 diff --git a/src/Connector.js b/src/Connector.js index d1766fcb..c14856ce 100644 --- a/src/Connector.js +++ b/src/Connector.js @@ -60,6 +60,15 @@ module.exports = function (Y/* :any */) { this.authInfo = opts.auth || null this.checkAuth = opts.checkAuth || function () { return Promise.resolve('write') } // default is everyone has write access } + resetAuth (auth) { + if (this.authInfo !== auth) { + this.authInfo = auth + this.broadcast({ + type: 'auth', + auth: this.authInfo + }) + } + } reconnect () { } disconnect () { @@ -296,7 +305,6 @@ module.exports = function (Y/* :any */) { type: 'sync done' }) } - conn._setSyncedWith(sender) }) } else if (message.type === 'sync step 2' && canWrite(auth)) { let conn = this diff --git a/src/Database.js b/src/Database.js index 7bfe6cfa..811bf5ad 100644 --- a/src/Database.js +++ b/src/Database.js @@ -188,6 +188,8 @@ module.exports = function (Y /* :any */) { } stopGarbageCollector () { var self = this + this.gc = false + this.gcTimeout = -1 return new Promise(function (resolve) { self.requestTransaction(function * () { var ungc /* :Array */ = self.gc1.concat(self.gc2) diff --git a/src/Transaction.js b/src/Transaction.js index 2ddddc61..a61abf97 100644 --- a/src/Transaction.js +++ b/src/Transaction.js @@ -369,6 +369,9 @@ module.exports = function (Y/* :any */) { if (this.store.gc1.length > 0 || this.store.gc2.length > 0) { console.warn('gc should be empty after sync') } + if (!this.store.gc) { + return + } yield* this.os.iterate(this, null, null, function * (op) { if (op.gc) { delete op.gc