[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri May 3 13:30:00 UTC 2019


 wsd/DocumentBroker.cpp |   16 ++++++++++++++++
 wsd/DocumentBroker.hpp |    8 ++++----
 wsd/LOOLWSD.cpp        |    5 +++--
 3 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit d54e9f969c2558066bea130d6b30d22744a60604
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Mar 12 15:41:54 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 15:29:42 2019 +0200

    Don't count convert-to connections vs. the document count.
    
    Change-Id: I350905fb98c503ae8f22a377e4af5cbcb9f3c52d
    Reviewed-on: https://gerrit.libreoffice.org/71724
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 08d4d3b11..139f13fc2 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1890,8 +1890,24 @@ void DocumentBroker::getIOStats(uint64_t &sent, uint64_t &recv)
     }
 }
 
+static std::atomic<size_t> NumConverters;
+
+size_t ConvertToBroker::getInstanceCount()
+{
+    return NumConverters;
+}
+
+ConvertToBroker::ConvertToBroker(const std::string& uri,
+                                 const Poco::URI& uriPublic,
+                                 const std::string& docKey)
+    : DocumentBroker(uri, uriPublic, docKey)
+{
+    NumConverters++;
+}
+
 ConvertToBroker::~ConvertToBroker()
 {
+    NumConverters--;
     if (!_uriOrig.empty())
     {
         // Remove source file and directory
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 6d5a3e63b..2090b7ec2 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -479,11 +479,11 @@ public:
     /// Construct DocumentBroker with URI and docKey
     ConvertToBroker(const std::string& uri,
                     const Poco::URI& uriPublic,
-                    const std::string& docKey)
-        : DocumentBroker(uri, uriPublic, docKey)
-    {
-    }
+                    const std::string& docKey);
     virtual ~ConvertToBroker();
+
+    /// How many live conversions are running.
+    static size_t getInstanceCount();
 };
 
 #endif
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 70ce28da7..3486723a8 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -256,8 +256,8 @@ inline void shutdownLimitReached(WebSocketHandler& ws)
 inline void checkSessionLimitsAndWarnClients()
 {
 #ifndef MOBILEAPP
-
-    if (DocBrokers.size() > LOOLWSD::MaxDocuments || LOOLWSD::NumConnections >= LOOLWSD::MaxConnections)
+    size_t docBrokerCount = DocBrokers.size() - ConvertToBroker::getInstanceCount();
+    if (docBrokerCount > LOOLWSD::MaxDocuments || LOOLWSD::NumConnections >= LOOLWSD::MaxConnections)
     {
         const std::string info = Poco::format(PAYLOAD_INFO_LIMIT_REACHED, LOOLWSD::MaxDocuments, LOOLWSD::MaxConnections);
         LOG_INF("Sending client 'limitreached' message: " << info);
@@ -2959,6 +2959,7 @@ public:
                   << "[ " << DocBrokers.size() << " ]:\n";
         for (auto &i : DocBrokers)
             i.second->dumpState(os);
+        os << "Converter count: " << ConvertToBroker::getInstanceCount() << "\n";
 
         Socket::InhibitThreadChecks = false;
         SocketPoll::InhibitThreadChecks = false;


More information about the Libreoffice-commits mailing list