From ed0d321d0ad56b9ea3d370d8b6b34fce2c8ef892 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 12 Jun 2012 21:20:07 +0000 Subject: QPID-3603: Introduced RemoteBackup to track backup status. The primary creates RemoteBackup object for each connected or expected backup. On first being promoted, the new primary has a RemoteBackup for each of the known backups at the time of the failure. The RemoteBackup manages queue guards for its backup and tracks it's readiness. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1349540 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/ha/ConnectionObserver.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cpp/src/qpid/ha/ConnectionObserver.cpp') diff --git a/cpp/src/qpid/ha/ConnectionObserver.cpp b/cpp/src/qpid/ha/ConnectionObserver.cpp index 694a253fc3..d121aa1191 100644 --- a/cpp/src/qpid/ha/ConnectionObserver.cpp +++ b/cpp/src/qpid/ha/ConnectionObserver.cpp @@ -21,6 +21,7 @@ #include "ConnectionObserver.h" #include "BrokerInfo.h" +#include "HaBroker.h" #include "qpid/framing/FieldTable.h" #include "qpid/broker/Connection.h" #include "qpid/log/Statement.h" @@ -28,9 +29,10 @@ namespace qpid { namespace ha { -ConnectionObserver::ConnectionObserver(const types::Uuid& uuid) - : logPrefix("HA: "), self(uuid) {} +ConnectionObserver::ConnectionObserver(HaBroker& hb, const types::Uuid& uuid) + : haBroker(hb), logPrefix("HA: "), self(uuid) {} +// FIXME aconway 2012-06-06: move to BrokerInfo bool ConnectionObserver::getBrokerInfo(broker::Connection& connection, BrokerInfo& info) { framing::FieldTable ft; if (connection.getClientProperties().getTable(ConnectionObserver::BACKUP_TAG, ft)) { @@ -58,13 +60,16 @@ void ConnectionObserver::opened(broker::Connection& connection) { return; // No need to call observer, always allow admins. } BrokerInfo info; // Avoid self connections. - if (getBrokerInfo(connection, info) && info.getSystemId() == self) - throw Exception("HA rejected self connection"); + if (getBrokerInfo(connection, info)) { + if (info.getSystemId() == self) + throw Exception("HA rejected self connection"); + } ObserverPtr o(getObserver()); if (o) o->opened(connection); } void ConnectionObserver::closed(broker::Connection& connection) { + BrokerInfo info; ObserverPtr o(getObserver()); if (o) o->closed(connection); } -- cgit v1.2.1