Commit 593e07c0 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug:

first user open file and connect to server but auth comes later
second user open file and connect to server and receive wait auth
first user receive connection state change and ignore this message because not auth
parent ff075675
...@@ -567,6 +567,7 @@ ...@@ -567,6 +567,7 @@
this.isLicenseInit = false; this.isLicenseInit = false;
this._locks = {}; this._locks = {};
this._msgBuffer = []; this._msgBuffer = [];
this._msgInputBuffer = [];
this._lockCallbacks = {}; this._lockCallbacks = {};
this._lockCallbacksErrorTimerId = {}; this._lockCallbacksErrorTimerId = {};
this._saveCallback = []; this._saveCallback = [];
...@@ -917,6 +918,12 @@ ...@@ -917,6 +918,12 @@
} }
}; };
DocsCoApi.prototype._applyPrebuffered = function () {
for (var i = 0; i < this._msgInputBuffer.length; ++i) {
this._msgInputBuffer[i]();
}
this._msgInputBuffer = [];
};
DocsCoApi.prototype._sendPrebuffered = function() { DocsCoApi.prototype._sendPrebuffered = function() {
for (var i = 0; i < this._msgBuffer.length; i++) { for (var i = 0; i < this._msgBuffer.length; i++) {
this._sendRaw(this._msgBuffer[i]); this._sendRaw(this._msgBuffer[i]);
...@@ -1290,7 +1297,11 @@ ...@@ -1290,7 +1297,11 @@
}; };
DocsCoApi.prototype._onConnectionStateChanged = function(data) { DocsCoApi.prototype._onConnectionStateChanged = function(data) {
var t = this;
if (!this.check_state()) { if (!this.check_state()) {
this._msgInputBuffer.push(function () {
t._onConnectionStateChanged(data);
});
return; return;
} }
var userStateChanged = null, userId, stateChanged = false, isEditUser = true; var userStateChanged = null, userId, stateChanged = false, isEditUser = true;
...@@ -1367,6 +1378,9 @@ ...@@ -1367,6 +1378,9 @@
this._onMessages(data, true); this._onMessages(data, true);
this._onGetLock(data); this._onGetLock(data);
//Apply prebuffered
this._applyPrebuffered();
if (this._isReSaveAfterAuth) { if (this._isReSaveAfterAuth) {
var callbackAskSaveChanges = function(e) { var callbackAskSaveChanges = function(e) {
if (false === e["saveLock"]) { if (false === e["saveLock"]) {
...@@ -1415,6 +1429,9 @@ ...@@ -1415,6 +1429,9 @@
this.onFirstLoadChangesEnd(); this.onFirstLoadChangesEnd();
} }
//Apply prebuffered
this._applyPrebuffered();
//Send prebuffered //Send prebuffered
this._sendPrebuffered(); this._sendPrebuffered();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment