summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2010-10-12 16:04:35 +0000
committerAndrew Stitcher <astitcher@apache.org>2010-10-12 16:04:35 +0000
commitfa5145ec6ac34efdc3009b4a09e945aa446c16fb (patch)
treeaf514630bef6d957bd710f7f62874e25655a52cb
parent6ec176e37fe8731ef7a2a0012256b4d666338692 (diff)
downloadqpid-python-fa5145ec6ac34efdc3009b4a09e945aa446c16fb.tar.gz
Make sure that Rdma::Listener can generate no more callbacks after it receives
a disconnected event for a connection id. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1021818 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
index d5f2816818..fe7062d3ea 100644
--- a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
+++ b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
@@ -564,6 +564,10 @@ namespace Rdma {
ci->listen();
}
+ namespace {
+ const int64_t PoisonContext = -1;
+ }
+
void Listener::connectionEvent(Connection::intrusive_ptr ci) {
ConnectionEvent e(ci->getNextEvent());
@@ -578,6 +582,11 @@ namespace Rdma {
::rdma_conn_param conn_param = e.getConnectionParam();
Rdma::Connection::intrusive_ptr id = e.getConnection();
+ // Check for previous disconnection (it appears that you actually can get connection
+ // request events after a disconnect event in rare circumstances)
+ if (reinterpret_cast<int64_t>(id->getContext<void*>())==PoisonContext)
+ return;
+
switch (eventType) {
case RDMA_CM_EVENT_CONNECT_REQUEST: {
// Make sure peer has sent params we can use
@@ -612,6 +621,9 @@ namespace Rdma {
break;
case RDMA_CM_EVENT_DISCONNECTED:
disconnectedCallback(id);
+ // Poison the id context so that we do no more callbacks on it
+ id->removeContext();
+ id->addContext(reinterpret_cast<void*>(PoisonContext));
break;
case RDMA_CM_EVENT_CONNECT_ERROR:
errorCallback(id, CONNECT_ERROR);