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

Pranav Kant pranavk at collabora.co.uk
Mon Aug 21 14:36:40 UTC 2017


 wsd/Admin.cpp   |    8 ++++++--
 wsd/Admin.hpp   |    5 +++--
 wsd/LOOLWSD.cpp |    2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit a9522f38aa1e71d130e0185a9efb0fe917628e81
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Aug 21 20:01:42 2017 +0530

    wsd: Notify forkit conditionally about rlimits
    
    No need to notify the forkit very early when loolwsd is initializing and
    forkit pipes are not set. Forkit is notified of rlimits anyway
    explicitly in the URL when it is initialized; no need to try to
    initialize it again.
    
    Change-Id: I9fde13e42f6e6393da7cf245ed979538d715319a

diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index b4377d8d..343c841e 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -253,7 +253,7 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
                     LOG_ERR("Unknown limit: " << settingName);
 
                 model.notify("settings " + settingName + '=' + std::to_string(settingVal));
-                _admin->setDefDocProcSettings(docProcSettings);
+                _admin->setDefDocProcSettings(docProcSettings, true);
             }
         }
     }
diff --git a/wsd/Admin.hpp b/wsd/Admin.hpp
index 54b9a8e7..16dc3363 100644
--- a/wsd/Admin.hpp
+++ b/wsd/Admin.hpp
@@ -108,10 +108,11 @@ public:
     void dumpState(std::ostream& os) override;
 
     const DocProcSettings& getDefDocProcSettings() const { return _defDocProcSettings; }
-    void setDefDocProcSettings(const DocProcSettings& docProcSettings)
+    void setDefDocProcSettings(const DocProcSettings& docProcSettings, bool notifyKit)
     {
         _defDocProcSettings = docProcSettings;
-        notifyForkit();
+        if (notifyKit)
+            notifyForkit();
     }
 
 private:
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 720fc709..37e56dd2 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -819,7 +819,7 @@ void LOOLWSD::initialize(Application& self)
     docProcSettings.LimitVirtMemMb = getConfigValue<int>("per_document.limit_virt_mem_mb", 0);
     docProcSettings.LimitStackMemKb = getConfigValue<int>("per_document.limit_stack_mem_kb", 0);
     docProcSettings.LimitFileSizeMb = getConfigValue<int>("per_document.limit_file_size_mb", 0);
-    Admin::instance().setDefDocProcSettings(docProcSettings);
+    Admin::instance().setDefDocProcSettings(docProcSettings, false);
 
 #if ENABLE_DEBUG
     std::cerr << "\nLaunch this in your browser:\n\n"
commit b0ad8874dcb98b45bb6d30ef2ce6c98e98c1aecf
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Aug 21 19:56:19 2017 +0530

    wsd: don't write until forkit write pipe is ready
    
    Change-Id: I95439e8e77dc308d993b07ccbd273228f755ce14

diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index 5102ff33..b4377d8d 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -529,7 +529,11 @@ void Admin::notifyForkit()
     oss << "setconfig limit_virt_mem_mb " << _defDocProcSettings.LimitVirtMemMb << '\n'
         << "setconfig limit_stack_mem_kb " << _defDocProcSettings.LimitStackMemKb << '\n'
         << "setconfig limit_file_size_mb " << _defDocProcSettings.LimitFileSizeMb << '\n';
-    IoUtil::writeToPipe(_forKitWritePipe, oss.str());
+
+    if (_forKitWritePipe != -1)
+        IoUtil::writeToPipe(_forKitWritePipe, oss.str());
+    else
+        LOG_INF("Forkit write pipe not set (yet).");
 }
 
 void Admin::triggerMemoryCleanup(size_t totalMem)


More information about the Libreoffice-commits mailing list