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

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Thu May 21 21:02:57 UTC 2020


 loleaflet/js/global.js |   20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit ec48b7c746110a5779ec505ed1ba4700222c62d3
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu May 21 21:25:34 2020 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu May 21 23:02:39 2020 +0200

    Proxy: handle connection failure during session gracefully.
    
    Change-Id: Ib8bda31352de6fea406b32b86bc134ee2a7841d8
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94652
    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 6cc75b7b5..373d1635e 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -295,6 +295,17 @@
 			}
 		};
 		this.sendQueue = '';
+		this._signalErrorClose = function() {
+			if (that.readyState < 3)
+			{
+				this.onerror();
+				this.onclose();
+				clearInterval(this.waitInterval);
+				this.waitInterval = undefined;
+				this.sessionId = 'open';
+			}
+			this.readyState = 3; // CLOSED
+		};
 		this.doSend = function () {
 			if (that.sessionId === 'open')
 			{
@@ -315,7 +326,10 @@
 				if (this.status == 200)
 					that.parseIncomingArray(new Uint8Array(this.response));
 				else
-					console.debug('proxy: error on incoming response');
+				{
+					console.debug('proxy: error on incoming response ' + this.status);
+					that._signalErrorClose();
+				}
 			});
 			req.addEventListener('loadend', function() {
 				that.msgInflight--;
@@ -333,9 +347,7 @@
 				if (this.responseText.indexOf('\n') >= 0)
 				{
 					console.debug('Error: failed to fetch session id!');
-					that.onerror();
-					that.onclose();
-					that.readyState = 3;
+					that._signalErrorClose();
 				}
 				else
 				{


More information about the Libreoffice-commits mailing list