disable preferUntransformed

This commit is contained in:
Kevin Jahns 2017-08-04 20:36:07 +02:00
parent 4e3a297efc
commit 6fa79320a5
2 changed files with 3 additions and 11 deletions

View File

@ -36,7 +36,6 @@ module.exports = function (Y/* :any */) {
// this client receives operations from only one other client. // this client receives operations from only one other client.
// In particular, this does not work with y-webrtc. // In particular, this does not work with y-webrtc.
// It will work with y-websockets-client // It will work with y-websockets-client
this.preferUntransformed = opts.preferUntransformed || false
if (opts.role == null || opts.role === 'master') { if (opts.role == null || opts.role === 'master') {
this.role = 'master' this.role = 'master'
} else if (opts.role === 'slave') { } else if (opts.role === 'slave') {
@ -188,9 +187,6 @@ module.exports = function (Y/* :any */) {
protocolVersion: conn.protocolVersion, protocolVersion: conn.protocolVersion,
auth: conn.authInfo auth: conn.authInfo
} }
if (conn.preferUntransformed && Object.keys(stateSet).length === 0) {
answer.preferUntransformed = true
}
conn.send(syncUser, answer) conn.send(syncUser, answer)
}) })
} else { } else {
@ -304,11 +300,7 @@ module.exports = function (Y/* :any */) {
protocolVersion: this.protocolVersion, protocolVersion: this.protocolVersion,
auth: this.authInfo auth: this.authInfo
} }
if (message.preferUntransformed === true && Object.keys(m.stateSet).length === 0) { answer.os = yield* this.getOperations(m.stateSet)
answer.osUntransformed = yield* this.getOperationsUntransformed()
} else {
answer.os = yield* this.getOperations(m.stateSet)
}
conn.send(sender, answer) conn.send(sender, answer)
if (this.forwardToSyncingClients) { if (this.forwardToSyncingClients) {
conn.syncingClients.push(sender) conn.syncingClients.push(sender)

View File

@ -96,7 +96,7 @@ module.exports = function (Y/* :any */) {
send.push(Y.Struct[op.struct].encode(op)) send.push(Y.Struct[op.struct].encode(op))
} }
} }
if (this.store.y.connector.isSynced && send.length > 0) { // TODO: && !this.store.forwardAppliedOperations (but then i don't send delete ops) if (send.length > 0) { // TODO: && !this.store.forwardAppliedOperations (but then i don't send delete ops)
// is connected, and this is not going to be send in addOperation // is connected, and this is not going to be send in addOperation
this.store.y.connector.broadcastOps(send) this.store.y.connector.broadcastOps(send)
} }
@ -717,7 +717,7 @@ module.exports = function (Y/* :any */) {
} }
* addOperation (op) { * addOperation (op) {
yield* this.os.put(op) yield* this.os.put(op)
if (this.store.y.connector.isSynced && this.store.forwardAppliedOperations && typeof op.id[1] !== 'string') { if (this.store.forwardAppliedOperations && typeof op.id[1] !== 'string') {
// is connected, and this is not going to be send in addOperation // is connected, and this is not going to be send in addOperation
this.store.y.connector.broadcastOps([op]) this.store.y.connector.broadcastOps([op])
} }