qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1160458 - /qpid/trunk/qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp
Date Mon, 22 Aug 2011 21:54:00 GMT
Author: astitcher
Date: Mon Aug 22 21:54:00 2011
New Revision: 1160458

URL: http://svn.apache.org/viewvc?rev=1160458&view=rev
Log:
QPID-3447: Creating invalid federation link causes file descriptor leak
- Previously we weren't correctly handling synchronous errors when we
  attempted to connect.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp?rev=1160458&r1=1160457&r2=1160458&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp Mon Aug 22 21:54:00 2011
@@ -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



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message