summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2018-10-01 18:11:25 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2018-10-01 18:16:14 +0200
commit8a318cc44d0a96bced7c565544c4772cfb936f93 (patch)
tree2f821c07fd7c5c77b90cac96910ad0b0b8cd3177
parentRemove accidentally pushed log line (diff)
downloadonline-8a318cc44d0a96bced7c565544c4772cfb936f93.tar.gz
online-8a318cc44d0a96bced7c565544c4772cfb936f93.zip
wsd: Avoid parsing tile messages twice
Change-Id: I049e7ce645999a4d0366ab34ffa75ab0d351947b
-rw-r--r--wsd/ClientSession.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index c32219ba39..d145a9b9c0 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -13,6 +13,7 @@
#include <fstream>
#include <sstream>
+#include <memory>
#include <Poco/Net/HTTPResponse.h>
#include <Poco/StreamCopier.h>
@@ -1034,15 +1035,16 @@ void ClientSession::enqueueSendMessage(const std::shared_ptr<Message>& data)
docBroker->assertCorrectThread();
const std::string command = data->firstToken();
+ std::unique_ptr<TileDesc> tile;
if (command == "tile:")
{
// Avoid sending tile if it has the same wireID as the previously sent tile
- const TileDesc tile = TileDesc::parse(data->firstLine());
- const std::string tileID = generateTileID(tile);
+ tile.reset(new TileDesc(TileDesc::parse(data->firstLine())));
+ const std::string tileID = generateTileID(*tile);
auto iter = _oldWireIds.find(tileID);
- if(iter != _oldWireIds.end() && tile.getWireId() != 0 && tile.getWireId() == iter->second)
+ if(iter != _oldWireIds.end() && tile->getWireId() != 0 && tile->getWireId() == iter->second)
{
- LOG_INF("WSD filters out a tile with the same wireID: " << tile.serialize("tile:"));
+ LOG_INF("WSD filters out a tile with the same wireID: " << tile->serialize("tile:"));
return;
}
}
@@ -1052,10 +1054,9 @@ void ClientSession::enqueueSendMessage(const std::shared_ptr<Message>& data)
size_t newSize = _senderQueue.enqueue(data);
// Track sent tile
- if (command == "tile:")
+ if (tile)
{
- const TileDesc tile = TileDesc::parse(data->firstLine());
- traceTileBySend(tile, sizeBefore == newSize);
+ traceTileBySend(*tile, sizeBefore == newSize);
}
}