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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed Mar 30 01:57:39 UTC 2016


 loolwsd/MasterProcessSession.cpp |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

New commits:
commit c966a804f8ba12401cb85681f0a4099c15391954
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon Mar 28 09:08:33 2016 -0400

    loolwsd: throw when we fail to connect to lokit
    
    Change-Id: I52f5c923cfc8fa4c28309066d8457418154e6b20
    Reviewed-on: https://gerrit.libreoffice.org/23643
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 3be97d5..f274a0e 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -103,6 +103,7 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
 {
     const std::string firstLine = getFirstLine(buffer, length);
     StringTokenizer tokens(firstLine, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
+    Log::trace(getName() + ": handling [" + firstLine + "].");
 
     if (tokens[0] == "loolclient")
     {
@@ -378,10 +379,15 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
         // a child process.
 
         if (_peer.expired())
+        {
+            Log::trace("Dispatching child to handle [" + tokens[0] + "].");
             dispatchChild();
+        }
 
         if (tokens[0] == "setclientpart")
+        {
             _docBroker->tileCache().removeFile("status.txt");
+        }
 
         if (tokens[0] != "requestloksession")
         {
@@ -757,22 +763,17 @@ void MasterProcessSession::dispatchChild()
         }
     }
 
-    if (isFound)
-    {
-        Log::debug("Waiting child session permission, done!");
-        childSession = AvailableChildSessions[getId()];
-        AvailableChildSessions.erase(getId());
-    }
-
-    lock.unlock();
-
-    if (retries < 0 && !isFound)
+    if (!isFound)
     {
         Log::error(getName() + ": Failed to connect to child. Shutting down socket.");
         IoUtil::shutdownWebSocket(_ws);
-        return;
+        throw std::runtime_error("Failed to connect to child.");
     }
 
+    Log::debug("Waiting child session permission, done!");
+    childSession = AvailableChildSessions[getId()];
+    AvailableChildSessions.erase(getId());
+
     _peer = childSession;
     childSession->_peer = shared_from_this();
     childSession->_docBroker = _docBroker;


More information about the Libreoffice-commits mailing list