[Libreoffice-commits] online.git: wsd/LOOLWebSocket.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Wed Dec 14 04:15:16 UTC 2016
wsd/LOOLWebSocket.hpp | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
New commits:
commit 875d11f88bc39dcb3c110482b042abbe4d9652bf
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Tue Dec 13 17:55:10 2016 -0500
loolwsd: simplify checking for closed socket
Change-Id: I1f41c40bdd42ad6ab9224a2b13af97f84175492c
Reviewed-on: https://gerrit.libreoffice.org/31983
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/LOOLWebSocket.hpp b/wsd/LOOLWebSocket.hpp
index 3f86acd..972d895 100644
--- a/wsd/LOOLWebSocket.hpp
+++ b/wsd/LOOLWebSocket.hpp
@@ -97,11 +97,15 @@ public:
while (poll(waitTime, Poco::Net::Socket::SELECT_READ))
{
const int n = Poco::Net::WebSocket::receiveFrame(buffer, length, flags);
-
LOG_TRC("Got frame: " << LOOLProtocol::getAbbreviatedFrameDump(buffer, n, flags));
- if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING &&
- (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE)
+ if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_CLOSE)
+ {
+ // Nothing to do.
+ return n;
+ }
+
+ if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING)
{
// Echo back the ping message.
if (poll(waitZero, Socket::SelectMode::SELECT_ERROR) ||
@@ -112,8 +116,7 @@ public:
return -1;
}
}
- else if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PONG &&
- (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE)
+ else if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PONG)
{
// In case we do send pings in the future.
}
More information about the Libreoffice-commits
mailing list