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

New commits:
commit 12d542a9e8eb2d4d97c860b041a723e44de990b6
Author: Ashod Nakashian <ashod.nakash...@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.
    
    Reviewed-on: https://gerrit.libreoffice.org/37892
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>
    (cherry picked from commit 7bc5989aca61b128ff721f52070b1b5b19adbf94)
    
    Change-Id: I432b97b3278b5a6846c8d2c4fa964184f156d5f3
    Reviewed-on: https://gerrit.libreoffice.org/37901
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index a2ef4f27..0e8374d4 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -16,6 +16,7 @@ L.Socket = L.Class.extend({
        },
 
        initialize: function (map) {
+               console.debug('socket.initialize:');
                this._map = map;
                try {
                        if (map.options.permission) {
@@ -109,6 +110,8 @@ 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);
@@ -236,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;
@@ -552,11 +556,13 @@ L.Socket = L.Class.extend({
        },
 
        _onSocketError: function () {
+               console.debug('_onSocketError:');
                this._map.hideBusy();
                // Let onclose (_onSocketClose) report errors.
        },
 
        _onSocketClose: function (e) {
+               console.debug('_onSocketClose:');
                var isActive = this._map._active;
                this._map.hideBusy();
                this._map._active = false;
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);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to