Author: astitcher
Date: Wed Sep 8 16:49:37 2010
New Revision: 995141
URL: http://svn.apache.org/viewvc?rev=995141&view=rev
Log:
Only delete Rdma server side connections when the client disconnects -
this avoids a race between the disconnect event and deleting the connection
upon closing.
Modified:
qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp
qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.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=995141&r1=995140&r2=995141&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:37 2010
@@ -123,9 +123,6 @@ void RdmaIOHandler::write(const framing:
}
void RdmaIOHandler::close() {
- Mutex::ScopedLock l(pollingLock);
- if (!polling) return;
- polling = false;
aio->drainWriteQueue(boost::bind(&RdmaIOHandler::drained, this));
}
@@ -167,6 +164,12 @@ void RdmaIOHandler::error(Rdma::AsynchIO
disconnected();
}
+namespace {
+ void stopped(RdmaIOHandler* async) {
+ delete async;
+ }
+}
+
void RdmaIOHandler::disconnected() {
{
Mutex::ScopedLock l(pollingLock);
@@ -174,18 +177,13 @@ void RdmaIOHandler::disconnected() {
if (!polling) return;
polling = false;
}
- drained();
-}
-
-namespace {
- void stopped(RdmaIOHandler* async) {
- delete async;
- }
+ aio->stop(boost::bind(&stopped, this));
}
void RdmaIOHandler::drained() {
- assert(!polling);
- aio->stop(boost::bind(&stopped, this));
+ // 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
+ // cleanup.
}
void RdmaIOHandler::full(Rdma::AsynchIO&) {
@@ -325,6 +323,8 @@ void RdmaIOProtocolFactory::disconnected
// If we've got a connection already tear it down, otherwise ignore
RdmaIOHandler* async = ci->getContext<RdmaIOHandler>();
if (async) {
+ // Make sure we don't disconnect more than once
+ ci->removeContext();
async->disconnected();
}
}
Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h?rev=995141&r1=995140&r2=995141&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h Wed Sep 8 16:49:37 2010
@@ -225,6 +225,10 @@ namespace Rdma {
context = c;
}
+ void removeContext() {
+ context = 0;
+ }
+
template <typename T>
T* getContext() {
return static_cast<T*>(context);
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org