summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2011-08-22 21:54:00 +0000
committerAndrew Stitcher <astitcher@apache.org>2011-08-22 21:54:00 +0000
commit94d664ca0e70489a38d6791b2768babc10f222e5 (patch)
treef22966ada5ebb6ff0f658cbbc7a03986edfbe6f2 /cpp/src/qpid/sys
parentbff3ee2f942c5bd02e7497e55d25a5fa9a742654 (diff)
downloadqpid-python-94d664ca0e70489a38d6791b2768babc10f222e5.tar.gz
QPID-3447: Creating invalid federation link causes file descriptor leak
- Previously we weren't correctly handling synchronous errors when we attempted to connect. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1160458 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys')
-rw-r--r--cpp/src/qpid/sys/TCPIOPlugin.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/TCPIOPlugin.cpp b/cpp/src/qpid/sys/TCPIOPlugin.cpp
index c5cc86c813..85d8c1db87 100644
--- a/cpp/src/qpid/sys/TCPIOPlugin.cpp
+++ b/cpp/src/qpid/sys/TCPIOPlugin.cpp
@@ -164,6 +164,7 @@ void AsynchIOProtocolFactory::connect(
// shutdown. The allocated AsynchConnector frees itself when it
// is no longer needed.
Socket* socket = new Socket();
+ try {
AsynchConnector* c = AsynchConnector::create(
*socket,
host,
@@ -173,6 +174,12 @@ void AsynchIOProtocolFactory::connect(
boost::bind(&AsynchIOProtocolFactory::connectFailed,
this, _1, _2, _3, failed));
c->start(poller);
+ } catch (std::exception&) {
+ // TODO: Design question - should we do the error callback and also throw?
+ int errCode = socket->getError();
+ connectFailed(*socket, errCode, strError(errCode), failed);
+ throw;
+ }
}
}} // namespace qpid::sys