loolwsd/LOOLBroker.cpp | 15 ++++++++++----- loolwsd/LOOLWSD.cpp | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-)
New commits: commit 33a7f6adbb204208f64d95b38a28055773b1db59 Author: Henry Castro <hcas...@collabora.com> Date: Tue Dec 29 20:59:17 2015 -0400 loolwsd: close pipes diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 34343cb..7cdbf26 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -418,12 +418,10 @@ public: #endif Log::debug("Thread [" + thread_name + "] started."); - while (true) + while (!TerminationFlag) { if ( pStart == pEnd ) { - (void)poll(&aPoll,1,-1); - if (poll(&aPoll, 1, -1) < 0) { Log::error("Failed to poll pipe [" + FIFO_FILE + "]."); @@ -558,6 +556,8 @@ static int createLibreOfficeKit(const bool sharePages, const std::string& loSubP if ( (nFIFOWriter = open(pipe.c_str(), O_WRONLY)) < 0 ) { + // TODO. ill process state, that state should force close prison websockets and + // kill, currently we have only "stop server state". Log::error("Error: failed to open pipe [" + pipe + "] write only. Abandoning child."); Poco::Process::requestTermination(child); return -1; @@ -808,8 +808,7 @@ int main(int argc, char** argv) aPipe.start(pipeHandler); - Log::info("loolbroker ready!"); - + Log::info("loolbroker is ready."); unsigned timeoutCounter = 0; while (!TerminationFlag && !_childProcesses.empty()) @@ -823,6 +822,7 @@ int main(int argc, char** argv) if ((WIFEXITED(status) || WIFSIGNALED(status) || WTERMSIG(status) ) ) { Log::error("Child [" + std::to_string(pid) + "] processes died."); + forkMutex.lock(); _childProcesses.erase(pid); _cacheURL.clear(); @@ -873,8 +873,13 @@ int main(int argc, char** argv) { Log::info("Requesting child process " + std::to_string(i.first) + " to terminate."); Process::requestTermination(i.first); + close(i.second); } + aPipe.join(); + close(readerChild); + close(readerBroker); + Log::info("Process [loolbroker] finished."); return 0; } diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index d8989f2..ce391ad 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -997,6 +997,8 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/) if (LOOLWSD::doTest) inputThread.join(); + close(BrokerWritePipe); + // stop the service, no more request srv.stop(); srv2.stop(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits