[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - kit/Kit.cpp wsd/ClientSession.cpp wsd/DocumentBroker.cpp wsd/TileCache.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 1 10:34:25 UTC 2018


 kit/Kit.cpp            |    4 +---
 wsd/ClientSession.cpp  |    7 +++----
 wsd/DocumentBroker.cpp |   23 ++++++++++++++++-------
 wsd/TileCache.cpp      |   11 -----------
 4 files changed, 20 insertions(+), 25 deletions(-)

New commits:
commit 97a5856c5b94c826d0ef987b5b29204fd9d70af3
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Sep 26 22:15:30 2018 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Mon Oct 1 12:34:06 2018 +0200

    Fix tilesBeingRendered tracking by client
    
    I changed the code in this commit:
    c2a5f6acb0f1e93f19104b761661c852d930fb9e
    
    To make kit send a tilecombine message even if it does not
    send actual tile data so we can track that the rendering was
    done and so we can update the clients' _tilesBeingRendered
    list. The issue is that tileBeingRendered object
    belongs to not only one client, but more and so we don't
    know which client gets the actual empty tile response.
    
    So revert this method and rather use a smaller timeout for "waiting" the
    arrival of the rendered tile.
    
    (cherry picked from commit 07e99ad336c87f3d7e211abaaf18639be27c2929)
    
    Change-Id: I2dbbab1a62b81cbbb5314f2f37fdbc3415c69130
    Reviewed-on: https://gerrit.libreoffice.org/61125
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 6d8bae5f8..50ed15435 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1034,9 +1034,7 @@ public:
                 // The tile content is identical to what the client already has, so skip it
                 LOG_TRC("Match for tile #" << tileIndex << " at (" << positionX << "," <<
                         positionY << ") oldhash==hash (" << hash << "), wireId: " << wireId << " skipping");
-                tiles[tileIndex].setWireId(wireId);
-                tiles[tileIndex].setImgSize(0);
-                tileIndex++;
+                tiles.erase(tiles.begin() + tileIndex);
                 continue;
             }
 
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index ca43bc426..b097d5dd3 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -50,8 +50,7 @@ ClientSession::ClientSession(const std::string& id,
     _tileHeightPixel(0),
     _tileWidthTwips(0),
     _tileHeightTwips(0),
-    _isTextDocument(false),
-    _tilesBeingRendered(0)
+    _isTextDocument(false)
 {
     const size_t curConnections = ++LOOLWSD::NumConnections;
     LOG_INF("ClientSession ctor [" << getName() << "], current number of connections: " << curConnections);
@@ -1275,9 +1274,9 @@ void ClientSession::removeOutdatedTileSubscriptions()
     while(iterator != _tilesBeingRendered.end())
     {
         double elapsedTime = docBroker->tileCache().getTileBeingRenderedElapsedTimeMs(*iterator);
-        if(elapsedTime < 0.0 && elapsedTime > 5000.0)
+        if(elapsedTime < 0.0 && elapsedTime > 200.0)
         {
-            LOG_WRN("Tracked TileBeingRendered was dropped because of time out.");
+            LOG_INF("Tracked TileBeingRendered was dropped because of time out.");
             _tilesBeingRendered.erase(iterator);
         }
         else
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 1d1adf746..764054d1b 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1543,16 +1543,25 @@ void DocumentBroker::handleTileCombinedResponse(const std::vector<char>& payload
 
     try
     {
-        const auto tileCombined = TileCombined::parse(firstLine);
-        const auto buffer = payload.data();
-        auto offset = firstLine.size() + 1;
+        const size_t length = payload.size();
+        if (firstLine.size() < static_cast<std::string::size_type>(length) - 1)
+        {
+            const auto tileCombined = TileCombined::parse(firstLine);
+            const auto buffer = payload.data();
+            size_t offset = firstLine.size() + 1;
 
-        std::unique_lock<std::mutex> lock(_mutex);
+            std::unique_lock<std::mutex> lock(_mutex);
 
-        for (const auto& tile : tileCombined.getTiles())
+            for (const auto& tile : tileCombined.getTiles())
+            {
+                tileCache().saveTileAndNotify(tile, buffer + offset, tile.getImgSize());
+                offset += tile.getImgSize();
+            }
+        }
+        else
         {
-            tileCache().saveTileAndNotify(tile, buffer + offset, tile.getImgSize());
-            offset += tile.getImgSize();
+            LOG_WRN("Dropping empty tilecombine response: " << firstLine);
+            // They will get re-issued if we don't forget them.
         }
     }
     catch (const std::exception& exc)
diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp
index a00987f3b..250d070a1 100644
--- a/wsd/TileCache.cpp
+++ b/wsd/TileCache.cpp
@@ -192,17 +192,6 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const
 
     std::shared_ptr<TileBeingRendered> tileBeingRendered = findTileBeingRendered(tile);
 
-    // Kit did not send image data, because tile has the same wireID as the previously sent tile
-    // We need to remove only the subscriptions
-    if(size == 0)
-    {
-        if(tileBeingRendered && tileBeingRendered->getVersion() <= tile.getVersion())
-        {
-            forgetTileBeingRendered(tileBeingRendered, tile);
-        }
-        return;
-    }
-
     // Save to disk.
     const auto cachedName = (tileBeingRendered ? tileBeingRendered->getCacheName()
                                                : cacheFileName(tile));


More information about the Libreoffice-commits mailing list