[Libreoffice-commits] online.git: loolwsd/MasterProcessSession.cpp loolwsd/TileCache.cpp loolwsd/TileCache.hpp
Pranav Kant
pranavk at collabora.com
Thu Feb 11 05:04:41 UTC 2016
loolwsd/MasterProcessSession.cpp | 4 ++++
loolwsd/TileCache.cpp | 9 +++++++++
loolwsd/TileCache.hpp | 3 +++
3 files changed, 16 insertions(+)
New commits:
commit 6a7a014d14ec4142f7c28faa920ffb5871e8f115
Author: Pranav Kant <pranavk at collabora.com>
Date: Wed Feb 10 23:21:24 2016 +0530
loolwsd: Remove cached 'status' command output on 'setclientpart'
Otherwise we have a problem when cached information is different than
the actual one maintained by LOKitDocument, keeping the whole
server setup in an inconsistent state.
For example, when client reloads the browser session quickly
after setting the current part (to say 3) of an opened part document.
If the reload occurs soon enough before the 'setclientpart'
message originated from the client is acknowledged by the server,
then the next reload would get the cached 'status' entry asking
the client to set 'currentpart' to something else leading to the
generation of another 'setclientpart' message. This thing would
go on, and we would run into a loop, as I have for the last few
hours.
Change-Id: Ia6260dfb772f2e3f023572aa060fd7da92b196c8
Reviewed-on: https://gerrit.libreoffice.org/22272
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 4054f3c..cbe7f76 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -360,6 +360,10 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
if (_peer.expired())
dispatchChild();
+
+ if (tokens[0] == "setclientpart")
+ _tileCache->removeFile("status.txt");
+
if (tokens[0] != "requestloksession")
{
forwardToPeer(buffer, length);
diff --git a/loolwsd/TileCache.cpp b/loolwsd/TileCache.cpp
index 6fdcb45..8a3b408 100644
--- a/loolwsd/TileCache.cpp
+++ b/loolwsd/TileCache.cpp
@@ -278,6 +278,15 @@ void TileCache::invalidateTiles(const std::string& tiles)
}
}
+void TileCache::removeFile(const std::string fileName)
+{
+ const std::string textFile = cacheDirName(false) + "/" + fileName;
+ const std::string editingTextFile = cacheDirName(true) + "/" + fileName;
+
+ Util::removeFile(textFile);
+ Util::removeFile(editingTextFile);
+}
+
std::string TileCache::toplevelCacheDirName()
{
SHA1Engine digestEngine;
diff --git a/loolwsd/TileCache.hpp b/loolwsd/TileCache.hpp
index 9babf20..4118ff0 100644
--- a/loolwsd/TileCache.hpp
+++ b/loolwsd/TileCache.hpp
@@ -62,6 +62,9 @@ public:
void invalidateTiles(int part, int x, int y, int width, int height);
+ // Removes the given file from both editing and persistent cache
+ void removeFile(const std::string fileName);
+
private:
/// Toplevel cache dirname.
std::string toplevelCacheDirName();
More information about the Libreoffice-commits
mailing list