loolwsd/DocumentBroker.hpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
New commits: commit 462f71a632a6fda87b195b893eda6c74a8fb295f Author: Ashod Nakashian <ashod.nakash...@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 <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@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) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits