[Libreoffice-commits] online.git: wsd/ClientSession.cpp wsd/ClientSession.hpp wsd/DocumentBroker.cpp wsd/SenderQueue.hpp wsd/TileCache.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jul 31 11:19:58 UTC 2018
wsd/ClientSession.cpp | 5 +++++
wsd/ClientSession.hpp | 2 ++
wsd/DocumentBroker.cpp | 1 +
wsd/SenderQueue.hpp | 9 +++++++++
wsd/TileCache.cpp | 5 +++--
5 files changed, 20 insertions(+), 2 deletions(-)
New commits:
commit 0bb96131c495dfe1d98ebbfe01df5c4268d16de8
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jul 31 13:03:05 2018 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jul 31 13:18:44 2018 +0200
Cancel tiles also in wsd's senderqueue
Change-Id: I683b3cacee2f87d0dc0f28ad9ac3e122bcd043f1
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index b421d3304..886a3dcec 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -1040,6 +1040,11 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
return forwardToClient(payload);
}
+void ClientSession::cancelTilesInQueue()
+{
+ _senderQueue.cancelTiles();
+}
+
bool ClientSession::forwardToClient(const std::shared_ptr<Message>& payload)
{
if (isCloseFrame())
diff --git a/wsd/ClientSession.hpp b/wsd/ClientSession.hpp
index fe565a672..8d434f44a 100644
--- a/wsd/ClientSession.hpp
+++ b/wsd/ClientSession.hpp
@@ -100,6 +100,8 @@ public:
}
}
+ void cancelTilesInQueue();
+
/// Set the save-as socket which is used to send convert-to results.
void setSaveAsSocket(const std::shared_ptr<StreamSocket>& socket)
{
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 84ad69a15..e6ead209a 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1445,6 +1445,7 @@ void DocumentBroker::cancelTileRequests(const std::shared_ptr<ClientSession>& se
// Clear tile requests
session->clearTilesOnFly();
session->getRequestedTiles() = boost::none;
+ session->cancelTilesInQueue();
const std::string canceltiles = tileCache().cancelTiles(session);
if (!canceltiles.empty())
diff --git a/wsd/SenderQueue.hpp b/wsd/SenderQueue.hpp
index fc3464b3f..927e3e735 100644
--- a/wsd/SenderQueue.hpp
+++ b/wsd/SenderQueue.hpp
@@ -84,6 +84,15 @@ public:
}
}
+ void cancelTiles()
+ {
+ std::remove_if(_queue.begin(), _queue.end(),
+ [](const queue_item_t& cur)
+ {
+ return cur->firstToken() == "tile:";
+ });
+ }
+
private:
/// Deduplicate messages based on the new one.
/// Returns true if the new message should be
diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp
index f80f64a1c..efa68e4ba 100644
--- a/wsd/TileCache.cpp
+++ b/wsd/TileCache.cpp
@@ -529,7 +529,7 @@ std::string TileCache::cancelTiles(const std::shared_ptr<ClientSession> &subscri
assertCorrectThread();
- const ClientSession* sub = subscriber.get();
+ ClientSession* sub = subscriber.get();
std::ostringstream oss;
@@ -564,7 +564,8 @@ std::string TileCache::cancelTiles(const std::shared_ptr<ClientSession> &subscri
++it;
}
- subscriber->clearSubscription();
+ if(sub)
+ sub->clearSubscription();
const std::string canceltiles = oss.str();
return canceltiles.empty() ? canceltiles : "canceltiles " + canceltiles;
}
More information about the Libreoffice-commits
mailing list