loolwsd/LOOLBroker.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
New commits: commit e8e8e6c844d03113aff344852a0d1c38976bdfdb Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sat Dec 26 11:27:44 2015 -0500 loolwsd: detect broken pipe Change-Id: If1f40833e26c9ff281f33cc5d7c798fc0f9f3239 Reviewed-on: https://gerrit.libreoffice.org/20973 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 314d54c..bb3e3b7 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -451,18 +451,29 @@ public: { (void)poll(&aPoll,1,-1); - if( (aPoll.revents & POLLIN) != 0 ) + if (poll(&aPoll, 1, -1) < 0) + { + Log::error("Failed to poll pipe [" + FIFO_FILE + "]."); + continue; + } + else + if (aPoll.revents & POLLIN) { nBytes = Util::readFIFO(readerBroker, aBuffer, sizeof(aBuffer)); if (nBytes < 0) { pStart = pEnd = nullptr; - Log::error("Error reading message."); + Log::error("Error reading message from pipe [" + FIFO_FILE + "]."); continue; } pStart = aBuffer; pEnd = aBuffer + nBytes; - Log::trace("Broker readFIFO: [" + std::string(pStart, nBytes) + "]"); + } + else + if (aPoll.revents & (POLLERR | POLLHUP)) + { + Log::error("Broken pipe [" + FIFO_FILE + "] with broker."); + break; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits