You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2010/06/14 16:50:17 UTC

svn commit: r954492 - in /qpid/trunk/qpid/cpp/src/qpid: client/RdmaConnector.cpp sys/rdma/RdmaIO.cpp

Author: astitcher
Date: Mon Jun 14 14:50:16 2010
New Revision: 954492

URL: http://svn.apache.org/viewvc?rev=954492&view=rev
Log:
In Rdma::AsynchIO::stop():
- make sure we stop the underlying handle immediately whether or not
  we do the stopped callback now or have to defer it.

In qpid::client::RdmaConnector:
- make sure that the shutdown handler is called under all circumstances.
- make sure that the destructor doesn't delete the aio if it is
  already deleted

Modified:
    qpid/trunk/qpid/cpp/src/qpid/client/RdmaConnector.cpp
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/client/RdmaConnector.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/RdmaConnector.cpp?rev=954492&r1=954491&r2=954492&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/RdmaConnector.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/RdmaConnector.cpp Mon Jun 14 14:50:16 2010
@@ -162,7 +162,12 @@ namespace {
 RdmaConnector::~RdmaConnector() {
     QPID_LOG(debug, "~RdmaConnector " << identifier);
     close();
-    if (aio) aio->stop(deleteAsynchIO);
+    if (aio) {
+        aio->stop(deleteAsynchIO);
+    }
+    if (shutdownHandler) {
+        shutdownHandler->shutdown();
+    }
 }
 
 void RdmaConnector::connect(const std::string& host, int port){
@@ -244,15 +249,21 @@ void RdmaConnector::dataError(Rdma::Asyn
     drained();
 }
 
-void RdmaConnector::stopped(Rdma::AsynchIO* aio) {
-    delete aio;
+void RdmaConnector::stopped(Rdma::AsynchIO* a) {
+    QPID_LOG(debug, "RdmaConnector::stopped " << identifier);
+    assert(!polling);
+    aio = 0;
+    delete a;
     if (shutdownHandler) {
-        shutdownHandler->shutdown();
+        ShutdownHandler* s = shutdownHandler;
+        shutdownHandler = 0;
+        s->shutdown();
     }
 }
 
 void RdmaConnector::drained() {
     QPID_LOG(debug, "RdmaConnector::drained " << identifier);
+    assert(!polling);
     if (aio) {
         aio->stop(boost::bind(&RdmaConnector::stopped, this, aio));
         aio = 0;

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp?rev=954492&r1=954491&r2=954492&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp Mon Jun 14 14:50:16 2010
@@ -117,11 +117,14 @@ namespace Rdma {
             newState = SHUTDOWN;
 
         } while (!state.boolCompareAndSwap(oldState, newState));
+        
+        // Ensure we can't get any more callbacks (except for the stopped callback)
+        dataHandle.stopWatch();
+
         if (doReturn) {
             notifyCallback = nc;
             return;
         }
-        dataHandle.stopWatch();
         // Callback, but don't store it - SHUTDOWN state means callback has been called
         // we *are* allowed to delete the AsynchIO in this callback, so we have to return immediately
         // after the callback
@@ -473,7 +476,6 @@ namespace Rdma {
     }
 
     void AsynchIO::doStoppedCallback() {
-        dataHandle.stopWatch();
         NotifyCallback nc;
         nc.swap(notifyCallback);
         // Transition unconditionally to SHUTDOWN



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