[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Mar 13 04:09:34 UTC 2017


 wsd/DocumentBroker.cpp |    5 -----
 wsd/DocumentBroker.hpp |    8 ++++----
 wsd/LOOLWSD.cpp        |    6 +-----
 3 files changed, 5 insertions(+), 14 deletions(-)

New commits:
commit 388d7b1dbf1a5c2d155c0149247b3a319114f8b0
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Mar 12 14:12:36 2017 -0400

    wsd: TerminatingPoll always starts its own thread
    
    Since all TerminatingPoll instances need to fire
    a thread, no reason to do it manually and risk
    races. Now TerminatingPoll does it in the ctor.
    
    Change-Id: I59850ad48b3789f3a23d01abb05a7f28e5717031
    Reviewed-on: https://gerrit.libreoffice.org/35114
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 1b47d68..fa8ba94 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -163,11 +163,6 @@ DocumentBroker::DocumentBroker(const std::string& uri,
     _stop = false;
 }
 
-void DocumentBroker::startThread()
-{
-    _poll->startThread();
-}
-
 // The inner heart of the DocumentBroker - our poll loop.
 void DocumentBroker::pollThread()
 {
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 2d30802..2a9c152 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -44,7 +44,10 @@ class TerminatingPoll : public SocketPoll
 {
 public:
     TerminatingPoll(const std::string &threadName) :
-        SocketPoll(threadName) {}
+        SocketPoll(threadName)
+    {
+        startThread();
+    }
 
     bool continuePolling() override
     {
@@ -220,9 +223,6 @@ public:
 
     ~DocumentBroker();
 
-    /// Start processing events
-    void startThread();
-
     /// Loads a document from the public URI into the jail.
     bool load(std::shared_ptr<ClientSession>& session, const std::string& jailId);
     bool isLoaded() const { return _isLoaded; }
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index a459bf4..98250b4 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2167,7 +2167,6 @@ private:
 
     void handleClientWsUpgrade(const Poco::Net::HTTPRequest& request, const std::string& url)
     {
-        // requestHandler = new ClientRequestHandler();
         LOG_INF("Client WS request" << request.getURI() << ", url: " << url);
 
         // First Upgrade.
@@ -2221,9 +2220,9 @@ private:
                     _clientSession->onConnect(socket);
                     docBroker->addSocketToPoll(socket);
                 }
-                docBroker->startThread();
             }
         }
+
         if (!docBroker || !_clientSession)
             LOG_WRN("Failed to connect DocBroker and Client Session.");
     }
@@ -2349,14 +2348,11 @@ public:
     void startPrisoners(const int port)
     {
         PrisonerPoll.insertNewSocket(findPrisonerServerPort(port));
-        PrisonerPoll.startThread();
     }
 
     void start(const int port)
     {
         _acceptPoll.insertNewSocket(findServerPort(port));
-        _acceptPoll.startThread();
-        WebServerPoll.startThread();
     }
 
     void stop()


More information about the Libreoffice-commits mailing list