[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Thu Sep 1 12:38:13 UTC 2016
loolwsd/LOOLKit.cpp | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
New commits:
commit f4c0a87991cb574ea86ea75d259cdc7c9a1a0eb9
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Thu Sep 1 08:31:40 2016 -0400
Revert "loolwsd: remove queue thread from child socket handler"
This reverts commit a30526c87ea01026f6ff3f07671ddfc614aebc5e.
Change-Id: Idcbf2a6c4e228a5fb6a890e8cdd58b6137295666
Reviewed-on: https://gerrit.libreoffice.org/28596
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index d3c98b7..84a02f2 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -55,6 +55,7 @@
#include "LibreOfficeKit.hpp"
#include "Log.hpp"
#include "Png.hpp"
+#include "QueueHandler.hpp"
#include "Rectangle.hpp"
#include "TileDesc.hpp"
#include "Unit.hpp"
@@ -291,21 +292,27 @@ public:
try
{
+ auto queue = std::make_shared<TileQueue>();
+ QueueHandler handler(queue, _session, "kit_queue_" + _session->getId());
+
+ Thread queueHandlerThread;
+ queueHandlerThread.start(handler);
+ std::shared_ptr<ChildSession> session = _session;
+
IoUtil::SocketProcessor(_ws,
- [this](const std::vector<char>& payload)
+ [&queue](const std::vector<char>& payload)
{
- if (!_session->handleInput(payload.data(), payload.size()))
- {
- Log::info("Socket handler flagged for finishing.");
- return false;
- }
-
+ queue->put(payload);
return true;
},
- [this]() { _session->closeFrame(); },
- []() { return !!TerminationFlag; });
+ [&session]() { session->closeFrame(); },
+ [&queueHandlerThread]() { return TerminationFlag || !queueHandlerThread.isRunning(); });
+
+ queue->clear();
+ queue->put("eof");
+ queueHandlerThread.join();
- if (_session->isCloseFrame())
+ if (session->isCloseFrame())
{
Log::trace("Normal close handshake.");
_ws->shutdown();
@@ -1410,7 +1417,6 @@ void lokit_main(const std::string& childRoot,
requestUrl += "&version=" + encodedVersionStr;
free(versionInfo);
}
-
HTTPRequest request(HTTPRequest::HTTP_GET, requestUrl);
HTTPResponse response;
auto ws = std::make_shared<WebSocket>(cs, request, response);
More information about the Libreoffice-commits
mailing list