[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - 2 commits - wsd/ClientSession.cpp wsd/ClientSession.hpp wsd/DocumentBroker.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Aug 28 08:43:33 UTC 2018
wsd/ClientSession.cpp | 37 ++++++++++++++++++++++++++++++++++---
wsd/ClientSession.hpp | 5 ++++-
wsd/DocumentBroker.cpp | 2 ++
3 files changed, 40 insertions(+), 4 deletions(-)
New commits:
commit c819651600a337627543a6855202468a8b6eae6e
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Aug 24 14:01:44 2018 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Aug 28 10:43:28 2018 +0200
First forward invalidation to client and request tiles after
(cherry picked from commit 1b01af36059623627fd8895353f028efc20ef26f)
Change-Id: I48a9e5783312801468651e55f4c05d3c08ff9189
Reviewed-on: https://gerrit.libreoffice.org/59649
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index ef3380199..00fd8373d 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -947,7 +947,12 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
else if (tokens[0] == "invalidatetiles:")
{
assert(firstLine.size() == static_cast<std::string::size_type>(length));
+
+ // First forward invalidation
+ bool ret = forwardToClient(payload);
+
handleTileInvalidation(firstLine, docBroker);
+ return ret;
}
else if (tokens[0] == "invalidatecursor:")
{
commit dce9d960fe8e059e8d60f0a93b88dba54f53a7ee
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Aug 23 12:46:49 2018 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Aug 28 10:43:15 2018 +0200
Drop too old tileID's from tiles-on-fly list
So we can avoid that tile sending stop working because server is
waiting for tileprocessed messages which will not arrive.
Change-Id: I545346c50d49340999608aadac32b5190ede43c5
(cherry picked from commit 759d1fe72294b22669f19dabf28a4fcf4922af8c)
Fix previous commit
Change-Id: I7d3bce0132d124e52f7885c8cb3c26acc6f7b41d
(cherry picked from commit 3bd7c6b5084bb2505cf0f2629450974e68b8c050)
Go back using list for tilesOnFly
It can handle duplicates which we need to have.
Change-Id: Ia4cd813dd173bc538dd27953c4886d460b5b1c49
(cherry picked from commit 185b933353c670ef4639ada323ed2f803f209e70)
Reviewed-on: https://gerrit.libreoffice.org/59648
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 9ed10cf30..ef3380199 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -51,7 +51,6 @@ ClientSession::ClientSession(const std::string& id,
_tileWidthTwips(0),
_tileHeightTwips(0),
_isTextDocument(false),
- _tilesOnFly(0),
_tilesBeingRendered(0)
{
const size_t curConnections = ++LOOLWSD::NumConnections;
@@ -342,7 +341,13 @@ bool ClientSession::_handleInput(const char *buffer, int length)
sendTextFrame("error: cmd=tileprocessed kind=syntax");
return false;
}
- auto iter = std::find(_tilesOnFly.begin(), _tilesOnFly.end(), tileID);
+
+ auto iter = std::find_if(_tilesOnFly.begin(), _tilesOnFly.end(),
+ [&tileID](const std::pair<std::string, std::chrono::steady_clock::time_point>& curTile)
+ {
+ return curTile.first == tileID;
+ });
+
if(iter != _tilesOnFly.end())
_tilesOnFly.erase(iter);
else
@@ -1040,7 +1045,7 @@ Authorization ClientSession::getAuthorization() const
void ClientSession::addTileOnFly(const TileDesc& tile)
{
- _tilesOnFly.push_back(generateTileID(tile));
+ _tilesOnFly.push_back({generateTileID(tile), std::chrono::steady_clock::now()});
}
void ClientSession::clearTilesOnFly()
@@ -1048,6 +1053,24 @@ void ClientSession::clearTilesOnFly()
_tilesOnFly.clear();
}
+void ClientSession::removeOutdatedTilesOnFly()
+{
+ // Check only the beginning of the list, tiles are ordered by timestamp
+ bool continueLoop = true;
+ while(!_tilesOnFly.empty() && continueLoop)
+ {
+ auto tileIter = _tilesOnFly.begin();
+ double elapsedTimeMs = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - tileIter->second).count();
+ if(elapsedTimeMs > 3000)
+ {
+ LOG_WRN("Tracker tileID was dropped because of time out. Tileprocessed message did not arrive");
+ _tilesOnFly.erase(tileIter);
+ }
+ else
+ continueLoop = false;
+ }
+}
+
void ClientSession::onDisconnect()
{
LOG_INF(getName() << " Disconnected, current number of connections: " << LOOLWSD::NumConnections);
@@ -1242,7 +1265,10 @@ void ClientSession::removeOutdatedTileSubscriptions()
{
double elapsedTime = docBroker->tileCache().getTileBeingRenderedElapsedTimeMs(*iterator);
if(elapsedTime < 0.0 && elapsedTime > 5000.0)
+ {
+ LOG_WRN("Tracked TileBeingRendered was dropped because of time out.");
_tilesBeingRendered.erase(iterator);
+ }
else
++iterator;
}
diff --git a/wsd/ClientSession.hpp b/wsd/ClientSession.hpp
index 13f0b141c..397f7b670 100644
--- a/wsd/ClientSession.hpp
+++ b/wsd/ClientSession.hpp
@@ -19,6 +19,8 @@
#include <Rectangle.hpp>
#include <deque>
#include <map>
+#include <list>
+#include <utility>
#include <unordered_set>
class DocumentBroker;
@@ -125,6 +127,7 @@ public:
void addTileOnFly(const TileDesc& tile);
void clearTilesOnFly();
size_t getTilesOnFlyCount() const { return _tilesOnFly.size(); }
+ void removeOutdatedTilesOnFly();
Util::Rectangle getVisibleArea() const { return _clientVisibleArea; }
int getTileWidthInTwips() const { return _tileWidthTwips; }
@@ -230,7 +233,7 @@ private:
bool _isTextDocument;
/// TileID's of the sent tiles. Push by sending and pop by tileprocessed message from the client.
- std::list<std::string> _tilesOnFly;
+ std::list<std::pair<std::string, std::chrono::steady_clock::time_point>> _tilesOnFly;
/// Names of tiles requested from kit, which this session is subsrcibed to
/// Track only non-thumbnail tiles (getId() == -1)
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 913510064..9f9e63304 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1401,6 +1401,8 @@ void DocumentBroker::sendRequestedTiles(const std::shared_ptr<ClientSession>& se
// Update client's tilesBeingRendered list
session->removeOutdatedTileSubscriptions();
+ // Drop tiles which we are waiting for too long
+ session->removeOutdatedTilesOnFly();
// All tiles were processed on client side what we sent last time, so we can send a new banch of tiles
// which was invalidated / requested in the meantime
More information about the Libreoffice-commits
mailing list