[Libreoffice-commits] online.git: loolwsd/DocumentBroker.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Wed Nov 9 06:08:01 UTC 2016
loolwsd/DocumentBroker.hpp | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
New commits:
commit 462f71a632a6fda87b195b893eda6c74a8fb295f
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Wed Nov 9 00:47:42 2016 -0500
loolwsd: no need to ping to check for live socket
Ping message needs to be echoed and that messes
up reading large messages that come in two parts.
Luckily, it's not necessary to do so as it's
sufficient to poll the state of the socket.
It's true polling is less accurate as there is
a timeout when a socket is disconnected, but
that doesn't seem to be an issue in practice.
Change-Id: I7a5744a621c4416b8f9d003871f6d613cc6ca7dc
Reviewed-on: https://gerrit.libreoffice.org/30705
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index 2b0f162..b5c1fa2 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -146,14 +146,10 @@ public:
{
try
{
- if (_pid > 1 && _ws && kill(_pid, 0) == 0)
- {
- // We don't care about the response (and shouldn't read here).
- _ws->sendFrame("PING", 4, Poco::Net::WebSocket::FRAME_OP_PING);
- LOG_DBG("Sent a PING.");
-
- return true;
- }
+ using namespace Poco::Net;
+ return (_pid > 1 && _ws && kill(_pid, 0) == 0 &&
+ _ws->poll(Poco::Timespan(0), Socket::SelectMode::SELECT_WRITE) &&
+ !_ws->poll(Poco::Timespan(0), Socket::SelectMode::SELECT_ERROR));
}
catch (const std::exception& exc)
{
More information about the Libreoffice-commits
mailing list