[Libreoffice-commits] online.git: 2 commits - wsd/LOOLWSD.cpp

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Fri Feb 23 08:17:21 UTC 2018


 wsd/LOOLWSD.cpp |   36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

New commits:
commit cabe0a750a13d39dc9a6781e24c0e06e0be5d412
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>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index c63059ea..5ea443ab 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1515,7 +1515,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 5176d9d4c03cee0a592446bc491b768e74bed361
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>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 24b5a4aa..c63059ea 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -212,7 +212,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);
@@ -220,6 +220,7 @@ inline void infoLimitReached()
     try
     {
         Util::alertAllUsers(info);
+        ws->sendMessage(info);
     }
     catch (const std::exception& ex)
     {
@@ -1496,28 +1497,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


More information about the Libreoffice-commits mailing list