summaryrefslogtreecommitdiff
path: root/kit
diff options
context:
space:
mode:
authorGabriel Masei <gabriel.masei@1and1.ro>2020-07-10 15:22:35 +0300
committerGabriel Masei <gabriel.masei@1and1.ro>2020-07-22 17:38:05 +0200
commit9c6739eee01952708409717c5cdf28c8f9fb94a5 (patch)
tree3d2c55f25f209ef9e30c14a604325f4a9d0e2d35 /kit
parent94923a244d0d08a4160f59a2a29113323e17e5c7 (diff)
kit: disable parallel handling of messages while processing load and save
The map._activate, among other actions, is sending indirectly some messages to the server like clientzoom and clientvisiblearea. If these messages are send before the document finishes processing the load message then there is a chance that a nodocloaded error will be thrown because there is a chance that the messages will be processed in parallel with load. This happens constantly for xlsx files. This is generated by the Unipoll mechanism which, in case of xlsx files, triggers a parallel processing. To avoid the above scenario a mechanism of disabling parallel processing of messages in kit was implemented and is used for load and save messages, for now. Change-Id: I4c83e72e600f92d0bb4f1f18cebe694e326256d0 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98519 Tested-by: Jenkins Tested-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'kit')
-rw-r--r--kit/ChildSession.cpp9
-rw-r--r--kit/Kit.cpp10
2 files changed, 19 insertions, 0 deletions
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index e34de28c2..38a5b699f 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -209,6 +209,8 @@ bool ChildSession::_handleInput(const char *buffer, int length)
return false;
}
+ // Disable processing of other messages while loading document
+ InputProcessingManager processInput(getProtocol(), false);
_isDocLoaded = loadDocument(buffer, length, tokens);
LOG_TRC("isDocLoaded state after loadDocument: " << _isDocLoaded << '.');
@@ -376,6 +378,13 @@ bool ChildSession::_handleInput(const char *buffer, int length)
newTokens.push_back(firstLine.substr(4)); // Copy the remaining part.
return unoCommand(buffer, length, newTokens);
}
+ else if (tokens[1].find(".uno:Save") != std::string::npos)
+ {
+ // Disable processing of other messages while saving document
+ InputProcessingManager processInput(getProtocol(), false);
+ return unoCommand(buffer, length, tokens);
+ }
+
return unoCommand(buffer, length, tokens);
}
else if (tokens.equals(0, "selecttext"))
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 1853bed45..3ca92b01b 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1939,6 +1939,16 @@ protected:
}
}
+ virtual void enableProcessInput(bool enable = true) override
+ {
+ WebSocketHandler::enableProcessInput(enable);
+ // Wake up poll to process data from socket input buffer
+ if (enable && _ksPoll)
+ {
+ _ksPoll->wakeup();
+ }
+ }
+
void onDisconnect() override
{
#if !MOBILEAPP