loolwsd/DocumentBroker.hpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
New commits: commit 35fcaa1592b5a78bd46f326271a27b1710c0731b Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Fri Oct 14 08:37:43 2016 -0400 loolwsd: don't join unjoinable thread and contain exceptions Change-Id: I309153c3c05a152e4ef3bbbbd5a0948bcc589c9c Reviewed-on: https://gerrit.libreoffice.org/29939 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp index 6891507..00d27e2 100644 --- a/loolwsd/DocumentBroker.hpp +++ b/loolwsd/DocumentBroker.hpp @@ -70,19 +70,30 @@ public: void close(const bool rude) { - _stop = true; - IoUtil::shutdownWebSocket(_ws); - _thread.join(); - _ws.reset(); - if (_pid != -1) + try { - Log::info("Closing child [" + std::to_string(_pid) + "]."); - if (rude && kill(_pid, SIGINT) != 0 && kill(_pid, 0) != 0) + _stop = true; + IoUtil::shutdownWebSocket(_ws); + if (_thread.joinable()) { - Log::syserror("Cannot terminate lokit [" + std::to_string(_pid) + "]. Abandoning."); + _thread.join(); } - _pid = -1; + _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."); + } + + _pid = -1; + } + } + catch (const std::exception& ex) + { + Log::error("Eror while closing child process: " + std::string(ex.what())); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits