Don't send COMMIT-MESSAGE when socketio connection is not active
parent
d26df86490
commit
fb20c26c5f
|
@ -181,20 +181,26 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
}
|
||||
|
||||
var sentMessage = false;
|
||||
var userChangesData = editor.prepareUserChangeset();
|
||||
if (userChangesData.changeset)
|
||||
{
|
||||
lastCommitTime = t;
|
||||
state = "COMMITTING";
|
||||
stateMessage = {
|
||||
type: "USER_CHANGES",
|
||||
baseRev: rev,
|
||||
changeset: userChangesData.changeset,
|
||||
apool: userChangesData.apool
|
||||
};
|
||||
sendMessage(stateMessage);
|
||||
sentMessage = true;
|
||||
callbacks.onInternalAction("commitPerformed");
|
||||
if (getSocket().realConnected) {
|
||||
var userChangesData = editor.prepareUserChangeset();
|
||||
if (userChangesData.changeset)
|
||||
{
|
||||
lastCommitTime = t;
|
||||
state = "COMMITTING";
|
||||
stateMessage = {
|
||||
type: "USER_CHANGES",
|
||||
baseRev: rev,
|
||||
changeset: userChangesData.changeset,
|
||||
apool: userChangesData.apool
|
||||
};
|
||||
sendMessage(stateMessage);
|
||||
sentMessage = true;
|
||||
callbacks.onInternalAction("commitPerformed");
|
||||
}
|
||||
}
|
||||
else {
|
||||
// run again in a few seconds, to check if there was a reconnection attempt
|
||||
setTimeout(wrapRecordingErrors("setTimeout(handleUserChanges)", handleUserChanges), 1000);
|
||||
}
|
||||
|
||||
if (sentMessage)
|
||||
|
|
|
@ -201,15 +201,19 @@ function handshake()
|
|||
});
|
||||
|
||||
socket.once('connect', function () {
|
||||
// Setup our own connected flag since socketio one doesn't work accurately
|
||||
socket.realConnected = true;
|
||||
sendClientReady(false);
|
||||
});
|
||||
|
||||
socket.on('reconnect', function () {
|
||||
socket.realConnected = true;
|
||||
pad.collabClient.setChannelState("CONNECTED");
|
||||
pad.sendClientReady(true);
|
||||
});
|
||||
|
||||
socket.on('reconnecting', function() {
|
||||
socket.realConnected = false;
|
||||
pad.collabClient.setChannelState("RECONNECTING");
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue