From be6297381c3272178a43940ccf81986073e5ad9f Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 18 Jan 2011 20:43:41 +0000 Subject: QPID-2982 Bug 669452 - Creating a route and using management tools can crash cluster members. Cluster update did not include federation link and bridge objects. Fixed update to include them. Management linkUp and linkDown events were generated only on the broker receiving the link. Suppressed these events in a cluster. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1060568 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/cluster/Connection.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'cpp/src/qpid/cluster/Connection.cpp') diff --git a/cpp/src/qpid/cluster/Connection.cpp b/cpp/src/qpid/cluster/Connection.cpp index 2797fdcf02..c7689577a7 100644 --- a/cpp/src/qpid/cluster/Connection.cpp +++ b/cpp/src/qpid/cluster/Connection.cpp @@ -32,6 +32,8 @@ #include "qpid/broker/RecoveredEnqueue.h" #include "qpid/broker/RecoveredDequeue.h" #include "qpid/broker/Exchange.h" +#include "qpid/broker/Link.h" +#include "qpid/broker/Bridge.h" #include "qpid/broker/Queue.h" #include "qpid/framing/enum.h" #include "qpid/framing/AMQFrame.h" @@ -346,13 +348,12 @@ size_t Connection::decode(const char* data, size_t size) { // returns true if the header is complete or already read. bool Connection::checkProtocolHeader(const char*& data, size_t size) { if (expectProtocolHeader) { - //If this is an outgoing link, we will receive a protocol - //header which needs to be decoded first + // This is an outgoing link connection, we will receive a protocol + // header which needs to be decoded first framing::ProtocolInitiation pi; Buffer buf(const_cast(data), size); if (pi.decode(buf)) { //TODO: check the version is correct - QPID_LOG(debug, "Outgoing clustered link connection received INIT(" << pi << ")"); expectProtocolHeader = false; data += pi.encodedSize(); } else { @@ -650,5 +651,25 @@ void Connection::managementSetupState( agent->setUuid(id); agent->setName(vendor, product, instance); } + +void Connection::config(const std::string& encoded) { + Buffer buf(const_cast(encoded.data()), encoded.size()); + string kind; + buf.getShortString (kind); + if (kind == "link") { + broker::Link::shared_ptr link = + broker::Link::decode(cluster.getBroker().getLinks(), buf); + QPID_LOG(debug, cluster << " updated link " + << link->getHost() << ":" << link->getPort()); + } + else if (kind == "bridge") { + broker::Bridge::shared_ptr bridge = + broker::Bridge::decode(cluster.getBroker().getLinks(), buf); + QPID_LOG(debug, cluster << " updated bridge " << bridge->getName()); + } + else throw Exception(QPID_MSG("Update failed, invalid kind of config: " << kind)); +} + + }} // Namespace qpid::cluster -- cgit v1.2.1