[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - net/WebSocketHandler.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Tue Apr 11 12:44:28 UTC 2017
net/WebSocketHandler.hpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
New commits:
commit 07a4b4bd352a30f72483c57c2fc8c9401efc3098
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Apr 9 18:24:51 2017 -0400
wsd: return the actual number of bytes written to WS
Change-Id: Ib28c432927733ffd437d27dec749d402d25b9024
Reviewed-on: https://gerrit.libreoffice.org/36323
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
(cherry picked from commit 0dab4b597da5dd6531eaa8634dbafe69a8b41a40)
Reviewed-on: https://gerrit.libreoffice.org/36334
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/net/WebSocketHandler.hpp b/net/WebSocketHandler.hpp
index 7c004c7c..85cad811 100644
--- a/net/WebSocketHandler.hpp
+++ b/net/WebSocketHandler.hpp
@@ -195,11 +195,14 @@ public:
} else
_wsPayload.insert(_wsPayload.end(), data, data + payloadLen);
+ assert(_wsPayload.size() >= payloadLen);
+
socket->_inBuffer.erase(socket->_inBuffer.begin(), socket->_inBuffer.begin() + headerLen + payloadLen);
// FIXME: fin, aggregating payloads into _wsPayload etc.
LOG_TRC("#" << socket->getFD() << ": Incoming WebSocket message code " << code <<
- " fin? " << fin << ", mask? " << hasMask << " payload length: " << _wsPayload.size());
+ ", fin? " << fin << ", mask? " << hasMask << ", payload length: " << _wsPayload.size() <<
+ ", residual socket data: " << socket->_inBuffer.size() << " bytes.");
switch (code)
{
@@ -340,6 +343,7 @@ protected:
socket->assertCorrectThread();
std::vector<char>& out = socket->_outBuffer;
+ const size_t oldSize = out.size();
out.push_back(flags);
@@ -368,12 +372,12 @@ protected:
// Copy the data.
out.insert(out.end(), data, data + len);
+ const size_t size = out.size() - oldSize;
if (flush)
socket->writeOutgoingData();
- // Data + header.
- return len + 2;
+ return size;
}
/// To be overriden to handle the websocket messages the way you need.
More information about the Libreoffice-commits
mailing list