summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/Connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/cluster/Connection.cpp')
-rw-r--r--cpp/src/qpid/cluster/Connection.cpp37
1 files changed, 4 insertions, 33 deletions
diff --git a/cpp/src/qpid/cluster/Connection.cpp b/cpp/src/qpid/cluster/Connection.cpp
index ff855eef18..6a219072e4 100644
--- a/cpp/src/qpid/cluster/Connection.cpp
+++ b/cpp/src/qpid/cluster/Connection.cpp
@@ -808,48 +808,19 @@ void Connection::config(const std::string& encoded) {
else throw Exception(QPID_MSG("Update failed, invalid kind of config: " << kind));
}
-namespace {
- // find a Link that matches the given Address
- class LinkFinder {
- qpid::Address id;
- boost::shared_ptr<broker::Link> link;
- public:
- LinkFinder(const qpid::Address& _id) : id(_id) {}
- boost::shared_ptr<broker::Link> getLink() { return link; }
- void operator() (boost::shared_ptr<broker::Link> l)
- {
- if (!link) {
- qpid::Address addr(l->getTransport(), l->getHost(), l->getPort());
- if (id == addr) {
- link = l;
- }
- }
- }
- };
-}
-
void Connection::internalState(const std::string& type,
const std::string& name,
const framing::FieldTable& state)
{
if (type == "link") {
- // name is the string representation of the Link's _configured_ destination address
- Url dest;
- try {
- dest = name;
- } catch(...) {
- throw Exception(QPID_MSG("Update failed, invalid format for Link destination address: " << name));
- }
- assert(dest.size());
- LinkFinder finder(dest[0]);
- cluster.getBroker().getLinks().eachLink(boost::ref(finder));
- if (finder.getLink()) {
+ boost::shared_ptr<qpid::broker::Link> link(cluster.getBroker().getLinks().getLink(name));
+ if (link.get()) {
try {
- finder.getLink()->setState(state);
+ link->setState(state);
} catch(...) {
throw Exception(QPID_MSG("Update failed, invalid state for Link " << name << ", state: " << state));
}
- QPID_LOG(debug, cluster << " updated link " << dest[0] << " with state: " << state);
+ QPID_LOG(debug, cluster << " updated link " << name << " with state: " << state);
} else throw Exception(QPID_MSG("Update failed, unable to find Link named: " << name));
}
else throw Exception(QPID_MSG("Update failed, invalid object type for internal state replication: " << type));