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
diff --git a/qpid/cpp/src/qpid/broker/Bridge.cpp b/qpid/cpp/src/qpid/broker/Bridge.cpp
index 238d1ea..19431ce 100644
--- a/qpid/cpp/src/qpid/broker/Bridge.cpp
+++ b/qpid/cpp/src/qpid/broker/Bridge.cpp
@@ -179,7 +179,7 @@
 /** 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 @@
 
 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 3ece4ba..1137937 100644
--- a/qpid/cpp/src/qpid/broker/Bridge.h
+++ b/qpid/cpp/src/qpid/broker/Bridge.h
@@ -48,7 +48,7 @@
 {
 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 eda24dc..2fd889a 100644
--- a/qpid/cpp/src/qpid/broker/Link.cpp
+++ b/qpid/cpp/src/qpid/broker/Link.cpp
@@ -273,7 +273,7 @@
     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 @@
 
     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 @@
     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 @@
 
 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 7907460..ecb1253 100644
--- a/qpid/cpp/src/qpid/broker/Link.h
+++ b/qpid/cpp/src/qpid/broker/Link.h
@@ -76,7 +76,7 @@
     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 @@
 
   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 0a034ee..8416484 100644
--- a/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
+++ b/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
@@ -220,12 +220,12 @@
 }
 
 /** 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 @@
 }
 
 /** 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 614fb1a..0ee4125 100644
--- a/qpid/cpp/src/qpid/broker/LinkRegistry.h
+++ b/qpid/cpp/src/qpid/broker/LinkRegistry.h
@@ -65,9 +65,9 @@
         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