[Libreoffice-commits] online.git: loolwsd/Admin.cpp loolwsd/Admin.hpp loolwsd/LOOLBroker.cpp
Pranav Kant
pranavk at collabora.com
Tue Mar 8 09:33:30 UTC 2016
loolwsd/Admin.cpp | 13 +++++++++++++
loolwsd/Admin.hpp | 2 ++
loolwsd/LOOLBroker.cpp | 5 +++++
3 files changed, 20 insertions(+)
New commits:
commit e366aa8e0b947c7707a53b654a7db2e44b0446ad
Author: Pranav Kant <pranavk at collabora.com>
Date: Sat Mar 5 02:38:37 2016 +0530
loolwsd: Support for killing children
Change-Id: Iab62a7e0dab7732f552a1b5f9eb5f67a5b96d74a
Reviewed-on: https://gerrit.libreoffice.org/22991
Reviewed-by: Tor Lillqvist <tml at collabora.com>
Tested-by: Tor Lillqvist <tml at collabora.com>
diff --git a/loolwsd/Admin.cpp b/loolwsd/Admin.cpp
index 5097d4f..c8bcdd6 100644
--- a/loolwsd/Admin.cpp
+++ b/loolwsd/Admin.cpp
@@ -146,6 +146,19 @@ public:
std::string responseString = "documents " + model.query("documents");
ws->sendFrame(responseString.data(), responseString.size());
}
+ else if (tokens[0] == "kill" && tokens.count() == 2)
+ {
+ try
+ {
+ if (std::stoi(tokens[1]))
+ {
+ Util::writeFIFO(_admin->getBrokerPipe(), firstLine + " \r\n");
+ }
+ }
+ catch(std::exception& e) {
+ Log::warn() << "Could not kill given PID" << Log::end;
+ }
+ }
}
}
}
diff --git a/loolwsd/Admin.hpp b/loolwsd/Admin.hpp
index 1f1146e..839544e 100644
--- a/loolwsd/Admin.hpp
+++ b/loolwsd/Admin.hpp
@@ -28,6 +28,8 @@ public:
static int getBrokerPid() { return Admin::BrokerPipe; }
+ static int getBrokerPipe() { return Admin::BrokerPipe; }
+
void run() override;
AdminModel& getModel();
diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index 29c6d46..fa5ef56 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -346,6 +346,11 @@ public:
++forkCounter;
}
}
+ else if (tokens[0] == "kill" && tokens.count() == 2)
+ {
+ Process::PID nPid = static_cast<Process::PID>(std::stoi(tokens[1]));
+ removeChild(nPid);
+ }
}
void run() override
More information about the Libreoffice-commits
mailing list