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/10/12 18:04:35 UTC
svn commit: r1021818 - /qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
Author: astitcher
Date: Tue Oct 12 16:04:35 2010
New Revision: 1021818
URL: http://svn.apache.org/viewvc?rev=1021818&view=rev
Log:
Make sure that Rdma::Listener can generate no more callbacks after it receives
a disconnected event for a connection id.
Modified:
qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
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=1021818&r1=1021817&r2=1021818&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp Tue Oct 12 16:04:35 2010
@@ -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);
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org