diff options
author | Andrew Stitcher <astitcher@apache.org> | 2011-08-22 21:54:00 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2011-08-22 21:54:00 +0000 |
commit | d44a0e0d2535e6dbc02f123cbae1b0b9749982bd (patch) | |
tree | 83f9187fa6cf25de242fff24c0f5e846a412d05e | |
parent | 816a5c01618505158a6e295fc5e9b3946193579c (diff) | |
download | qpid-python-d44a0e0d2535e6dbc02f123cbae1b0b9749982bd.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@1160458 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp b/qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp index c5cc86c813..85d8c1db87 100644 --- a/qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp +++ b/qpid/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 |