Author: aconway
Date: Mon Feb 13 16:17:21 2012
New Revision: 1243574
URL: http://svn.apache.org/viewvc?rev=1243574&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-2/qpid/cpp/src/qpid/broker/Link.cpp
qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Link.h
qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/LinkRegistry.h
Modified: qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Link.cpp
URL:
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Link.cpp?rev=1243574&r1=1243573&r2=1243574&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Link.cpp (original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Link.cpp Mon Feb 13
16:17:21 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-2/qpid/cpp/src/qpid/broker/Link.h
URL:
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Link.h?rev=1243574&r1=1243573&r2=1243574&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Link.h (original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Link.h Mon Feb 13
16:17:21 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-2/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
URL:
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/LinkRegistry.cpp?rev=1243574&r1=1243573&r2=1243574&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
(original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/LinkRegistry.cpp Mon Feb
13 16:17:21 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-2/qpid/cpp/src/qpid/broker/LinkRegistry.h
URL:
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/LinkRegistry.h?rev=1243574&r1=1243573&r2=1243574&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/LinkRegistry.h (original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/LinkRegistry.h Mon Feb
13 16:17:21 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:[email protected]