You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2012/02/14 17:10:22 UTC
svn commit: r1244092 - in
/qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker: Link.cpp Link.h
LinkRegistry.cpp LinkRegistry.h
Author: aconway
Date: Tue Feb 14 16:10:22 2012
New Revision: 1244092
URL: http://svn.apache.org/viewvc?rev=1244092&view=rev
Log:
QPID-3603: Set known hosts at connection open in Link.
Formerly were being set during periodic maintenance.
Modified:
qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.cpp
qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.h
qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.h
Modified: qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.cpp?rev=1244092&r1=1244091&r2=1244092&view=diff
==============================================================================
--- qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.cpp (original)
+++ qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.cpp Tue Feb 14 16:10:22 2012
@@ -64,7 +64,6 @@ Link::Link(LinkRegistry* _links,
visitCount(0),
currentInterval(1),
closing(false),
- updateUrls(false),
channelCounter(1),
connection(0),
agent(0)
@@ -147,7 +146,14 @@ void Link::established ()
}
}
-void Link::closed (int, std::string text)
+void Link::opened() {
+ Mutex::ScopedLock mutex(lock);
+ assert(connection);
+ urls.reset(connection->getKnownHosts());
+ QPID_LOG(debug, "Known hosts for peer of inter-broker link: " << urls);
+}
+
+void Link::closed(int, std::string text)
{
Mutex::ScopedLock mutex(lock);
QPID_LOG (info, "Inter-broker link disconnected from " << host << ":" << port << " " << text);
@@ -287,7 +293,6 @@ void Link::setConnection(Connection* c)
{
Mutex::ScopedLock mutex(lock);
connection = c;
- updateUrls = true;
// Process any IO tasks bridges added before setConnection.
connection->requestIOProcessing (boost::bind(&Link::ioThreadProcessing, this));
}
@@ -296,12 +301,6 @@ void Link::maintenanceVisit ()
{
Mutex::ScopedLock mutex(lock);
- if (connection && updateUrls) {
- urls.reset(connection->getKnownHosts());
- QPID_LOG(debug, "Known hosts for peer of inter-broker link: " << urls);
- updateUrls = false;
- }
-
if (state == STATE_WAITING)
{
visitCount++;
Modified: qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.h
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.h?rev=1244092&r1=1244091&r2=1244092&view=diff
==============================================================================
--- qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.h (original)
+++ qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/Link.h Tue Feb 14 16:10:22 2012
@@ -61,7 +61,6 @@ namespace qpid {
uint32_t currentInterval;
bool closing;
RetryList urls;
- bool updateUrls;
typedef std::vector<Bridge::shared_ptr> Bridges;
Bridges created; // Bridges pending creation
@@ -113,7 +112,8 @@ namespace qpid {
void add(Bridge::shared_ptr);
void cancel(Bridge::shared_ptr);
- void established(); // Called when connection is created
+ void established(); // Called when connection is create
+ void opened(); // Called when connection is open (after create)
void closed(int, std::string); // Called when connection goes away
void setConnection(Connection*); // Set pointer to the AMQP Connection
void reconnect(const Address&); //called by LinkRegistry
Modified: qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.cpp?rev=1244092&r1=1244091&r2=1244092&view=diff
==============================================================================
--- qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.cpp (original)
+++ qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.cpp Tue Feb 14 16:10:22 2012
@@ -53,6 +53,7 @@ struct ConnectionObserverImpl : public C
LinkRegistry& links;
ConnectionObserverImpl(LinkRegistry& l) : links(l) {}
void connection(Connection& c) { links.notifyConnection(c.getMgmtId(), &c); }
+ void opened(Connection& c) { links.notifyOpened(c.getMgmtId()); }
void closed(Connection& c) { links.notifyClosed(c.getMgmtId()); }
void forced(Connection& c, const string& text) { links.notifyConnectionForced(c.getMgmtId(), text); }
};
@@ -297,6 +298,12 @@ void LinkRegistry::notifyConnection(cons
}
}
+void LinkRegistry::notifyOpened(const std::string& key)
+{
+ Link::shared_ptr link = findLink(key);
+ if (link) link->opened();
+}
+
void LinkRegistry::notifyClosed(const std::string& key)
{
Link::shared_ptr link = findLink(key);
Modified: qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.h
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.h?rev=1244092&r1=1244091&r2=1244092&view=diff
==============================================================================
--- qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.h (original)
+++ qpid/branches/qpid-3603-6/qpid/cpp/src/qpid/broker/LinkRegistry.h Tue Feb 14 16:10:22 2012
@@ -132,6 +132,7 @@ namespace broker {
MessageStore* getStore() const;
void notifyConnection (const std::string& key, Connection* c);
+ void notifyOpened (const std::string& key);
void notifyClosed (const std::string& key);
void notifyConnectionForced (const std::string& key, const std::string& text);
std::string getAuthMechanism (const std::string& key);
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org