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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sat May 21 03:40:19 UTC 2016


 loolwsd/PrisonerSession.cpp |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 80786cc79d4197fef6e58b2f8a0d5096b74196d6
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri May 20 20:05:44 2016 -0400

    loolwsd: propagate error from forwardToPeer
    
    Change-Id: Icea02f3ca48f9f4eb8aed14181c7b6101bfa1c2e
    Reviewed-on: https://gerrit.libreoffice.org/25242
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/PrisonerSession.cpp b/loolwsd/PrisonerSession.cpp
index bca2b73..aae0213 100644
--- a/loolwsd/PrisonerSession.cpp
+++ b/loolwsd/PrisonerSession.cpp
@@ -157,7 +157,7 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
         }
     }
 
-    if (peer && !_isDocPasswordProtected)
+    if (!_isDocPasswordProtected)
     {
         if (tokens[0] == "tile:")
         {
@@ -175,8 +175,7 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
             std::string message = "editlock: ";
             message += std::to_string(peer->isEditLocked());
             Log::debug("Forwarding [" + message + "] in response to status.");
-            forwardToPeer(_peer, message.c_str(), message.size());
-            return true;
+            return forwardToPeer(_peer, message.c_str(), message.size());
         }
         else if (tokens[0] == "commandvalues:")
         {
@@ -200,7 +199,9 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
         else if (tokens[0] == "partpagerectangles:")
         {
             if (tokens.count() > 1 && !tokens[1].empty())
+            {
                 _docBroker->tileCache().saveTextFile(std::string(buffer, length), "partpagerectangles.txt");
+            }
         }
         else if (tokens[0] == "invalidatetiles:")
         {
@@ -212,13 +213,17 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
             std::string font;
             if (tokens.count() < 2 ||
                 !getTokenString(tokens[1], "font", font))
-                assert(false);
+            {
+                Log::error("Bad syntax for: " + firstLine);
+                return false;
+            }
 
             assert(firstLine.size() < static_cast<std::string::size_type>(length));
             _docBroker->tileCache().saveRendering(font, "font", buffer + firstLine.size() + 1, length - firstLine.size() - 1);
         }
     }
 
+    // Forward everything else.
     forwardToPeer(_peer, buffer, length);
     return true;
 }


More information about the Libreoffice-commits mailing list