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

Pranav Kant pranavk at collabora.com
Fri Apr 15 09:55:34 UTC 2016


 loolwsd/Admin.cpp   |    9 +++++----
 loolwsd/LOOLWSD.cpp |    6 ------
 loolwsd/LOOLWSD.hpp |    3 ---
 3 files changed, 5 insertions(+), 13 deletions(-)

New commits:
commit cca858732a733cd7f43850b971e02ff7d462ae42
Author: Pranav Kant <pranavk at collabora.com>
Date:   Fri Apr 15 15:24:02 2016 +0530

    loolwsd: Allow admin console to kill documents (again)
    
    Change-Id: I30405854e9ebdc56ab3477758e9008963d4b8efa

diff --git a/loolwsd/Admin.cpp b/loolwsd/Admin.cpp
index 3feec33..d5d4557 100644
--- a/loolwsd/Admin.cpp
+++ b/loolwsd/Admin.cpp
@@ -186,14 +186,15 @@ void AdminRequestHandler::handleWSRequests(HTTPServerRequest& request, HTTPServe
                     {
                         try
                         {
-                            if (std::stoi(tokens[1]))
+                            const auto pid = std::stoi(tokens[1]);
+                            if (kill(pid, SIGINT) != 0 && kill(pid, 0) !=0)
                             {
-                                LOOLWSD::killKit(std::stoi(tokens[1]));
+                                Log::syserror("Cannot terminate PID: " + tokens[0]);
                             }
                         }
-                        catch(std::exception& e)
+                        catch(std::invalid_argument& exc)
                         {
-                            Log::warn() << "Could not kill given PID" << Log::end;
+                            Log::warn() << "Invalid PID to kill: " << tokens[0] << Log::end;
                         }
                     }
                     else if (tokens[0] == "mem_stats")
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 5d2ca8c..cbf3cce 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1301,12 +1301,6 @@ Process::PID LOOLWSD::createForKit()
     return child.id();
 }
 
-void LOOLWSD::killKit(const Process::PID /*pid*/)
-{
-    std::unique_lock<std::mutex> docBrokersLock(docBrokersMutex);
-    // TODO
-}
-
 int LOOLWSD::main(const std::vector<std::string>& /*args*/)
 {
     Log::initialize("wsd");
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 33c8c97..ae290e4 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -55,9 +55,6 @@ public:
         return Util::encodeId(++NextSessionId, 4);
     }
 
-    static
-    void killKit(const Poco::Process::PID pid);
-
 protected:
     void initialize(Poco::Util::Application& self) override;
     void uninitialize() override;


More information about the Libreoffice-commits mailing list