loolwsd/LOOLBroker.cpp | 2 +- loolwsd/LOOLWSD.cpp | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-)
New commits: commit 2104712b72c5cb1545acc3ea47d59e40341f0cbd Author: Ashod Nakashian <[email protected]> Date: Mon Jan 4 13:59:50 2016 -0500 loolwsd: exception handling in wsd queue handler Change-Id: I66f1990a20151c67346922273a98ecc5a91dc58f Reviewed-on: https://gerrit.libreoffice.org/21096 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 75a3395..2c4c819 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -656,7 +656,7 @@ int main(int argc, char** argv) } //TODO: Why not use our PID? - const std::string childId = Util::encodeId(Util::rng::getNext()); + const std::string childId = std::to_string(Util::rng::getNext()); const Path jailPath = Path::forDirectory(childRoot + Path::separator() + childId); Log::info("Jail path: " + jailPath.toString()); diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index e41ec2a..a9c7756 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -167,20 +167,33 @@ public: void run() override { - static const std::string thread_name = "wsd_queue_handler"; + static const std::string thread_name = "wsd_queue"; #ifdef __linux if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(thread_name.c_str()), 0, 0, 0) != 0) Log::error("Cannot set thread name to " + thread_name + "."); #endif Log::debug("Thread [" + thread_name + "] started."); - while (true) + try + { + while (true) + { + const std::string input = _queue.get(); + if (input == "eof") + break; + if (!_session->handleInput(input.c_str(), input.size())) + break; + } + } + catch (const std::exception& exc) + { + Log::error(std::string("Exception: ") + exc.what()); + raise(SIGABRT); + } + catch (...) { - const std::string input = _queue.get(); - if (input == "eof") - break; - if (!_session->handleInput(input.c_str(), input.size())) - break; + Log::error("Unexpected Exception."); + raise(SIGABRT); } Log::debug("Thread [" + thread_name + "] finished."); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
