summaryrefslogtreecommitdiff
path: root/cpp
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
commitc1ceb35c3d386e6bae5bc4dafd4e635805a97451 (patch)
tree47dcb42e15c853141fc1e5082546411817af4db3 /cpp
parentbe370aa96fe220492b6c2fec25e03b38ee87cb05 (diff)
downloadqpid-python-c1ceb35c3d386e6bae5bc4dafd4e635805a97451.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/qpid@1021818 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/sys/rdma/RdmaIO.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp
index d5f2816818..fe7062d3ea 100644
--- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp
+++ b/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);