summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2012-04-19 14:06:49 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2012-04-19 14:06:49 +0000
commitd12b91bcc48f166c7676cdbff37cda6ed98595ec (patch)
treec07f7d134b470879b7f00dab49450ade6d14eb3f
parentb6898e94e21d7d9b3b883b2bb88298201dbe54f3 (diff)
downloadqpid-python-d12b91bcc48f166c7676cdbff37cda6ed98595ec.tar.gz
QPID-3767: apply code review suggestions.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3767@1327953 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/broker/Bridge.cpp8
-rw-r--r--qpid/cpp/src/qpid/broker/Bridge.h2
-rw-r--r--qpid/cpp/src/qpid/broker/Link.cpp10
-rw-r--r--qpid/cpp/src/qpid/broker/Link.h4
-rw-r--r--qpid/cpp/src/qpid/broker/LinkRegistry.cpp12
-rw-r--r--qpid/cpp/src/qpid/broker/LinkRegistry.h4
6 files changed, 20 insertions, 20 deletions
diff --git a/qpid/cpp/src/qpid/broker/Bridge.cpp b/qpid/cpp/src/qpid/broker/Bridge.cpp
index 238d1ead6a..19431ce6ab 100644
--- a/qpid/cpp/src/qpid/broker/Bridge.cpp
+++ b/qpid/cpp/src/qpid/broker/Bridge.cpp
@@ -179,7 +179,7 @@ void Bridge::closed()
/** Shut down the bridge */
void Bridge::close()
{
- listener(name); // ask the LinkRegistry to destroy us
+ listener(this); // ask the LinkRegistry to destroy us
}
bool Bridge::isSessionReady() const
@@ -280,9 +280,9 @@ void Bridge::encode(Buffer& buffer) const
uint32_t Bridge::encodedSize() const
{
- return ENCODED_IDENTIFIER.length() + 1 // +1 byte length
- + name.length() + 1
- + link->getName().length() + 1
+ return ENCODED_IDENTIFIER.size() + 1 // +1 byte length
+ + name.size() + 1
+ + link->getName().size() + 1
+ 1 // durable
+ args.i_src.size() + 1
+ args.i_dest.size() + 1
diff --git a/qpid/cpp/src/qpid/broker/Bridge.h b/qpid/cpp/src/qpid/broker/Bridge.h
index 3ece4ba47c..1137937493 100644
--- a/qpid/cpp/src/qpid/broker/Bridge.h
+++ b/qpid/cpp/src/qpid/broker/Bridge.h
@@ -48,7 +48,7 @@ class Bridge : public PersistableConfig, public management::Manageable, public E
{
public:
typedef boost::shared_ptr<Bridge> shared_ptr;
- typedef boost::function<void(const std::string&)> CancellationListener;
+ typedef boost::function<void(Bridge*)> CancellationListener;
typedef boost::function<void(Bridge&, SessionHandler&)> InitializeCallback;
Bridge(const std::string& name, Link* link, framing::ChannelId id, CancellationListener l,
diff --git a/qpid/cpp/src/qpid/broker/Link.cpp b/qpid/cpp/src/qpid/broker/Link.cpp
index eda24dc302..2fd889a9d9 100644
--- a/qpid/cpp/src/qpid/broker/Link.cpp
+++ b/qpid/cpp/src/qpid/broker/Link.cpp
@@ -273,7 +273,7 @@ void Link::destroy ()
for (Bridges::iterator i = toDelete.begin(); i != toDelete.end(); i++)
(*i)->close();
toDelete.clear();
- listener(name); // notify LinkRegistry that this Link has been destroyed
+ listener(this); // notify LinkRegistry that this Link has been destroyed
}
void Link::add(Bridge::shared_ptr bridge)
@@ -380,7 +380,7 @@ void Link::reconnectLH(const Address& a)
if (!hideManagement()) {
stringstream errorString;
- errorString << "Failing over to '" << transport << ":" << host << ":" << port <<"'";
+ errorString << "Failing over to " << a;
mgmtObject->set_lastError(errorString.str());
mgmtObject->set_host(host);
mgmtObject->set_port(port);
@@ -395,7 +395,7 @@ bool Link::tryFailoverLH() {
if (url.empty()) return false;
Address next = url[reconnectNext++];
if (next.host != host || next.port != port || next.protocol != transport) {
- QPID_LOG(notice, "Inter-broker link '" << name << "' failing over to " << next.host << ":" << next.port);
+ QPID_LOG(notice, "Inter-broker link '" << name << "' failing over to " << next);
reconnectLH(next);
return true;
}
@@ -490,8 +490,8 @@ void Link::encode(Buffer& buffer) const
uint32_t Link::encodedSize() const
{
- return ENCODED_IDENTIFIER.length() + 1 // +1 byte length
- + name.length() + 1
+ return ENCODED_IDENTIFIER.size() + 1 // +1 byte length
+ + name.size() + 1
+ host.size() + 1 // short-string (host)
+ 5 // short-string ("link")
+ 2 // port
diff --git a/qpid/cpp/src/qpid/broker/Link.h b/qpid/cpp/src/qpid/broker/Link.h
index 7907460721..ecb1253522 100644
--- a/qpid/cpp/src/qpid/broker/Link.h
+++ b/qpid/cpp/src/qpid/broker/Link.h
@@ -76,7 +76,7 @@ class Link : public PersistableConfig, public management::Manageable {
uint channelCounter;
Connection* connection;
management::ManagementAgent* agent;
- boost::function<void(const std::string&)> listener;
+ boost::function<void(Link*)> listener;
boost::intrusive_ptr<sys::TimerTask> timerTask;
@@ -106,7 +106,7 @@ class Link : public PersistableConfig, public management::Manageable {
public:
typedef boost::shared_ptr<Link> shared_ptr;
- typedef boost::function<void(const std::string&)> DestroyedListener;
+ typedef boost::function<void(Link*)> DestroyedListener;
Link(const std::string& name,
LinkRegistry* links,
diff --git a/qpid/cpp/src/qpid/broker/LinkRegistry.cpp b/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
index 0a034ee206..84164841e7 100644
--- a/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
+++ b/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
@@ -220,12 +220,12 @@ pair<Bridge::shared_ptr, bool> LinkRegistry::declare(const std::string& name,
}
/** called back by the link when it has completed its cleanup and can be removed. */
-void LinkRegistry::linkDestroyed(const std::string& name)
+void LinkRegistry::linkDestroyed(Link *link)
{
- QPID_LOG(debug, "LinkRegistry::destroy(); link= " << name);
+ QPID_LOG(debug, "LinkRegistry::destroy(); link= " << link->getName());
Mutex::ScopedLock locker(lock);
- LinkMap::iterator i = links.find(name);
+ LinkMap::iterator i = links.find(link->getName());
if (i != links.end())
{
if (i->second->isDurable() && store)
@@ -235,12 +235,12 @@ void LinkRegistry::linkDestroyed(const std::string& name)
}
/** called back by bridge when its destruction has been requested */
-void LinkRegistry::destroyBridge(const std::string& name)
+void LinkRegistry::destroyBridge(Bridge *bridge)
{
- QPID_LOG(debug, "LinkRegistry::destroy(); bridge= " << name);
+ QPID_LOG(debug, "LinkRegistry::destroy(); bridge= " << bridge->getName());
Mutex::ScopedLock locker(lock);
- BridgeMap::iterator b = bridges.find(name);
+ BridgeMap::iterator b = bridges.find(bridge->getName());
if (b == bridges.end())
return;
diff --git a/qpid/cpp/src/qpid/broker/LinkRegistry.h b/qpid/cpp/src/qpid/broker/LinkRegistry.h
index 614fb1ab3e..0ee4125192 100644
--- a/qpid/cpp/src/qpid/broker/LinkRegistry.h
+++ b/qpid/cpp/src/qpid/broker/LinkRegistry.h
@@ -65,9 +65,9 @@ namespace broker {
friend class LinkRegistryConnectionObserver;
/** Notify the registry that a Link has been destroyed */
- void linkDestroyed(const std::string& name);
+ void linkDestroyed(Link*);
/** Request to destroy a Bridge */
- void destroyBridge(const std::string& name);
+ void destroyBridge(Bridge*);
public:
QPID_BROKER_EXTERN LinkRegistry (); // Only used in store tests