wsd/TileCache.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit 2065fb59729a0cb937c57d93227c0b179ec4790c Author: Ashod Nakashian <[email protected]> Date: Sun Dec 11 18:49:56 2016 -0500 loolwsd: set the payload size only once Change-Id: Ieb8f6fdbdbf0fbca3aa4032aea2f15bf37e3282b Reviewed-on: https://gerrit.libreoffice.org/31887 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp index e76e2ed..2085f6e 100644 --- a/wsd/TileCache.cpp +++ b/wsd/TileCache.cpp @@ -173,10 +173,10 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const std::string response = tile.serialize("tile:"); LOG_DBG("Sending tile message to " << subscriberCount << " subscribers: " + response); - std::shared_ptr<MessagePayload> payload = std::make_shared<MessagePayload>(256 + size, MessagePayload::Type::Binary); + std::shared_ptr<MessagePayload> payload = std::make_shared<MessagePayload>(response.size() + 1 + size, + MessagePayload::Type::Binary); { auto& output = payload->data(); - output.resize(response.size() + 1 + size); // Send to first subscriber as-is (without cache marker). std::memcpy(output.data(), response.data(), response.size()); @@ -189,14 +189,14 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const if (subscriberCount > 1) { + // All others must get served from the cache. + response += " renderid=cached\n"; + // Create a new Payload. payload.reset(); - payload = std::make_shared<MessagePayload>(256 + size, MessagePayload::Type::Binary); + payload = std::make_shared<MessagePayload>(response.size() + size, MessagePayload::Type::Binary); auto& output = payload->data(); - // All others must get served from the cache. - response += " renderid=cached\n"; - output.resize(response.size() + size); std::memcpy(output.data(), response.data(), response.size()); std::memcpy(output.data() + response.size(), data, size); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
