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/09/08 18:49:47 UTC

svn commit: r995143 - in /qpid/trunk/qpid/cpp/src/qpid/sys: RdmaIOPlugin.cpp rdma/RdmaIO.cpp rdma/RdmaIO.h

Author: astitcher
Date: Wed Sep  8 16:49:47 2010
New Revision: 995143

URL: http://svn.apache.org/viewvc?rev=995143&view=rev
Log:
Delay daemon side Rdma connection disconnect() so that it happens serialised
to the data channel for the connection.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp?rev=995143&r1=995142&r2=995143&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp Wed Sep  8 16:49:47 2010
@@ -56,6 +56,7 @@ class RdmaIOHandler : public OutputContr
     Rdma::Connection::intrusive_ptr connection;
 
     void write(const framing::ProtocolInitiation&);
+    void disconnectAction();
 
   public:
     RdmaIOHandler(Rdma::Connection::intrusive_ptr c, ConnectionCodec::Factory* f);
@@ -170,7 +171,7 @@ namespace {
     }
 }
 
-void RdmaIOHandler::disconnected() {
+void RdmaIOHandler::disconnectAction() {
     {
     Mutex::ScopedLock l(pollingLock);
     // If we're closed already then we'll get to drained() anyway
@@ -180,6 +181,10 @@ void RdmaIOHandler::disconnected() {
     aio->stop(boost::bind(&stopped, this));
 }
 
+void RdmaIOHandler::disconnected() {
+    aio->requestCallback(boost::bind(&RdmaIOHandler::disconnectAction, this));
+}
+
 void RdmaIOHandler::drained() {
     // We know we've drained the write queue now, but we don't have to do anything
     // because we can rely on the client to disconnect to trigger the connection

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=995143&r1=995142&r2=995143&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp Wed Sep  8 16:49:47 2010
@@ -114,6 +114,20 @@ namespace Rdma {
         nc(*this);
     }
 
+    namespace {
+        void requestedCall(AsynchIO* aio, AsynchIO::RequestCallback callback) {
+            assert(callback);
+            callback(*aio);
+        }
+    }
+
+    void AsynchIO::requestCallback(RequestCallback callback) {
+        // TODO creating a function object every time isn't all that
+        // efficient - if this becomes heavily used do something better (what?)
+        assert(callback);
+        dataHandle.call(boost::bind(&requestedCall, this, callback));
+    }
+
     // Mark writing closed (so we don't accept any more writes or make any idle callbacks)
     void AsynchIO::drainWriteQueue(NotifyCallback nc) {
         State oldState;

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h?rev=995143&r1=995142&r2=995143&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h Wed Sep  8 16:49:47 2010
@@ -65,6 +65,8 @@ namespace Rdma {
         NotifyCallback notifyCallback;
 
     public:
+        typedef boost::function1<void, AsynchIO&> RequestCallback;
+
         // TODO: Instead of specifying a buffer size specify the amount of memory the AsynchIO class can use
         // for buffers both read and write (allocate half to each up front) and fail if we cannot allocate that much
         // locked memory
@@ -87,6 +89,7 @@ namespace Rdma {
         void notifyPendingWrite();
         void drainWriteQueue(NotifyCallback);
         void stop(NotifyCallback);
+        void requestCallback(RequestCallback);
         int incompletedWrites() const;
         Buffer* getBuffer();
         void returnBuffer(Buffer*);



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