[Libreoffice-commits] online.git: Branch 'feature/latency' - 2 commits - wsd/ClientSession.cpp

Tamás Zolnai tamas.zolnai at collabora.com
Sat Jun 16 14:29:01 UTC 2018


 wsd/ClientSession.cpp |   23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 47cc29467d641b38a7714e14c0024a4135b893f6
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Sat Jun 16 14:22:01 2018 +0200

    Need to extract the initial part id from status message
    
    Change-Id: Ia0651d93fedb71d3ca1e24d0356ac179e95e907e

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index d08595721..a9ad571bf 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -846,11 +846,21 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
             setViewLoaded();
             docBroker->setLoaded();
 
-            const std::string stringMsg(buffer, length);
-            const size_t index = stringMsg.find("type=") + 5;
-            if (index != std::string::npos)
+            for(auto &token : tokens)
             {
-                _docType = stringMsg.substr(index, stringMsg.find_first_of(' ', index) - index);
+                // Need to get the initial part id from status message
+                int part = -1;
+                if(getTokenInteger(token, "current", part))
+                {
+                    _clientSelectedPart = part;
+                }
+
+                // Get document type too
+                std::string docType;
+                if(getTokenString(token, "type", docType))
+                {
+                    _docType = docType;
+                }
             }
 
             // Forward the status response to the client.
commit 8be80befa0ca88ce7b512a229c953229dcf8dbb0
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Sat Jun 16 13:52:48 2018 +0200

    Avoid problems coming from uninitialized client part number
    
    Change-Id: If0508fba6a4ccd04c655428de23022b0df492f01

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 9a9762dcb..d08595721 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -44,7 +44,7 @@ ClientSession::ClientSession(const std::string& id,
     _isViewLoaded(false),
     _keyEvents(1),
     _clientVisibleArea(0, 0, 0, 0),
-    _clientSelectedPart(0),
+    _clientSelectedPart(-1),
     _tileWidthPixel(0),
     _tileHeightPixel(0),
     _tileWidthTwips(0),
@@ -1085,7 +1085,8 @@ void ClientSession::handleTileInvalidation(const std::string& message,
     // Skip requesting new tiles if we don't have client visible area data yet.
     if(!_clientVisibleArea.hasSurface() ||
        _tileWidthPixel == 0 || _tileHeightPixel == 0 ||
-       _tileWidthTwips == 0 || _tileHeightTwips == 0)
+       _tileWidthTwips == 0 || _tileHeightTwips == 0 ||
+       _clientSelectedPart == -1)
     {
         return;
     }


More information about the Libreoffice-commits mailing list