From bba391aa3a21fcc6df108cf0790ef283293249cf Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Wed, 30 Jul 2008 08:39:46 +0000 Subject: Merged r680937. Added error handling for case where socket cannot be accepted e.g. due to constraints on file handles. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@680939 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/posix/AsynchIO.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cpp') diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp index 1231698eea..2d9bdbd3d8 100644 --- a/cpp/src/qpid/sys/posix/AsynchIO.cpp +++ b/cpp/src/qpid/sys/posix/AsynchIO.cpp @@ -22,6 +22,7 @@ #include "qpid/sys/AsynchIO.h" #include "qpid/sys/Socket.h" #include "qpid/sys/Time.h" +#include "qpid/log/Statement.h" #include "check.h" @@ -87,11 +88,15 @@ void AsynchAcceptor::readable(DispatchHandle& h) { errno = 0; // TODO: Currently we ignore the peers address, perhaps we should // log it or use it for connection acceptance. - s = socket.accept(0, 0); - if (s) { - acceptedCallback(*s); - } else { - break; + try { + s = socket.accept(0, 0); + if (s) { + acceptedCallback(*s); + } else { + break; + } + } catch (const std::exception& e) { + QPID_LOG(error, "Could not accept socket: " << e.what()); } } while (true); -- cgit v1.2.1