From 9edbbed1adb5b5731ef875f465a346494e639792 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 23 Dec 2010 17:11:17 +0000 Subject: Allow for the case where we get an rdma reject because there is no one listening on the resolved address git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1052326 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/rdma/RdmaIO.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp index e082fdc416..b5cedf3d70 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp @@ -634,10 +634,20 @@ namespace Rdma { break; case RDMA_CM_EVENT_REJECTED: { // CONNECTING - // Extract private data from event - assert(conn_param.private_data && conn_param.private_data_len >= sizeof(NConnectionParams)); - const NConnectionParams* rcp = static_cast(conn_param.private_data); - ConnectionParams cp = *rcp; + + // We can get this event if our peer is not running on the other side + // in this case we could get nearly anything in the private data: + // From private_data == 0 && private_data_len == 0 (Chelsio iWarp) + // to 148 bytes of zeros (Mellanox IB) + // + // So assume that if the the private data is absent or not the size of + // the connection parameters it isn't valid + ConnectionParams cp(0, 0, 0); + if (conn_param.private_data && conn_param.private_data_len == sizeof(NConnectionParams)) { + // Extract private data from event + const NConnectionParams* rcp = static_cast(conn_param.private_data); + cp = *rcp; + } rejectedCallback(ci, cp); break; } -- cgit v1.2.1