diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2010-05-13 02:26:14 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2010-05-13 02:26:14 +0000 |
| commit | c750570e0e8882542c1226c123903d441e09b4b1 (patch) | |
| tree | 4431a957f82f5a8fb84fb083de77c82237c8b776 /qpid/cpp/src | |
| parent | ea382b5d8f0f081e30b6217d71ef820debb6292e (diff) | |
| download | qpid-python-c750570e0e8882542c1226c123903d441e09b4b1.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@943770 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/sys/rdma/rdma_exception.h | 4 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/sys/rdma/rdma_exception.h b/qpid/cpp/src/qpid/sys/rdma/rdma_exception.h index 7867aef2e4..a3a289e38a 100644 --- a/qpid/cpp/src/qpid/sys/rdma/rdma_exception.h +++ b/qpid/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/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h b/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h index 35843ce8f1..bea5a5d979 100644 --- a/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h +++ b/qpid/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 |
