[Libreoffice-commits] online.git: loleaflet/src

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon May 22 05:06:32 UTC 2017


 loleaflet/src/core/Socket.js |    2 ++
 loleaflet/src/map/Map.js     |   13 +++++++++++++
 2 files changed, 15 insertions(+)

New commits:
commit 7bc5989aca61b128ff721f52070b1b5b19adbf94
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun May 21 21:51:49 2017 -0400

    loleaflet: correctly reload after server recycling
    
    When the server recylces, the client should
    transparently restore connection when the
    server is back on. This was broken because
    of the different times when moving in and out
    of focus for dimming/inactivity purposes.
    
    Here we track server recycling state
    separately, and skip the dimming/inactivity
    checks in that case.
    
    Change-Id: I432b97b3278b5a6846c8d2c4fa964184f156d5f3
    Reviewed-on: https://gerrit.libreoffice.org/37892
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 4db52fef..6d1ee6bb 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -111,6 +111,7 @@ L.Socket = L.Class.extend({
 
 	_onSocketOpen: function () {
 		console.debug('_onSocketOpen:');
+		this._map._serverRecycling = false;
 		// Always send the protocol version number.
 		// TODO: Move the version number somewhere sensible.
 		this._doSend('loolclient ' + this.ProtocolVersionNumber);
@@ -238,6 +239,7 @@ L.Socket = L.Class.extend({
 				msg = _('Server is recycling and will be available shortly');
 
 				this._map._active = false;
+				this._map._serverRecycling = true;
 
 				// Prevent reconnecting the world at the same time.
 				var min = 5000;
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 0e8d6311..090bafab 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -71,6 +71,7 @@ L.Map = L.Evented.extend({
 		this._fatal = false;
 		this._enabled = true;
 		this._debugAlwaysActive = false; // disables the dimming / document inactivity when true
+		this._serverRecycling = false;
 
 		vex.dialogID = -1;
 
@@ -777,6 +778,10 @@ L.Map = L.Evented.extend({
 	},
 
 	_activate: function () {
+		if (this._serverRecycling) {
+			return;
+		}
+
 		console.debug('_activate:');
 		clearTimeout(vex.timer);
 
@@ -867,6 +872,10 @@ L.Map = L.Evented.extend({
 	},
 
 	_startInactiveTimer: function () {
+		if (this._serverRecycling) {
+			return;
+		}
+
 		console.debug('_startInactiveTimer:');
 		clearTimeout(vex.timer);
 		var map = this;
@@ -876,6 +885,10 @@ L.Map = L.Evented.extend({
 	},
 
 	_deactivate: function () {
+		if (this._serverRecycling) {
+			return;
+		}
+
 		console.debug('_deactivate:');
 		clearTimeout(vex.timer);
 


More information about the Libreoffice-commits mailing list