summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2010-05-13 02:26:14 +0000
committerAndrew Stitcher <astitcher@apache.org>2010-05-13 02:26:14 +0000
commit31070fa710b1a06e468cc03c486b9c7fbe39e462 (patch)
tree436aa159c3832006929b6939dce672909e8d16a9 /cpp
parenteb92423c6062500d0d9495c37b5ced6dc71f9b68 (diff)
downloadqpid-python-31070fa710b1a06e468cc03c486b9c7fbe39e462.tar.gz
Allow rdma_disconnect() to fail with EINVAL as it appears
to be necessary to call rdma_disconnect() after receiving a disconnection event in Infiniband, but it's not allowed on iWarp as the disconnect event has already disconnected the queue pair. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@943770 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/sys/rdma/rdma_exception.h4
-rw-r--r--cpp/src/qpid/sys/rdma/rdma_wrap.h10
2 files changed, 12 insertions, 2 deletions
diff --git a/cpp/src/qpid/sys/rdma/rdma_exception.h b/cpp/src/qpid/sys/rdma/rdma_exception.h
index 7867aef2e4..a3a289e38a 100644
--- a/cpp/src/qpid/sys/rdma/rdma_exception.h
+++ b/cpp/src/qpid/sys/rdma/rdma_exception.h
@@ -48,6 +48,10 @@ namespace Rdma {
throw Rdma::Exception((rc == -1) ? errno : rc >0 ? rc : -rc);
}
+ inline int GETERR(int rc) {
+ return (rc == -1) ? errno : rc > 0 ? rc : -rc;
+ }
+
inline void CHECK_IBV(int rc) {
if (rc != 0)
throw Rdma::Exception(rc);
diff --git a/cpp/src/qpid/sys/rdma/rdma_wrap.h b/cpp/src/qpid/sys/rdma/rdma_wrap.h
index 35843ce8f1..bea5a5d979 100644
--- a/cpp/src/qpid/sys/rdma/rdma_wrap.h
+++ b/cpp/src/qpid/sys/rdma/rdma_wrap.h
@@ -344,7 +344,7 @@ namespace Rdma {
assert(id.get());
::rdma_cm_event* e;
int rc = ::rdma_get_cm_event(id->channel, &e);
- if (rc == -1 && errno == EAGAIN)
+ if (GETERR(rc) == EAGAIN)
return ConnectionEvent();
CHECK(rc);
return ConnectionEvent(e);
@@ -375,7 +375,13 @@ namespace Rdma {
void disconnect() const {
assert(id.get());
- CHECK(::rdma_disconnect(id.get()));
+ int rc = ::rdma_disconnect(id.get());
+ // iWarp doesn't let you disconnect a disconnected connection
+ // but Infiniband can do so it's okay to call rdma_disconnect()
+ // in response to a disconnect event, but we may get an error
+ if (GETERR(rc) == EINVAL)
+ return;
+ CHECK(rc);
}
// TODO: Currently you can only connect with the default connection parameters