diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2010-12-23 17:11:02 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2010-12-23 17:11:02 +0000 |
| commit | 6580b2f89fe3e2b5aae21bab83ffaefa38d04eff (patch) | |
| tree | 33c4ae0a25eee470c091c328a5483484aa581321 /cpp/src/qpid | |
| parent | d94c35aabe03b0c639e502db2c49c3711784ebfb (diff) | |
| download | qpid-python-6580b2f89fe3e2b5aae21bab83ffaefa38d04eff.tar.gz | |
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
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/sys/rdma/RdmaIO.cpp | 16 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/rdma/RdmaIO.h | 2 |
2 files changed, 17 insertions, 1 deletions
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 <iostream> +#include <string> #include <boost/bind.hpp> 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 |
