From 6580b2f89fe3e2b5aae21bab83ffaefa38d04eff Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 23 Dec 2010 17:11:02 +0000 Subject: Reject attempts to connect with version of rdma protocol we don't understand git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1052324 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/rdma/RdmaIO.cpp | 16 +++++++++++++++- cpp/src/qpid/sys/rdma/RdmaIO.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp index 889544601f..b47165a302 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp @@ -22,7 +22,7 @@ #include "qpid/log/Statement.h" -#include +#include #include using qpid::sys::SocketAddress; @@ -69,6 +69,18 @@ namespace Rdma { }; # pragma pack(pop) + class IOException : public std::exception { + std::string s; + + public: + IOException(std::string s0): s(s0) {} + ~IOException() throw() {} + + const char* what() const throw() { + return s.c_str(); + } + }; + AsynchIO::AsynchIO( QueuePair::intrusive_ptr q, int version, @@ -97,6 +109,8 @@ namespace Rdma { errorCallback(ec), pendingWriteAction(boost::bind(&AsynchIO::writeEvent, this)) { + if (protocolVersion > maxSupportedProtocolVersion) + throw IOException("Unsupported Rdma Protocol"); qp->nonblocking(); qp->notifyRecv(); qp->notifySend(); diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.h b/cpp/src/qpid/sys/rdma/RdmaIO.h index 7a72feba4c..3a543e8ad6 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.h +++ b/cpp/src/qpid/sys/rdma/RdmaIO.h @@ -98,6 +98,8 @@ namespace Rdma { void returnBuffer(Buffer*); private: + const static int maxSupportedProtocolVersion = 0; + // Constants for the peer-peer command messages // These are sent in the high bits if the imm data of an rdma message // The low bits are used to send the credit -- cgit v1.2.1