[Libreoffice-commits] online.git: wsd/LOOLWebSocket.hpp
Michael Meeks
michael.meeks at collabora.com
Thu Dec 15 13:57:30 UTC 2016
wsd/LOOLWebSocket.hpp | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
New commits:
commit e24dfb9616194fdaf113b86a0db0d7289f79d57f
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu Dec 15 13:51:07 2016 +0000
Use a blocking write rather than failing when no space in write buffer.
Also avoid a poll syscall for an error state we'll get from the write.
diff --git a/wsd/LOOLWebSocket.hpp b/wsd/LOOLWebSocket.hpp
index 972d895..bc51321 100644
--- a/wsd/LOOLWebSocket.hpp
+++ b/wsd/LOOLWebSocket.hpp
@@ -108,9 +108,7 @@ public:
if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING)
{
// Echo back the ping message.
- if (poll(waitZero, Socket::SelectMode::SELECT_ERROR) ||
- !poll(waitZero, Socket::SelectMode::SELECT_WRITE) ||
- Poco::Net::WebSocket::sendFrame(buffer, n, WebSocket::FRAME_FLAG_FIN | WebSocket::FRAME_OP_PONG) != n)
+ if (Poco::Net::WebSocket::sendFrame(buffer, n, WebSocket::FRAME_FLAG_FIN | WebSocket::FRAME_OP_PONG) != n)
{
LOG_WRN("Sending Pong failed.");
return -1;
@@ -145,9 +143,7 @@ public:
const std::string nextmessage = "nextmessage: size=" + std::to_string(length);
const int size = nextmessage.size();
- if (!poll(waitZero, Socket::SelectMode::SELECT_ERROR) &&
- poll(waitZero, Socket::SelectMode::SELECT_WRITE) &&
- Poco::Net::WebSocket::sendFrame(nextmessage.data(), size) == size)
+ if (Poco::Net::WebSocket::sendFrame(nextmessage.data(), size) == size)
{
LOG_TRC("Sent long message preample: " + nextmessage);
}
@@ -158,12 +154,7 @@ public:
}
}
- int result = -1;
- if (!poll(waitZero, Socket::SelectMode::SELECT_ERROR) &&
- poll(waitZero, Socket::SelectMode::SELECT_WRITE))
- {
- result = Poco::Net::WebSocket::sendFrame(buffer, length, flags);
- }
+ int result = Poco::Net::WebSocket::sendFrame(buffer, length, flags);
lock.unlock();
More information about the Libreoffice-commits
mailing list