summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/amqp_0_10/Connection.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-07-30 18:46:17 +0000
committerAlan Conway <aconway@apache.org>2009-07-30 18:46:17 +0000
commit2a2ad630c4a7afeca560977fa71759389eca42ba (patch)
tree7f1400b40545286cb4ff586bf7aadbe72b44f0f0 /cpp/src/qpid/amqp_0_10/Connection.cpp
parentadc8062ac65028c1c3daf07a33b24145200d3e20 (diff)
downloadqpid-python-2a2ad630c4a7afeca560977fa71759389eca42ba.tar.gz
Set protocol versions correctly in cluster code.
Cluster code was broken by a recent checkin to validate protocol versions. The cluster was not correctly setting the version on both sides of a connection. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@799401 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/amqp_0_10/Connection.cpp')
-rw-r--r--cpp/src/qpid/amqp_0_10/Connection.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/cpp/src/qpid/amqp_0_10/Connection.cpp b/cpp/src/qpid/amqp_0_10/Connection.cpp
index c1de5e2dec..96d5146c30 100644
--- a/cpp/src/qpid/amqp_0_10/Connection.cpp
+++ b/cpp/src/qpid/amqp_0_10/Connection.cpp
@@ -31,7 +31,8 @@ namespace amqp_0_10 {
using sys::Mutex;
Connection::Connection(sys::OutputControl& o, const std::string& id, bool _isClient)
- : frameQueueClosed(false), output(o), identifier(id), initialized(false), isClient(_isClient), buffered(0)
+ : frameQueueClosed(false), output(o), identifier(id), initialized(false),
+ isClient(_isClient), buffered(0), version(0,10)
{}
void Connection::setInputHandler(std::auto_ptr<sys::ConnectionInputHandler> c) {
@@ -44,7 +45,9 @@ size_t Connection::decode(const char* buffer, size_t size) {
//read in protocol header
framing::ProtocolInitiation pi;
if (pi.decode(in)) {
- //TODO: check the version is correct
+ if(!(pi==version))
+ throw Exception(QPID_MSG("Unsupported version: " << pi
+ << " supported version " << version));
QPID_LOG(trace, "RECV " << identifier << " INIT(" << pi << ")");
}
initialized = true;
@@ -128,7 +131,11 @@ void Connection::send(framing::AMQFrame& f) {
}
framing::ProtocolVersion Connection::getVersion() const {
- return framing::ProtocolVersion(0,10);
+ return version;
+}
+
+void Connection::setVersion(const framing::ProtocolVersion& v) {
+ version = v;
}
size_t Connection::getBuffered() const {