[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Tue Sep 20 03:31:50 UTC 2016


 loolwsd/LOOLKit.cpp |   28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

New commits:
commit a9fbfe8d8ac802086844e307dff979a8e1436ba2
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Sep 17 10:09:47 2016 -0400

    loolwsd: remove queue thread from child socket handler
    
    Change-Id: Ib6b4890db1f331b2e2cdcfafb57366ff62e3a13d
    Reviewed-on: https://gerrit.libreoffice.org/29067
    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 51c33f3..02919e6 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -57,7 +57,6 @@
 #include "LibreOfficeKit.hpp"
 #include "Log.hpp"
 #include "Png.hpp"
-#include "QueueHandler.hpp"
 #include "Rectangle.hpp"
 #include "TileDesc.hpp"
 #include "Unit.hpp"
@@ -320,27 +319,21 @@ public:
         Log::debug("Thread started.");
         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,
-                [&queue](const std::vector<char>& payload)
+                [this](const std::vector<char>& payload)
                 {
-                    queue->put(payload);
+                    if (!_session->handleInput(payload.data(), payload.size()))
+                    {
+                        Log::info("Socket handler flagged for finishing.");
+                        return false;
+                    }
+
                     return true;
                 },
-                [&session]() { session->closeFrame(); },
-                [&queueHandlerThread]() { return TerminationFlag || !queueHandlerThread.isRunning(); });
-
-            queue->clear();
-            queue->put("eof");
-            queueHandlerThread.join();
+                [this]() { _session->closeFrame(); },
+                []() { return !!TerminationFlag; });
 
-            if (session->isCloseFrame())
+            if (_session->isCloseFrame())
             {
                 Log::trace("Normal close handshake.");
                 _ws->shutdown();
@@ -1503,6 +1496,7 @@ 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