diff options
author | Gordon Sim <gsim@apache.org> | 2008-07-30 08:28:30 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-07-30 08:28:30 +0000 |
commit | 93eb6253fe78567a5334dd45166629dd4c46499a (patch) | |
tree | 901fd700f632db9d4a2f756500907ffbfaef9278 | |
parent | 50bead7636d5e23b1b329901963ad0a3dd0a1a9b (diff) | |
download | qpid-python-93eb6253fe78567a5334dd45166629dd4c46499a.tar.gz |
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
-rw-r--r-- | cpp/src/qpid/sys/posix/AsynchIO.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
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); |