[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp loolwsd/LOOLKit.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun May 15 14:33:16 UTC 2016
loolwsd/DocumentBroker.cpp | 10 ++++++----
loolwsd/LOOLKit.cpp | 32 ++++++++------------------------
2 files changed, 14 insertions(+), 28 deletions(-)
New commits:
commit 249b5350a411ff7d30bf17185ad16fb2e60b477b
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun May 15 10:18:11 2016 -0400
loolwsd: removed editlock kludge in tile processing
Change-Id: If2a732fc3feb4e5cc600c98ab096a88beacf62d8
Reviewed-on: https://gerrit.libreoffice.org/25006
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index cf7d479..fe09607 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -420,9 +420,6 @@ void DocumentBroker::handleTileRequest(int part, int width, int height, int tile
oss << " id=" << id;
}
- // Piggyback editlock information to kit process.
- // We do not allow requests without editlock to change document parts
- oss << " editlock=" << (session->isEditLocked() ? "1" : "0");
const std::string tileMsg = oss.str();
std::unique_lock<std::mutex> lock(_mutex);
@@ -481,7 +478,12 @@ void DocumentBroker::handleTileResponse(const std::vector<char>& payload)
!getTokenInteger(tokens[5], "tileposy", tilePosY) ||
!getTokenInteger(tokens[6], "tilewidth", tileWidth) ||
!getTokenInteger(tokens[7], "tileheight", tileHeight))
- assert(false);
+ {
+ //FIXME: Return error.
+ //sendTextFrame("error: cmd=tile kind=syntax");
+ Log::error("Invalid tile request [" + firstLine + "].");
+ return;
+ }
size_t index = 8;
int id = -1;
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 183768b..fb6b314 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -576,11 +576,10 @@ public:
void renderTile(StringTokenizer& tokens, const std::shared_ptr<Poco::Net::WebSocket>& ws)
{
+ const auto tileMsg = Poco::cat(std::string(" "), tokens.begin() + 1, tokens.end());
int part, width, height, tilePosX, tilePosY, tileWidth, tileHeight;
- // There would be another param, editlock=, as the last parameter.
- // For presentations, it would be followed by id=
- if (tokens.count() < 9 ||
+ if (tokens.count() < 8 ||
!getTokenInteger(tokens[1], "part", part) ||
!getTokenInteger(tokens[2], "width", width) ||
!getTokenInteger(tokens[3], "height", height) ||
@@ -591,7 +590,7 @@ public:
{
//FIXME: Return error.
//sendTextFrame("error: cmd=tile kind=syntax");
- Log::error() << "Invalid tile request" << Log::end;
+ Log::error("Invalid tile request [" + tileMsg + "].");
return;
}
@@ -605,12 +604,11 @@ public:
{
//FIXME: Return error.
//sendTextFrame("error: cmd=tile kind=invalid");
- Log::error() << "Invalid tile request" << Log::end;
+ Log::error("Invalid tile request [" + tileMsg + "].");
return;
}
size_t index = 8;
- int editLock = -1;
int id = -1;
if (tokens.count() > index && tokens[index].find("id") == 0)
{
@@ -618,20 +616,6 @@ public:
++index;
}
- if (tokens.count() > index && tokens[index].find("editlock") == 0)
- {
- getTokenInteger(tokens[index], "editlock", editLock);
- ++index;
- }
-
- // For time being, editlock information in tile requests is mandatory
- // till we have a better solution to handle multi-part documents
- if (editLock == -1)
- {
- Log::error("No editlock information found.");
- return;
- }
-
std::unique_lock<std::recursive_mutex> lock(ChildProcessSession::getLock());
if (_loKitDocument == nullptr)
@@ -645,12 +629,11 @@ public:
//_loKitDocument->pClass->setView(_loKitDocument, _viewId);
// Send back the request with all optional parameters given in the request.
- std::string response = "tile: " + Poco::cat(std::string(" "), tokens.begin() + 1, tokens.end() - 1);
-
#if ENABLE_DEBUG
- response += " renderid=" + Util::UniqueId();
+ const std::string response = "tile: " + tileMsg + " renderid=" + Util::UniqueId() + "\n";
+#else
+ const std::string response = "tile: " + tileMsg + "\n";
#endif
- response += "\n";
std::vector<char> output;
output.reserve(response.size() + (4 * width * height));
@@ -683,6 +666,7 @@ public:
ws->sendFrame(nextmessage.data(), nextmessage.size());
}
+ Log::trace("Sending render-tile response for: " + response);
ws->sendFrame(output.data(), length, WebSocket::FRAME_BINARY);
}
More information about the Libreoffice-commits
mailing list