loleaflet/src/core/Socket.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
New commits: commit 9bfabb16022719e2e6df44a9fa5c02976dcdaa2a Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sun Apr 24 16:38:45 2016 -0400 loleaflet: queue messages only when we fail to connect We should also reconsider message queueing altogether. If we lose connection we should not have any expectation to recover at the same state when the document is shared. In fact it could be dangerous to send those last messages before losing connection, lest they modify a more recent version of the document (after others' changes). Change-Id: I9077c1db5fe1535f1fc85436580b10c751bac2ee Reviewed-on: https://gerrit.libreoffice.org/24348 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 45da3d6..b43d1a8 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -46,20 +46,19 @@ L.Socket = L.Class.extend({ var socketState = this.socket.readyState; if (socketState === 2 || socketState === 3) { this.initialize(this._map); - this._msgQueue.push({msg: msg, coords: coords}); } - if (socketState === 0) { - // push message while trying to connect socket again. - this._msgQueue.push({msg: msg, coords: coords}); - } - else if (socketState === 1) { + if (socketState === 1) { this.socket.send(msg); // Only attempt to log text frames, not binary ones. if (typeof msg === 'string') { L.Log.log(msg, L.OUTGOING, coords); } } + else { + // push message while trying to connect socket again. + this._msgQueue.push({msg: msg, coords: coords}); + } }, _doSend: function(msg, coords) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits