summaryrefslogtreecommitdiff
path: root/qpid/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
commit8d4ae932d251fbe3ba7b078eb8c28e466dfcc100 (patch)
tree86fae01c7c7199ec299d19cbc0ff447b3e21a2a6 /qpid/cpp/src
parent9ddb1be179509be8f57753e27c4c7e9ab36ef715 (diff)
downloadqpid-python-8d4ae932d251fbe3ba7b078eb8c28e466dfcc100.tar.gz
Change TCP AsynchConnector so that it returns all failures asynchronously
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@823388 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp b/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
index 31011d6f53..b389e6ca61 100644
--- a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
+++ b/qpid/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)