summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2009-10-09 03:37:54 +0000
committerAndrew Stitcher <astitcher@apache.org>2009-10-09 03:37:54 +0000
commit972be535e65b3bb056ce1633543b1283a2408c28 (patch)
treefca7fad8ac4794162f9f61d0812d49a3037b2088 /cpp/src
parent9bc22655d98fe44ea7fc7319d2040fc1133d376c (diff)
downloadqpid-python-972be535e65b3bb056ce1633543b1283a2408c28.tar.gz
Change TCP AsynchConnector so that it returns all failures asynchronously
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@823388 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/sys/posix/AsynchIO.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp
index 31011d6f53..b389e6ca61 100644
--- a/cpp/src/qpid/sys/posix/AsynchIO.cpp
+++ b/cpp/src/qpid/sys/posix/AsynchIO.cpp
@@ -166,6 +166,7 @@ private:
private:
ConnectedCallback connCallback;
FailedCallback failCallback;
+ std::string errMsg;
const Socket& socket;
public:
@@ -194,10 +195,14 @@ AsynchConnector::AsynchConnector(const Socket& s,
socket.setNonblocking();
try {
socket.connect(hostname, port);
- startWatch(poller);
} catch(std::exception& e) {
- failure(-1, e.what());
+ // Defer reporting failure
+ startWatch(poller);
+ errMsg = e.what();
+ DispatchHandle::call(boost::bind(&AsynchConnector::failure, this, -1, errMsg));
+ return;
}
+ startWatch(poller);
}
void AsynchConnector::connComplete(DispatchHandle& h)