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/UpdateClient.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid/cluster/UpdateClient.cpp') diff --git a/cpp/src/qpid/cluster/UpdateClient.cpp b/cpp/src/qpid/cluster/UpdateClient.cpp index 59db4de526..e5d20c85e6 100644 --- a/cpp/src/qpid/cluster/UpdateClient.cpp +++ b/cpp/src/qpid/cluster/UpdateClient.cpp @@ -34,6 +34,9 @@ #include "qpid/broker/Broker.h" #include "qpid/broker/Queue.h" #include "qpid/broker/QueueRegistry.h" +#include "qpid/broker/LinkRegistry.h" +#include "qpid/broker/Bridge.h" +#include "qpid/broker/Link.h" #include "qpid/broker/Message.h" #include "qpid/broker/Exchange.h" #include "qpid/broker/ExchangeRegistry.h" @@ -167,7 +170,7 @@ void UpdateClient::update() { b.getQueues().eachQueue(boost::bind(&UpdateClient::updateQueueListeners, this, _1)); ClusterConnectionProxy(session).expiryId(expiry.getId()); - + updateLinks(); updateManagementAgent(); session.close(); @@ -199,6 +202,14 @@ template std::string encode(const T& t) { t.encode(buf); return encoded; } + +template std::string encode(const T& t, bool encodeKind) { + std::string encoded; + encoded.resize(t.encodedSize()); + framing::Buffer buf(const_cast(encoded.data()), encoded.size()); + t.encode(buf, encodeKind); + return encoded; +} } // namespace @@ -583,4 +594,21 @@ void UpdateClient::updateQueueListener(std::string& q, ClusterConnectionProxy(session).addQueueListener(q, n); } +void UpdateClient::updateLinks() { + broker::LinkRegistry& links = updaterBroker.getLinks(); + links.eachLink(boost::bind(&UpdateClient::updateLink, this, _1)); + links.eachBridge(boost::bind(&UpdateClient::updateBridge, this, _1)); +} + +void UpdateClient::updateLink(const boost::shared_ptr& link) { + QPID_LOG(debug, *this << " updating link " + << link->getHost() << ":" << link->getPort()); + ClusterConnectionProxy(session).config(encode(*link)); +} + +void UpdateClient::updateBridge(const boost::shared_ptr& bridge) { + QPID_LOG(debug, *this << " updating bridge " << bridge->getName()); + ClusterConnectionProxy(session).config(encode(*bridge)); +} + }} // namespace qpid::cluster -- cgit v1.2.1