net/loolnb.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
New commits: commit a6b7d9c9cec8a4fd2c93bf34c99c351ccf1baab2 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sun Feb 19 12:10:28 2017 -0500 nb: server socket should accept only on POLLIN Change-Id: I50e9a7f78e51bbf7e42e3eafde6e32d6538f5657 Reviewed-on: https://gerrit.libreoffice.org/34442 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/net/loolnb.cpp b/net/loolnb.cpp index 52f048d..fd74964 100644 --- a/net/loolnb.cpp +++ b/net/loolnb.cpp @@ -365,18 +365,21 @@ public: return POLLIN; } - HandleResult handlePoll( int /* events */ ) override + HandleResult handlePoll( int events ) override { - std::shared_ptr<Socket> clientSocket = accept(); - if (!clientSocket) + if (events & POLLIN) { - const std::string msg = "Failed to accept. (errno: "; - throw std::runtime_error(msg + std::strerror(errno) + ")"); + std::shared_ptr<Socket> clientSocket = accept(); + if (!clientSocket) + { + const std::string msg = "Failed to accept. (errno: "; + throw std::runtime_error(msg + std::strerror(errno) + ")"); + } + + std::cout << "Accepted client #" << clientSocket->getFD() << std::endl; + _clientPoller.insertNewSocket(clientSocket); } - std::cout << "Accepted client #" << clientSocket->getFD() << std::endl; - _clientPoller.insertNewSocket(clientSocket); - return Socket::HandleResult::CONTINUE; } }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits