[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun Oct 16 22:13:02 UTC 2016
loolwsd/LOOLWSD.cpp | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
New commits:
commit d857b3dbbb48352d2a7bc315146742708e36cf76
Author: Ashod Nakashian <ashod.nakashian at 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 <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at 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)
More information about the Libreoffice-commits
mailing list