diff options
author | Andrew Stitcher <astitcher@apache.org> | 2010-01-21 06:20:07 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2010-01-21 06:20:07 +0000 |
commit | 5652e2320fff37e65989b6fa9649cc41668fdf85 (patch) | |
tree | b65eb5309b8c15869b716908969c13dde133f4c7 | |
parent | 531cf12f02c8eeac324cfa6876b8f508057fb6ee (diff) | |
download | qpid-python-5652e2320fff37e65989b6fa9649cc41668fdf85.tar.gz |
Throw sync connect failures straight out of AsynchConnector constructor
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@901555 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp b/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp index beb647afe6..d4c64dd814 100644 --- a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp +++ b/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp @@ -144,12 +144,10 @@ class AsynchConnector : public qpid::sys::AsynchConnector, private: void connComplete(DispatchHandle& handle); - void syncFailure(); private: ConnectedCallback connCallback; FailedCallback failCallback; - std::string errMsg; const Socket& socket; public: @@ -176,21 +174,13 @@ AsynchConnector::AsynchConnector(const Socket& s, { socket.setNonblocking(); SocketAddress sa(hostname, boost::lexical_cast<std::string>(port)); - try { - socket.connect(sa); - } catch(std::exception& e) { - // Defer reporting failure till we start polling - errMsg = e.what(); - } + // Note, not catching any exceptions here, also has effect of destructing + socket.connect(sa); } void AsynchConnector::start(Poller::shared_ptr poller) { startWatch(poller); - // If we previously detected an error insert failure callback now - if ( !errMsg.empty() ) { - DispatchHandle::call(boost::bind(&AsynchConnector::syncFailure, this)); - } } void AsynchConnector::connComplete(DispatchHandle& h) @@ -205,13 +195,6 @@ void AsynchConnector::connComplete(DispatchHandle& h) DispatchHandle::doDelete(); } -void AsynchConnector::syncFailure() -{ - DispatchHandle::stopWatch(); - failCallback(socket, -1, errMsg); - DispatchHandle::doDelete(); -} - /* * POSIX version of AsynchIO reader/writer * |