[Libreoffice-commits] online.git: wsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Wed Apr 5 04:46:40 UTC 2017
wsd/LOOLWSD.cpp | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
New commits:
commit 38f955b5c54ada780afec69ed16e286989c1c17e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Wed Apr 5 00:25:15 2017 -0400
wsd: start DocBroker thread before adding callbacks
And move more into the callback to ensure
thread affinity.
Change-Id: I1d6985716d0d36aa488b65263ecb41f444f77255
Reviewed-on: https://gerrit.libreoffice.org/36115
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 367395cf..f2f6d0df 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1856,15 +1856,19 @@ private:
auto clientSession = createNewClientSession(nullptr, _id, uriPublic, docBroker, isReadOnly);
if (clientSession)
{
- clientSession->setSaveAsSocket(socket);
-
// Transfer the client socket to the DocumentBroker.
- // Move the socket into DocBroker.
- docBroker->addSocketToPoll(socket);
socketOwnership = SocketHandlerInterface::SocketOwnership::MOVED;
- docBroker->addCallback([&, clientSession]()
+ // Make sure the thread is running before adding callback.
+ docBroker->startThread();
+
+ docBroker->addCallback([docBroker, socket, clientSession, format]()
{
+ clientSession->setSaveAsSocket(socket);
+
+ // Move the socket into DocBroker.
+ docBroker->addSocketToPoll(socket);
+
// First add and load the session.
docBroker->addSession(clientSession);
@@ -1888,8 +1892,6 @@ private:
clientSession->handleMessage(true, WebSocketHandler::WSOpCode::Text, saveasRequest);
});
- docBroker->startThread();
-
sent = true;
}
else
@@ -2083,6 +2085,9 @@ private:
// Remove from current poll as we're moving ownership.
socketOwnership = SocketHandlerInterface::SocketOwnership::MOVED;
+ // Make sure the thread is running before adding callback.
+ docBroker->startThread();
+
docBroker->addCallback([docBroker, socket, clientSession]()
{
// Set the ClientSession to handle Socket events.
@@ -2095,8 +2100,6 @@ private:
// Add and load the session.
docBroker->addSession(clientSession);
});
-
- docBroker->startThread();
}
else
{
More information about the Libreoffice-commits
mailing list