[Libreoffice-commits] online.git: Branch 'refs/tags/cp-4.2.4-3' - 3 commits - loleaflet/images loleaflet/js

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 9 10:48:23 UTC 2020


Rebased ref, commits from common ancestor:
commit e77e689e10bbb86ee52f357e70947f6142bd886b
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Jun 9 11:29:11 2020 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Jun 9 12:47:33 2020 +0200

    Proxy: detect un-responsive sockets & close after 30secs.
    
    Also:
    + fix double poll timer in error
    + remove & rename incorrect interval timer names
    
    Change-Id: Idfae44c0a388312b248c78fc9ad04fe3725990b6
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95910
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index c6590389b..6a0bd23df 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -350,14 +350,16 @@
 		};
 		this.sendQueue = '';
 		this._signalErrorClose = function() {
+			clearInterval(this.pollInterval);
+			clearTimeout(this.delaySession);
+			this.pollInterval = undefined;
+			this.delaySession = undefined;
+
 			if (that.readyState < 3)
 			{
 				this.onerror();
 				this.onclose();
 			}
-			clearInterval(this.waitInterval);
-			clearTimeout(this.delaySession);
-			this.waitInterval = undefined;
 			this.sessionId = 'open';
 			this.inSerial = 0;
 			this.outSerial = 0;
@@ -365,9 +367,14 @@
 			this.openInflight = 0;
 			this.readyState = 3; // CLOSED
 		};
+		// For those who think that long-running sockets are a
+		// better way to wait: you're so right. However, each
+		// consumes a scarce server worker thread while it waits,
+		// so ... back in the real world:
 		this._setPollInterval = function(intervalMs) {
-			clearInterval(that.pollInterval);
-			that.pollInterval = setInterval(that.doSend, intervalMs);
+			clearInterval(this.pollInterval);
+			if (this.readyState === 1)
+				this.pollInterval = setInterval(this.doSend, intervalMs);
 		},
 		this.doSend = function () {
 			if (that.sessionId === 'open')
@@ -388,6 +395,11 @@
 					console.debug('High latency connection - too much in-flight, throttling to ' + that.curPollMs + ' ms.');
 					that._setPollInterval(that.curPollMs);
 				}
+				else if (performance.now() - that.lastDataTimestamp > 30 * 1000)
+				{
+					console.debug('Close connection after no response for 30secs');
+					that._signalErrorClose();
+				}
 				else
 					console.debug('High latency connection - too much in-flight, pausing.');
 				return;
@@ -490,12 +502,7 @@
 					that.sessionId = this.responseText;
 					that.readyState = 1;
 					that.onopen();
-
-					// For those who think that long-running sockets are a
-					// better way to wait: you're so right. However, each
-					// consumes a scarce server worker thread while it waits,
-					// so ... back in the real world:
-					that.pollInterval = setInterval(that.doSend, that.curPollMs);
+					that._setPollInterval(that.curPollMs);
 				}
 			});
 			req.addEventListener('loadend', function() {
@@ -540,9 +547,9 @@
 			console.debug('proxy: close socket');
 			this.readyState = 3;
 			this.onclose();
-			clearInterval(this.waitInterval);
+			clearInterval(this.pollInterval);
 			clearTimeout(this.delaySession);
-			this.waitInterval = undefined;
+			this.pollInterval = undefined;
 			if (oldState === 1) // was open
 				this.sendCloseMsg(this.unloading);
 			this.sessionId = 'open';
commit 80d8018b40ff893ff8d2cb0865dd827455506a1a
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Jun 9 10:44:30 2020 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Jun 9 12:47:28 2020 +0200

    Proxy: don't implement a magic re-connecting socket.
    
    Websockets don't magically re-connect, so we shouldn't either.
    Also avoid starting our send interval timer until we've opened
    to simplify.
    
    Change-Id: Id71049da2d4b4d0ac2f38a3d7410f2446d04f0b1
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95906
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 0cafa649c..c6590389b 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -354,15 +354,15 @@
 			{
 				this.onerror();
 				this.onclose();
-				clearInterval(this.waitInterval);
-				clearTimeout(this.delaySession);
-				this.waitInterval = undefined;
-				this.sessionId = 'open';
-				this.inSerial = 0;
-				this.outSerial = 0;
-				this.msgInflight = 0;
-				this.openInflight = 0;
 			}
+			clearInterval(this.waitInterval);
+			clearTimeout(this.delaySession);
+			this.waitInterval = undefined;
+			this.sessionId = 'open';
+			this.inSerial = 0;
+			this.outSerial = 0;
+			this.msgInflight = 0;
+			this.openInflight = 0;
 			this.readyState = 3; // CLOSED
 		};
 		this._setPollInterval = function(intervalMs) {
@@ -373,10 +373,7 @@
 			if (that.sessionId === 'open')
 			{
 				if (that.readyState === 3)
-				{
-					console.debug('Session closed, opening a new one.');
-					that.getSessionId();
-				}
+					console.debug('Error: sending on closed socket');
 				return;
 			}
 
@@ -488,11 +485,17 @@
 					console.debug('Error: failed to fetch session id! error: ' + this.status);
 					that._signalErrorClose();
 				}
-				else
+				else // we connected - lets get going ...
 				{
 					that.sessionId = this.responseText;
 					that.readyState = 1;
 					that.onopen();
+
+					// For those who think that long-running sockets are a
+					// better way to wait: you're so right. However, each
+					// consumes a scarce server worker thread while it waits,
+					// so ... back in the real world:
+					that.pollInterval = setInterval(that.doSend, that.curPollMs);
 				}
 			});
 			req.addEventListener('loadend', function() {
@@ -555,12 +558,6 @@
 
 		// queue fetch of session id.
 		this.getSessionId();
-
-		// For those who think that long-running sockets are a
-		// better way to wait: you're so right. However, each
-		// consumes a scarce server worker thread while it waits,
-		// so ... back in the real world:
-		this.pollInterval = setInterval(this.doSend, this.curPollMs);
 	};
 
 	if (global.socketProxy)
commit 91455bfd999c6438313974f949eb2f5e7b248014
Author:     Pedro Pinto Silva <pedro.silva at collabora.com>
AuthorDate: Tue Jun 9 09:40:10 2020 +0200
Commit:     Pedro Silva <pedro.silva at collabora.com>
CommitDate: Tue Jun 9 11:29:48 2020 +0200

    Mobile: Add world count icon to the hamburger menu
    
    Change-Id: Ie637ef42b05904d4399363f86d094bcf3a5e257d
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95894
    Tested-by: Jenkins
    Tested-by: Pedro Silva <pedro.silva at collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Pedro Silva <pedro.silva at collabora.com>
    (cherry picked from commit bd1c6ff8b60f638117741d233bba0104364d7319)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95875

diff --git a/loleaflet/images/lc_wordcountdialog.svg b/loleaflet/images/lc_wordcountdialog.svg
new file mode 100644
index 000000000..f5c43498d
--- /dev/null
+++ b/loleaflet/images/lc_wordcountdialog.svg
@@ -0,0 +1 @@
+<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m2 13h20v9h-20z" fill="#fff"/><path d="m5.300971 19.833333h1.4555016v-3.696491c0-.161404.00566-.329825.01699-.505263l-.9797731.784211c-.064185.04912-.1283709.07895-.1925567.08947-.064185.0105-.1245952.0105-.1812296 0-.056634-.0105-.1076052-.02806-.1529126-.05263-.041532-.02807-.073625-.05614-.096278-.08421l-.4304213-.547367 2.2597087-1.821053h1.2402913v5.833333h1.1666667v1.166667h-4.105987z" fill="#4d82b8"/><path d="m17 14q .478098 0 .867853.145942.394952.140729.670379.40134.280624.260611.431328.630678.155903.364854.155903.807892 0 .380492-.10913.708861-.10913.323158-.291017.620254-.181885.291884-.426132.573343-.244247.276248-.514477.557707l-1.465479 1.537602q.233853-.07297.467707-.109457.233852-.0417.436525-.0417h1.564217q.197476 0 .317.114672.124721.114666.124721.302305v.750559h-4.666667v-.422189q0-.119881.04677-.255399.05196-.140729.176689-.26061l2.005939-2.069248q.25464-.265823.44692-.505585.197475-.239761.3273
 94-.474311.135114-.239761.202673-.479524.06756-.244973.06756-.510796 0-.479524-.23905-.724498-.23905-.244974-.675576-.244974-.187082 0-.342984.05734-.155902.05734-.280623.156366-.124722.09903-.213066.234551-.08834.135518-.135116.291884-.08315.23976-.228656.312732-.140311.07296-.389754.03127l-.665187-.11466q.07795-.505585.280623-.880865.202673-.380491.504084-.630677.306607-.255398.701558-.380492.394955-.130313.847071-.130313z" fill="#4d82b8"/><g fill="#808080"><path d="m12 10.999999h-1.084615q-.184615 0-.300001-.09133-.107692-.09132-.16923-.22831l-.8615385-2.40487h-4.169231l-.853846 2.39726q-.0461546.12938-.1769231.228315-.1230763.098936-.3.098936h-1.0846154l3.7923078-10h1.4230769l3.7846153 10zm-6.2307693-3.71385h3.4615386l-1.4307693-4.0258759q-.076923-.1826485-.1538462-.4261796-.076923-.2435312-.1461538-.5251141-.0769232.2891932-.1538463.5327245-.076923.2435311-.1461538.4261796z"/><path d="m13 11v-9.9999999h3.637185c.701435 0 1.303098.060882 1.804988.1826484.507936.1166925.922146.28
 91934 1.242628.5175039.326531.2232369.565381.4972095.716553.8219177.151171.3196347.226758.6823948.226758 1.0882799 0 .2435313-.04534.4794525-.136048.7077625-.08465.2283113-.214666.4388638-.390022.6316588-.175359.1927967-.39607.3678337-.662132.5251147-.266063.15728-.580498.28412-.943311.380518.828421.136986 1.451247.398275 1.86848.783866.42328.380518.634921.8828.634921 1.506849 0 .42618-.08768.814307-.263039 1.164383-.17536.350077-.432352.651953-.770975.905632-.338624.248605-.755857.4414-1.251699.578387-.489796.136987-1.052154.205479-1.687073.205479zm1.333334-4.550989v3.455099h2.666663c.417234 0 .773998-.04312 1.070292-.129376.302345-.09133.547243-.215626.734694-.372908.193501-.15728.332579-.345002.417235-.563165.0907-.223237.136048-.464232.136048-.722983 0-.51243-.193501-.918317-.5805-1.217657-.380947-.29934-.973538-.44901-1.777769-.44901zm0-.974125h2.24036c.405139 0 .758881-.04059 1.061223-.121762.302343-.08625.553289-.202943.752833-.350076.199547-.1471342.347695-.3247092.444444-.5
 327255.102795-.2080162.154192-.4388637.154192-.6925412 0-.5834604-.190476-1.0096401-.571426-1.2785391-.374906-.2739751-.967498-.4109613-1.777776-.4109613h-2.303852z"/><path d="m2.0058594 12.000071c-.5577284 0-1.0058594.448131-1.0058594 1.005858v8.988212c0 .557728.448131 1.005859 1.0058594 1.005859h19.9882816c.557728 0 1.005859-.448131 1.005859-1.005859v-8.988212c0-.557727-.448131-1.005858-1.005859-1.005858zm-.00586 1h20l .0000006 8.999929h-20z"/></g></svg>
\ No newline at end of file


More information about the Libreoffice-commits mailing list