implemented resetAuth
This commit is contained in:
parent
102bef4f92
commit
e90f241ae0
2
dist
2
dist
@ -1 +1 @@
|
||||
Subproject commit afa05b62a1698be509bf5d93a2aea3d4b46cf93a
|
||||
Subproject commit b613630cef15fc641d5def0db5513fa19234e0a9
|
@ -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
|
||||
|
@ -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<Struct> */ = self.gc1.concat(self.gc2)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user