loolwsd/LOOLWSD.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
New commits: commit d857b3dbbb48352d2a7bc315146742708e36cf76 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sun Oct 16 12:46:46 2016 -0400 loolwsd: add the ClientSession to the Broker last This avoids early connection failures causing the session to linger in the Broker indefinetely. Change-Id: Ibe2b5b386ed1cd6e12e68735bff60b15957188cf Reviewed-on: https://gerrit.libreoffice.org/29952 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 59f90c5..e46f839 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -778,24 +778,21 @@ private: isReadOnly = param.second == "readonly"; } + auto session = std::make_shared<ClientSession>(id, ws, docBroker, uriPublic, isReadOnly); + // Above this point exceptions are safe and will auto-cleanup. // Below this, we need to cleanup internal references. - std::shared_ptr<ClientSession> session; - try - { - session = std::make_shared<ClientSession>(id, ws, docBroker, uriPublic, isReadOnly); - // Request the child to connect to us and add this session. - auto sessionsCount = docBroker->addSession(session); - Log::trace(docKey + ", ws_sessions++: " + std::to_string(sessionsCount)); + // Above this point exceptions are safe and will auto-cleanup. + // Below this, we need to cleanup internal references. + try + { // indicator to a client that is waiting to connect to lokit process status = "statusindicator: connect"; Log::trace("Sending to Client [" + status + "]."); ws->sendFrame(status.data(), (int) status.size()); - LOOLWSD::dumpEventTrace(docBroker->getJailId(), id, "NewSession: " + uri); - // Now the bridge beetween the client and kit process is connected status = "statusindicator: ready"; Log::trace("Sending to Client [" + status + "]."); @@ -812,6 +809,12 @@ private: ws->sendFrame(status.data(), (int) status.size()); } + // Request the child to connect to us and add this session. + auto sessionsCount = docBroker->addSession(session); + Log::trace(docKey + ", ws_sessions++: " + std::to_string(sessionsCount)); + + LOOLWSD::dumpEventTrace(docBroker->getJailId(), id, "NewSession: " + uri); + // Let messages flow. IoUtil::SocketProcessor(ws, [&session](const std::vector<char>& payload) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits