From 93eb6253fe78567a5334dd45166629dd4c46499a Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Wed, 30 Jul 2008 08:28:30 +0000 Subject: 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/branches/qpid.0-10@680937 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/posix/AsynchIO.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp index 470db4c614..4eb6d0a3e7 100644 --- a/cpp/src/qpid/sys/posix/AsynchIO.cpp +++ b/cpp/src/qpid/sys/posix/AsynchIO.cpp @@ -21,6 +21,7 @@ #include "qpid/sys/AsynchIO.h" #include "qpid/sys/Time.h" +#include "qpid/log/Statement.h" #include "check.h" @@ -85,11 +86,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