loolwsd/DocumentBroker.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
New commits: commit 05d4234208df0777ea8d8da9dceda200222d5a58 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Mon Oct 31 21:25:19 2016 -0400 loolwsd: more efficient client message forwarding Change-Id: I10f880059380599cf0187064e1009bef5fa693b1 Reviewed-on: https://gerrit.libreoffice.org/30492 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp index 5f417f1..a332af6 100644 --- a/loolwsd/DocumentBroker.cpp +++ b/loolwsd/DocumentBroker.cpp @@ -851,8 +851,21 @@ bool DocumentBroker::forwardToChild(const std::string& viewId, const std::string bool DocumentBroker::forwardToClient(const std::string& prefix, const std::vector<char>& payload) { - std::string message(payload.data() + prefix.size(), payload.size() - prefix.size()); - Util::ltrim(message); + assert(payload.size() > prefix.size()); + + // Remove the prefix and trim. + size_t index = prefix.size(); + for ( ; index < payload.size(); ++index) + { + if (payload[index] != ' ') + { + break; + } + } + + auto data = payload.data() + index; + auto size = payload.size() - index; + const auto message = getAbbreviatedMessage(data, size); Log::trace("Forwarding payload to " + prefix + ' ' + message); std::string name; @@ -865,7 +878,7 @@ bool DocumentBroker::forwardToClient(const std::string& prefix, const std::vecto const auto peer = it->second->getPeer(); if (peer) { - return peer->handleInput(message.data(), message.size()); + return peer->handleInput(data, size); } else { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits