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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Mar 14 03:15:01 UTC 2016


 loolwsd/LOOLKit.cpp              |    7 ++-----
 loolwsd/MasterProcessSession.cpp |   35 +++--------------------------------
 loolwsd/MasterProcessSession.hpp |    4 ----
 3 files changed, 5 insertions(+), 41 deletions(-)

New commits:
commit 29e9ba68c3fcf58c65a9272b8bb80369750fd0c4
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Mar 13 11:02:12 2016 -0400

    loolwsd: removed unnecessary childId, which is in the child URL
    
    Change-Id: Ibea2cd73657446ad4660400a0a9a38b376499df5
    Reviewed-on: https://gerrit.libreoffice.org/23222
    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 33aebe1..36ae9b4 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -399,8 +399,8 @@ public:
         }
 
         Log::info() << "Creating " << (_clientViews ? "new" : "first")
-                    << " view for url: " << _url << " for thread: " << sessionId
-                    << " on child: " << _jailId << Log::end;
+                    << " view for url: " << _url << " for sessionId: " << sessionId
+                    << " on jailId: " << _jailId << Log::end;
 
         // Open websocket connection between the child process and the
         // parent. The parent forwards us requests that it can't handle.
@@ -416,9 +416,6 @@ public:
         auto session = std::make_shared<ChildProcessSession>(sessionId, ws, _loKitDocument, _jailId,
                        [this](const std::string& id, const std::string& uri, const std::string& docPassword, bool isDocPasswordProvided) { return onLoad(id, uri, docPassword, isDocPasswordProvided); },
                        [this](const std::string& id) { onUnload(id); });
-        // child -> 0,  sessionId -> 1, PID -> 2
-        const std::string hello("child " + sessionId + " " + _jailId);
-        session->sendTextFrame(hello);
 
         auto thread = std::make_shared<Connection>(session, ws);
         const auto aInserted = _connections.emplace(intSessionId, thread);
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index d78a762..e1b7a6d 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -112,7 +112,7 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
         return true;
     }
 
-    if (haveSeparateProcess())
+    if (_kind == Kind::ToPrisoner)
     {
         // Note that this handles both forwarding requests from the client to the child process, and
         // forwarding replies from the child process to the client. Or does it?
@@ -120,7 +120,6 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
         // Snoop at some messages and manipulate tile cache information as needed
         auto peer = _peer.lock();
 
-        if (_kind == Kind::ToPrisoner)
         {
             if (!peer)
             {
@@ -205,7 +204,7 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
             }
         }
 
-        if (_kind == Kind::ToPrisoner && peer && peer->_tileCache && !_isDocPasswordProtected)
+        if (peer && peer->_tileCache && !_isDocPasswordProtected)
         {
             if (tokens[0] == "tile:")
             {
@@ -280,31 +279,7 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
         return true;
     }
 
-    if (tokens[0] == "child")
-    {
-        if (_kind != Kind::ToPrisoner)
-        {
-            sendTextFrame("error: cmd=child kind=invalid");
-            return false;
-        }
-        if (!_peer.expired())
-        {
-            sendTextFrame("error: cmd=child kind=invalid");
-            return false;
-        }
-        if (tokens.count() != 3)
-        {
-            sendTextFrame("error: cmd=child kind=syntax");
-            return false;
-        }
-
-        // child -> 0,  sessionId -> 1, PID -> 2
-        setId(tokens[1]);
-        _childId = tokens[2];
-
-        Log::info() << getName() << " Child jailId=" << _childId << ", sessionId=" << getId() << Log::end;
-    }
-    else if (_kind == Kind::ToPrisoner)
+    if (_kind == Kind::ToPrisoner)
     {
         // Message from child process to be forwarded to client.
 
@@ -420,10 +395,6 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
     return true;
 }
 
-bool MasterProcessSession::haveSeparateProcess()
-{
-    return !_childId.empty();
-}
 bool MasterProcessSession::invalidateTiles(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens)
 {
     int part, tilePosX, tilePosY, tileWidth, tileHeight;
diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp
index f2049fe..c1b6dd6 100644
--- a/loolwsd/MasterProcessSession.hpp
+++ b/loolwsd/MasterProcessSession.hpp
@@ -25,8 +25,6 @@ public:
                          std::shared_ptr<DocumentBroker> docBroker);
     virtual ~MasterProcessSession();
 
-    bool haveSeparateProcess();
-
     virtual bool getStatus(const char *buffer, int length) override;
 
     virtual bool getCommandValues(const char *buffer, int length, Poco::StringTokenizer& tokens) override;
@@ -83,8 +81,6 @@ private:
     virtual bool _handleInput(const char *buffer, int length) override;
 
 private:
-    // The pid of the child process
-    std::string _childId;
     int _curPart;
     int _loadPart;
     /// Kind::ToClient instances store URLs of completed 'save as' documents.


More information about the Libreoffice-commits mailing list