summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2010-01-21 06:20:07 +0000
committerAndrew Stitcher <astitcher@apache.org>2010-01-21 06:20:07 +0000
commitdc8062b20050b9dca14536ace687e95450a3e67b (patch)
treee7e3e1865f0ee394cf7ec060fea1b701e7ec71f2 /cpp
parent80e2dfa491b0a19b61eff7fa107c9f6a869e50bb (diff)
downloadqpid-python-dc8062b20050b9dca14536ace687e95450a3e67b.tar.gz
Throw sync connect failures straight out of AsynchConnector constructor
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@901555 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/sys/posix/AsynchIO.cpp21
1 files changed, 2 insertions, 19 deletions
diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp
index beb647afe6..d4c64dd814 100644
--- a/cpp/src/qpid/sys/posix/AsynchIO.cpp
+++ b/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
*