[Libreoffice-commits] online.git: loolwsd/DocumentBroker.hpp loolwsd/LOOLWSD.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Apr 17 16:13:36 UTC 2016


 loolwsd/DocumentBroker.hpp |    9 ++++++---
 loolwsd/LOOLWSD.cpp        |    6 ++++--
 2 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 8af52337a585dee81c552073ee8a42554a7980f8
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Apr 17 12:04:23 2016 -0400

    loolwsd: clean and quick shutdown
    
    Change-Id: Idfac3a27d19dd0a1b141d95a62c9e3453bd399a1
    Reviewed-on: https://gerrit.libreoffice.org/24166
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index df8287a..260a78d 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -70,16 +70,19 @@ public:
 
     ~ChildProcess()
     {
-        Log::info("~ChildProcess dtor [" + std::to_string(_pid) + "].");
-        close(false);
+        if (_pid > 0)
+        {
+            Log::info("~ChildProcess dtor [" + std::to_string(_pid) + "].");
+            close(false);
+        }
     }
 
     void close(const bool rude)
     {
-        Log::info("Closing child [" + std::to_string(_pid) + "].");
         _ws.reset();
         if (_pid != -1)
         {
+            Log::info("Closing child [" + std::to_string(_pid) + "].");
             if (rude && kill(_pid, SIGINT) != 0 && kill(_pid, 0) != 0)
             {
                 Log::syserror("Cannot terminate lokit [" + std::to_string(_pid) + "]. Abandoning.");
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 9c62d0c..42a0149 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1545,13 +1545,15 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
     threadPool.joinAll();
 
     // Terminate child processes
-    IoUtil::writeFIFO(ForKitWritePipe, "eof\n");
     Log::info("Requesting child process " + std::to_string(forKitPid) + " to terminate");
     Util::requestTermination(forKitPid);
+    for (auto& child : newChildren)
+    {
+        child->close(true);
+    }
 
     // Wait for forkit process finish
     waitpid(forKitPid, &status, WUNTRACED);
-
     close(ForKitWritePipe);
 
     Log::info("Cleaning up childroot directory [" + ChildRoot + "].");


More information about the Libreoffice-commits mailing list