[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - 6 commits - loleaflet/build loleaflet/debug loleaflet/dist loleaflet/main.css loleaflet/main.js loleaflet/README loleaflet/src wsd/LOOLWSD.cpp wsd/UserMessages.hpp

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Thu Mar 1 11:58:05 UTC 2018


 loleaflet/README                         |    8 ++++
 loleaflet/build/deps.js                  |    5 +-
 loleaflet/debug/document/loleaflet.html  |    1 
 loleaflet/dist/errormessages.js          |    3 +
 loleaflet/dist/loleaflet.css             |   10 +++++
 loleaflet/main.css                       |    1 
 loleaflet/main.js                        |    1 
 loleaflet/src/control/Control.Infobar.js |   42 ++++++++++++++++++++++++
 loleaflet/src/core/Socket.js             |   43 ++++++++++++++-----------
 wsd/LOOLWSD.cpp                          |   53 +++++++++++++++++++++++--------
 wsd/UserMessages.hpp                     |    5 +-
 11 files changed, 137 insertions(+), 35 deletions(-)

New commits:
commit a532e1d40e28578920164f7ca94ca66f095b5362
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Feb 22 15:54:59 2018 +0100

    Only show warning if limit is exceeded
    
    not when it is reached
    
    Change-Id: I802f839e49f4c8ed9e423b093e7306b5480a1812
    Reviewed-on: https://gerrit.libreoffice.org/50188
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit cabe0a750a13d39dc9a6781e24c0e06e0be5d412)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 18c4ac208..bb10acd00 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1511,7 +1511,7 @@ static std::shared_ptr<ClientSession> createNewClientSession(const WebSocketHand
             }
 #if !ENABLE_SUPPORT_KEY
             // Users of development versions get just an info when reaching max documents or connections
-            if (DocBrokers.size() + 1 > LOOLWSD::MaxDocuments || LOOLWSD::NumConnections >= LOOLWSD::MaxConnections)
+            if (DocBrokers.size() > LOOLWSD::MaxDocuments || LOOLWSD::NumConnections >= LOOLWSD::MaxConnections)
             {
                 infoLimitReached(ws);
             }
commit dc68c1232e11a3bc8a03be7fca41a13797b80cce
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Feb 22 15:43:29 2018 +0100

    Notify new user too about low disk / limit reached
    
    Change-Id: I150baaa5cf2b1162505324102afc038fd19b3bb6
    Reviewed-on: https://gerrit.libreoffice.org/50186
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 5176d9d4c03cee0a592446bc491b768e74bed361)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 1b9f78548..18c4ac208 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -216,7 +216,7 @@ inline void shutdownLimitReached(WebSocketHandler& ws)
     }
 }
 
-inline void infoLimitReached()
+inline void infoLimitReached(const WebSocketHandler* ws)
 {
     const std::string info = Poco::format(PAYLOAD_INFO_LIMIT_REACHED, LOOLWSD::MaxDocuments, LOOLWSD::MaxConnections);
     LOG_INF("Sending client 'limitreached' message: " << info);
@@ -224,6 +224,7 @@ inline void infoLimitReached()
     try
     {
         Util::alertAllUsers(info);
+        ws->sendMessage(info);
     }
     catch (const std::exception& ex)
     {
@@ -1492,28 +1493,29 @@ static std::shared_ptr<ClientSession> createNewClientSession(const WebSocketHand
     LOG_CHECK_RET(docBroker && "Null docBroker instance", nullptr);
     try
     {
-        const std::string fs = FileUtil::checkDiskSpaceOnRegisteredFileSystems();
-        if (!fs.empty())
-        {
-            LOG_WRN("File system of [" << fs << "] is dangerously low on disk space.");
-            const std::string diskfullMsg = "error: cmd=internal kind=diskfull";
-            // Alert all other existing sessions also
-            Util::alertAllUsers(diskfullMsg);
-        }
-#if !ENABLE_SUPPORT_KEY
-        // Users of development versions get just an info when reaching max documents or connections
-        if (DocBrokers.size() + 1 > LOOLWSD::MaxDocuments || LOOLWSD::NumConnections >= LOOLWSD::MaxConnections)
-        {
-            infoLimitReached();
-        }
-#endif
-
         // Now we have a DocumentBroker and we're ready to process client commands.
         if (ws)
         {
             const std::string statusReady = "statusindicator: ready";
             LOG_TRC("Sending to Client [" << statusReady << "].");
             ws->sendMessage(statusReady);
+
+            const std::string fs = FileUtil::checkDiskSpaceOnRegisteredFileSystems();
+            if (!fs.empty())
+            {
+                LOG_WRN("File system of [" << fs << "] is dangerously low on disk space.");
+                const std::string diskfullMsg = "error: cmd=internal kind=diskfull";
+                // Alert all existing sessions
+                Util::alertAllUsers(diskfullMsg);
+                ws->sendMessage(diskfullMsg);
+            }
+#if !ENABLE_SUPPORT_KEY
+            // Users of development versions get just an info when reaching max documents or connections
+            if (DocBrokers.size() + 1 > LOOLWSD::MaxDocuments || LOOLWSD::NumConnections >= LOOLWSD::MaxConnections)
+            {
+                infoLimitReached(ws);
+            }
+#endif
         }
 
         // In case of WOPI, if this session is not set as readonly, it might be set so
commit 39878c90f9742dcc98469e015f4aa6123e2d1feb
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Feb 22 14:50:26 2018 +0100

    Improve message displayed when limit reached
    
    Change-Id: I659d3e5156bc4ae8e6b30a7fd9f9957dd1a868ec
    Reviewed-on: https://gerrit.libreoffice.org/50179
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit 08ee839562c4f2e62570c9cecdbc0a6d3ce99b2f)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/dist/errormessages.js b/loleaflet/dist/errormessages.js
index 36937c06d..bdad9bb96 100644
--- a/loleaflet/dist/errormessages.js
+++ b/loleaflet/dist/errormessages.js
@@ -1,6 +1,6 @@
 exports.diskfull = _('No disk space left on server, please contact the server administrator to continue.');
 exports.emptyhosturl = _('The host URL is empty. The loolwsd server is probably misconfigured, please contact the administrator.');
-exports.limitreached = _('This is an unsupported version of {productname}. To avoid the impression that it is suitable for deployment in enterprises, this version is limited to {docs} documents, and {connections} connections.');
+exports.limitreached = _('This is an unsupported version of {productname}. To avoid the impression that it is suitable for deployment in enterprises, this message appears when more than {docs} documents or {connections} connections are in use concurrently');
 exports.infoandsupport = _('More information and support');
 exports.limitreachedprod = _('This service is limited to %0 documents, and %1 connections total by the admin. This limit has been reached. Please try again later.');
 exports.serviceunavailable = _('Service is unavailable. Please try again later and report to your administrator if the issue persists.');
commit 658e21f846aa34f0528dbd2a4227786b72899b9a
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Feb 22 15:43:05 2018 +0100

    Add some right margin for info msgs
    
    Change-Id: I037b8dd42fa8dafb1686284e9241a32f4068ff75
    Reviewed-on: https://gerrit.libreoffice.org/50185
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit deecd0e0d8bd66942800400ba13935955d231d3f)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/dist/loleaflet.css b/loleaflet/dist/loleaflet.css
index ab8dd4b28..fac0c79cb 100644
--- a/loleaflet/dist/loleaflet.css
+++ b/loleaflet/dist/loleaflet.css
@@ -371,4 +371,5 @@ body {
 /* Place above statusbar */
 .vex.vex-theme-bottom-right-corner .vex-content {
 	bottom: 40px !important;
+	right: 10px !important;
 }
\ No newline at end of file
commit d2418f3d291562bd06c87c0308f4b54196469b1c
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Feb 22 14:19:03 2018 +0100

    Add non-obtrusive notification method (infobar-alike)
    
    This reuses the vex dialogs and pushes notifications to the bottom right area.
    Converted the limit reached notification to this new type.
    
    Change-Id: I20f0c1202eecde028e70156f02ba31497ef2f9b9
    (cherry picked from commit 4c9872188f3ae5f876fb5652273c6bdb10065d14)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/README b/loleaflet/README
index acc790da6..4694417a2 100644
--- a/loleaflet/README
+++ b/loleaflet/README
@@ -300,6 +300,14 @@ Error:
             + [e.cmd] = the command that caused the error
             + [e.kind] = the kind of error
 
+Infobars:
+    - events
+        map.on('infobar', function (e) {}) where
+            + [e.msg] = a message
+            + [e.actionlabel] = Label for the action button
+            + [e.action] = A link (starting with http).
+                           Please extend to allow other actions when needed.
+
 CommandValues:
     - api:
         map.getToolbarCommandValues(command)
diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 9fd024f98..36ac9607f 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -350,8 +350,9 @@ var deps = {
 
 	ControlDialog: {
 		src: ['control/Control.js',
-		      'control/Control.LokDialog.js',
-		      'control/Control.AlertDialog.js'],
+			'control/Control.LokDialog.js',
+			'control/Control.AlertDialog.js',
+			'control/Control.Infobar.js'],
 		heading: 'Controls',
 		desc: 'Handles vex dialogs for displaying alerts'
 	},
diff --git a/loleaflet/debug/document/loleaflet.html b/loleaflet/debug/document/loleaflet.html
index 49c0dfced..2d7a6a758 100644
--- a/loleaflet/debug/document/loleaflet.html
+++ b/loleaflet/debug/document/loleaflet.html
@@ -20,6 +20,7 @@
 <link rel="stylesheet" href="/loleaflet/%VERSION%/contextMenu/jquery.contextMenu.css">
 <link rel="stylesheet" href="/loleaflet/%VERSION%/dialog/vex.css" />
 <link rel="stylesheet" href="/loleaflet/%VERSION%/dialog/vex-theme-plain.css" />
+<link rel="stylesheet" href="/loleaflet/%VERSION%/dialog/vex-theme-bottom-right-corner.css" />
 <link rel="stylesheet" href="/loleaflet/%VERSION%/toolbar/w2ui.min.css" />
 <link rel="stylesheet" href="/loleaflet/%VERSION%/toolbar/select2.min.css" />
 <link rel="stylesheet" href="/loleaflet/%VERSION%/smartmenus/sm-core-css.css" />
diff --git a/loleaflet/dist/errormessages.js b/loleaflet/dist/errormessages.js
index edda0764e..36937c06d 100644
--- a/loleaflet/dist/errormessages.js
+++ b/loleaflet/dist/errormessages.js
@@ -1,6 +1,7 @@
 exports.diskfull = _('No disk space left on server, please contact the server administrator to continue.');
 exports.emptyhosturl = _('The host URL is empty. The loolwsd server is probably misconfigured, please contact the administrator.');
-exports.limitreached = _('This is an unsupported version of {productname}. To avoid the impression that it is suitable for deployment in enterprises, this version is limited to {docs} documents, and {connections} connections.<br/>{a}More information and support{/a}');
+exports.limitreached = _('This is an unsupported version of {productname}. To avoid the impression that it is suitable for deployment in enterprises, this version is limited to {docs} documents, and {connections} connections.');
+exports.infoandsupport = _('More information and support');
 exports.limitreachedprod = _('This service is limited to %0 documents, and %1 connections total by the admin. This limit has been reached. Please try again later.');
 exports.serviceunavailable = _('Service is unavailable. Please try again later and report to your administrator if the issue persists.');
 exports.unauthorized = _('Unauthorized WOPI host. Please try again later and report to your administrator if the issue persists.');
diff --git a/loleaflet/dist/loleaflet.css b/loleaflet/dist/loleaflet.css
index 5ac2a7258..ab8dd4b28 100644
--- a/loleaflet/dist/loleaflet.css
+++ b/loleaflet/dist/loleaflet.css
@@ -363,3 +363,12 @@ body {
         -webkit-user-select: none;
         -o-user-select: none;
 }
+
+/* Infobar */
+.vex-theme-bottom-right-corner .vex-dialog-message {
+	font-size: 1em;
+}
+/* Place above statusbar */
+.vex.vex-theme-bottom-right-corner .vex-content {
+	bottom: 40px !important;
+}
\ No newline at end of file
diff --git a/loleaflet/main.css b/loleaflet/main.css
index 729b21b31..de61241f8 100644
--- a/loleaflet/main.css
+++ b/loleaflet/main.css
@@ -14,6 +14,7 @@
 @import url('node_modules/jquery-contextmenu/dist/jquery.contextMenu.css');
 @import url('node_modules/vex-js/css/vex.css');
 @import url('node_modules/vex-js/css/vex-theme-plain.css');
+ at import url('node_modules/vex-js/css/vex-theme-bottom-right-corner.css');
 @import url('node_modules/w2ui/w2ui.css');
 @import url('node_modules/select2/dist/css/select2.css');
 @import url('node_modules/smartmenus/dist/css/sm-core-css.css');
diff --git a/loleaflet/main.js b/loleaflet/main.js
index 02bedc687..8a79a8bb5 100644
--- a/loleaflet/main.js
+++ b/loleaflet/main.js
@@ -127,6 +127,7 @@ map.addControl(L.control.columnHeader());
 map.addControl(L.control.rowHeader());
 map.addControl(L.control.contextMenu());
 map.addControl(L.control.menubar());
+map.addControl(L.control.infobar());
 map.loadDocument();
 
 window.addEventListener('beforeunload', function () {
diff --git a/loleaflet/src/control/Control.Infobar.js b/loleaflet/src/control/Control.Infobar.js
new file mode 100644
index 000000000..de70ff2f2
--- /dev/null
+++ b/loleaflet/src/control/Control.Infobar.js
@@ -0,0 +1,42 @@
+/*
+ * L.Control.Infobar used for displaying non-annoying info messages
+ */
+
+/* global vex $ */
+L.Control.Infobar = L.Control.extend({
+	onAdd: function (map) {
+		map.on('infobar', this._onInfobar, this);
+	},
+
+	_onInfobar: function(e) {
+		if (!e.msg)
+			return;
+
+		var buttons = [];
+		var callback = function() {};
+		if (e.actionLabel && e.action) {
+			buttons.push($.extend({}, vex.dialog.buttons.YES, { text: e.actionLabel }));
+			callback = function (value) {
+				if (value === false) // close btn clicked
+					return;
+
+				if (e.action.startsWith('http')) { // We have a link
+					var win = window.open(e.action, '_blank');
+					win.focus();
+				}
+			}
+		}
+
+		vex.dialog.open({
+			message: e.msg,
+			className: 'vex-theme-bottom-right-corner',
+			showCloseButton: true,
+			buttons: buttons,
+			callback: callback
+		});
+	}
+});
+
+L.control.infobar = function (options) {
+	return new L.Control.Infobar(options);
+};
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 5fcb8a06c..49507a16a 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -571,9 +571,12 @@ L.Socket = L.Class.extend({
 						brandProductName : 'LibreOffice Online'));
 				brandProductFAQURL = (typeof brandProductFAQURL !== 'undefined') ?
 						brandProductFAQURL : 'https://hub.libreoffice.org/professional-online-support';
-				textMsg = textMsg.replace(/{a}/g, '<a target="_blank" href="'+brandProductFAQURL+'">');
-				textMsg = textMsg.replace(/{\/a}/g, '</a>');
-				this._map.fire('error', {msg: textMsg});
+				this._map.fire('infobar',
+					{
+						msg: textMsg,
+						action: brandProductFAQURL,
+						actionLabel: errorMessages.infoandsupport
+					});
 			}
 		}
 		else if (textMsg.startsWith('pong ') && this._map._docLayer && this._map._docLayer._debug) {
commit 2d49ca2660449ad764f8e64e1c7c67a21167abd6
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Tue Feb 13 16:36:38 2018 +0100

    Only apply hard limit when configured with support key
    
    In other case, show the warning to all users (instead of just the last one)
    and link to our get professional help page.
    
    Change-Id: Id443ba6427acd4c05f7e0e2ce86025acfb553265
    Reviewed-on: https://gerrit.libreoffice.org/49673
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit 96292dc873ea2b021b22c755f02293184d818714)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/dist/errormessages.js b/loleaflet/dist/errormessages.js
index fa6a99979..edda0764e 100644
--- a/loleaflet/dist/errormessages.js
+++ b/loleaflet/dist/errormessages.js
@@ -1,6 +1,6 @@
 exports.diskfull = _('No disk space left on server, please contact the server administrator to continue.');
 exports.emptyhosturl = _('The host URL is empty. The loolwsd server is probably misconfigured, please contact the administrator.');
-exports.limitreached = _('This development build is limited to %0 documents, and %1 connections - to avoid the impression that it is suitable for deployment in large enterprises. To find out more about deploying and scaling %2 check out: <br/><a href=\"%3\">%3</a>.');
+exports.limitreached = _('This is an unsupported version of {productname}. To avoid the impression that it is suitable for deployment in enterprises, this version is limited to {docs} documents, and {connections} connections.<br/>{a}More information and support{/a}');
 exports.limitreachedprod = _('This service is limited to %0 documents, and %1 connections total by the admin. This limit has been reached. Please try again later.');
 exports.serviceunavailable = _('Service is unavailable. Please try again later and report to your administrator if the issue persists.');
 exports.unauthorized = _('Unauthorized WOPI host. Please try again later and report to your administrator if the issue persists.');
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 4b609f288..5fcb8a06c 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -7,6 +7,7 @@
 L.Socket = L.Class.extend({
 	ProtocolVersionNumber: '0.1',
 	ReconnectCount: 0,
+	WasShownLimitDialog: false,
 
 	getParameterValue: function (s) {
 		var i = s.indexOf('=');
@@ -547,31 +548,34 @@ L.Socket = L.Class.extend({
 		}
 		else if (textMsg.startsWith('error:') && !this._map._docLayer) {
 			textMsg = textMsg.substring(6);
-			if (command.errorKind === 'limitreached') {
-				this._map._fatal = true;
-				this._map._active = false; // Practically disconnected.
+			if (command.errorKind === 'hardlimitreached') {
 
-				// Servers configured for 50 documents are not demo/development.
-				if (parseInt(command.params[0]) >= 50) {
-					textMsg = errorMessages.limitreachedprod;
-					textMsg = textMsg.replace(/%0/g, command.params[0]);
-					textMsg = textMsg.replace(/%1/g, command.params[1]);
-				}
-				else {
-					textMsg = errorMessages.limitreached;
-					textMsg = textMsg.replace(/%0/g, command.params[0]);
-					textMsg = textMsg.replace(/%1/g, command.params[1]);
-					textMsg = textMsg.replace(/%2/g, (typeof brandProductName !== 'undefined' ? brandProductName : 'LibreOffice Online'));
-					textMsg = textMsg.replace(/%3/g, (typeof brandProductFAQURL !== 'undefined' ? brandProductFAQURL : 'https://wiki.documentfoundation.org/Development/LibreOffice_Online'));
-				}
+				textMsg = errorMessages.limitreachedprod;
+				textMsg = textMsg.replace(/%0/g, command.params[0]);
+				textMsg = textMsg.replace(/%1/g, command.params[1]);
 			}
 			else if (command.errorKind === 'serviceunavailable') {
-				this._map._fatal = true;
-				this._map._active = false; // Practically disconnected.
 				textMsg = errorMessages.serviceunavailable;
 			}
+			this._map._fatal = true;
+			this._map._active = false; // Practically disconnected.
 			this._map.fire('error', {msg: textMsg});
 		}
+		else if (textMsg.startsWith('info:') && command.errorCmd === 'socket') {
+			if (command.errorKind === 'limitreached' && !this.WasShownLimitDialog) {
+				this.WasShownLimitDialog = true;
+				textMsg = errorMessages.limitreached;
+				textMsg = textMsg.replace(/{docs}/g, command.params[0]);
+				textMsg = textMsg.replace(/{connections}/g, command.params[1]);
+				textMsg = textMsg.replace(/{productname}/g, (typeof brandProductName !== 'undefined' ?
+						brandProductName : 'LibreOffice Online'));
+				brandProductFAQURL = (typeof brandProductFAQURL !== 'undefined') ?
+						brandProductFAQURL : 'https://hub.libreoffice.org/professional-online-support';
+				textMsg = textMsg.replace(/{a}/g, '<a target="_blank" href="'+brandProductFAQURL+'">');
+				textMsg = textMsg.replace(/{\/a}/g, '</a>');
+				this._map.fire('error', {msg: textMsg});
+			}
+		}
 		else if (textMsg.startsWith('pong ') && this._map._docLayer && this._map._docLayer._debug) {
 			var times = this._map._docLayer._debugTimePING;
 			var timeText = this._map._docLayer._debugSetTimes(times, +new Date() - this._map._docLayer._debugPINGQueue.shift());
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 3425774a1..1b9f78548 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -200,7 +200,7 @@ namespace
 inline void shutdownLimitReached(WebSocketHandler& ws)
 {
     const std::string error = Poco::format(PAYLOAD_UNAVAILABLE_LIMIT_REACHED, LOOLWSD::MaxDocuments, LOOLWSD::MaxConnections);
-    LOG_INF("Sending client limit-reached message: " << error);
+    LOG_INF("Sending client 'hardlimitreached' message: " << error);
 
     try
     {
@@ -216,6 +216,22 @@ inline void shutdownLimitReached(WebSocketHandler& ws)
     }
 }
 
+inline void infoLimitReached()
+{
+    const std::string info = Poco::format(PAYLOAD_INFO_LIMIT_REACHED, LOOLWSD::MaxDocuments, LOOLWSD::MaxConnections);
+    LOG_INF("Sending client 'limitreached' message: " << info);
+
+    try
+    {
+        Util::alertAllUsers(info);
+    }
+    catch (const std::exception& ex)
+    {
+        LOG_ERR("Error while shuting down socket on reaching limit: " << ex.what());
+    }
+}
+
+
 /// Internal implementation to alert all clients
 /// connected to any document.
 void alertAllUsersInternal(const std::string& msg)
@@ -1450,9 +1466,11 @@ static std::shared_ptr<DocumentBroker> findOrCreateDocBroker(WebSocketHandler& w
 
         if (DocBrokers.size() + 1 > LOOLWSD::MaxDocuments)
         {
-            LOG_ERR("Maximum number of open documents of " << LOOLWSD::MaxDocuments << " reached.");
+            LOG_INF("Maximum number of open documents of " << LOOLWSD::MaxDocuments << " reached.");
+#if ENABLE_SUPPORT_KEY
             shutdownLimitReached(ws);
             return nullptr;
+#endif
         }
 
         // Set the one we just created.
@@ -1482,6 +1500,13 @@ static std::shared_ptr<ClientSession> createNewClientSession(const WebSocketHand
             // Alert all other existing sessions also
             Util::alertAllUsers(diskfullMsg);
         }
+#if !ENABLE_SUPPORT_KEY
+        // Users of development versions get just an info when reaching max documents or connections
+        if (DocBrokers.size() + 1 > LOOLWSD::MaxDocuments || LOOLWSD::NumConnections >= LOOLWSD::MaxConnections)
+        {
+            infoLimitReached();
+        }
+#endif
 
         // Now we have a DocumentBroker and we're ready to process client commands.
         if (ws)
@@ -2253,9 +2278,11 @@ private:
         {
             if (LOOLWSD::NumConnections >= LOOLWSD::MaxConnections)
             {
-                LOG_ERR("Limit on maximum number of connections of " << LOOLWSD::MaxConnections << " reached.");
+                LOG_INF("Limit on maximum number of connections of " << LOOLWSD::MaxConnections << " reached.");
+#if ENABLE_SUPPORT_KEY
                 shutdownLimitReached(ws);
                 return;
+#endif
             }
 
             LOG_INF("Starting GET request handler for session [" << _id << "] on url [" << url << "].");
diff --git a/wsd/UserMessages.hpp b/wsd/UserMessages.hpp
index 9dad0d368..00ad7875b 100644
--- a/wsd/UserMessages.hpp
+++ b/wsd/UserMessages.hpp
@@ -12,8 +12,9 @@
 #ifndef INCLUDED_USERMESSAGES_HPP
 #define INCLUDED_USERMESSAGES_HPP
 
-constexpr auto SERVICE_UNAVAILABLE_INTERNAL_ERROR = "error: cmd=socket kind=serviceunavailable";
-constexpr auto PAYLOAD_UNAVAILABLE_LIMIT_REACHED = "error: cmd=socket kind=limitreached params=%u,%u";
+constexpr const char* SERVICE_UNAVAILABLE_INTERNAL_ERROR = "error: cmd=socket kind=serviceunavailable";
+constexpr const char* PAYLOAD_UNAVAILABLE_LIMIT_REACHED = "error: cmd=socket kind=hardlimitreached params=%u,%u";
+constexpr const char* PAYLOAD_INFO_LIMIT_REACHED = "info: cmd=socket kind=limitreached params=%u,%u";
 
 #endif
 


More information about the Libreoffice-commits mailing list