You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2013/02/09 23:01:30 UTC

svn commit: r1444451 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp

Author: tabish
Date: Sat Feb  9 22:01:30 2013
New Revision: 1444451

URL: http://svn.apache.org/r1444451
Log:
https://issues.apache.org/jira/browse/AMQCPP-457

Better control over Transport start and stop.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp?rev=1444451&r1=1444450&r2=1444451&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp Sat Feb  9 22:01:30 2013
@@ -228,17 +228,23 @@ void TransportFilter::close() {
 
     try {
 
-        if (this->impl->closed.compareAndSet(false, true)) {
+        IOException error;
+        bool hasException = false;
+
+        try {
+            stop();
+        } catch (IOException& ex) {
+            error = ex;
+            error.setMark(__FILE__, __LINE__);
+            hasException = true;
+        }
 
-            this->impl->started.set(false);
+        if (this->impl->closed.compareAndSet(false, true)) {
 
             if (this->next == NULL) {
                 throw decaf::io::IOException(__FILE__, __LINE__, "Transport chain is invalid");
             }
 
-            IOException error;
-            bool hasException = false;
-
             next->setTransportListener(NULL);
 
             try {
@@ -256,10 +262,10 @@ void TransportFilter::close() {
                 error.setMark(__FILE__, __LINE__);
                 hasException = true;
             }
+        }
 
-            if (hasException) {
-                throw error;
-            }
+        if (hasException) {
+            throw error;
         }
     }
     AMQ_CATCH_RETHROW(IOException)