loolwsd/Common.hpp | 2 +- loolwsd/LOOLBroker.cpp | 4 ++-- loolwsd/LOOLKit.cpp | 4 ++-- loolwsd/LOOLWSD.cpp | 10 +++------- 4 files changed, 8 insertions(+), 12 deletions(-)
New commits: commit d2bde985cc35b3f8f836fc68579eb78379a52961 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Thu Jan 21 08:54:56 2016 -0500 loolwsd: poll timeout of 500ms and handling priority events Change-Id: Iadf449ee62700e1ac5da2be8c73c674657633808 Reviewed-on: https://gerrit.libreoffice.org/21679 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/Common.hpp b/loolwsd/Common.hpp index 1fae869..ff98222 100644 --- a/loolwsd/Common.hpp +++ b/loolwsd/Common.hpp @@ -18,7 +18,7 @@ constexpr int MASTER_PORT_NUMBER = 9981; constexpr int INTERVAL_PROBES = 10; constexpr int MAINTENANCE_INTERVAL = 1; constexpr int CHILD_TIMEOUT_SECS = 10; -constexpr int POLL_TIMEOUT = 1000000; +constexpr int POLL_TIMEOUT_MS = 500; /// Pipe and Socket read buffer size. /// Should be large enough for ethernet packets diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 28a0e2f..1a3954b 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -429,13 +429,13 @@ public: { if ( pStart == pEnd ) { - if (poll(&aPoll, 1, -1) < 0) + if (poll(&aPoll, 1, POLL_TIMEOUT_MS) < 0) { Log::error("Failed to poll pipe [" + FIFO_FILE + "]."); continue; } else - if (aPoll.revents & POLLIN) + if (aPoll.revents & (POLLIN | POLLPRI)) { nBytes = Util::readFIFO(readerBroker, aBuffer, sizeof(aBuffer)); if (nBytes < 0) diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp index 706b8f2..bceb1fa 100644 --- a/loolwsd/LOOLKit.cpp +++ b/loolwsd/LOOLKit.cpp @@ -812,13 +812,13 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s aPoll.events = POLLIN; aPoll.revents = 0; - if (poll(&aPoll, 1, -1) < 0) + if (poll(&aPoll, 1, POLL_TIMEOUT_MS) < 0) { Log::error("Failed to poll pipe [" + pipe + "]."); continue; } else - if (aPoll.revents & POLLIN) + if (aPoll.revents & (POLLIN | POLLPRI)) { nBytes = Util::readFIFO(readerBroker, aBuffer, sizeof(aBuffer)); if (nBytes < 0) diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index f3187d7..c0af9e3 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -200,21 +200,17 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws, { Log::info("Starting Socket Processor."); - const Poco::Timespan waitTime(POLL_TIMEOUT); + const Poco::Timespan waitTime(POLL_TIMEOUT_MS); try { int flags = 0; int n = 0; - bool pollTimeout = true; ws->setReceiveTimeout(0); do { char buffer[200000]; //FIXME: Dynamic? - // We should care about timeout only when we have heartbeat - // support. For now, we can't predict when the next message - // should arrive. - if ((pollTimeout = ws->poll(waitTime, Socket::SELECT_READ))) + if (ws->poll(waitTime, Socket::SELECT_READ)) { n = ws->receiveFrame(buffer, sizeof(buffer), flags); @@ -295,7 +291,7 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws, while (!TerminationFlag && (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE); Log::debug() << "Finishing SocketProcessor. TerminationFlag: " << TerminationFlag - << ", pollTimeout: " << pollTimeout << ", payload size: " << n + << ", payload size: " << n << ", flags: " << std::hex << flags << Log::end; } catch (const WebSocketException& exc) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits