summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/src/qpid/ha/ConnectionExcluder.cpp15
-rw-r--r--cpp/src/qpid/ha/ConnectionExcluder.h4
-rw-r--r--cpp/src/qpid/ha/HaBroker.cpp2
3 files changed, 14 insertions, 7 deletions
diff --git a/cpp/src/qpid/ha/ConnectionExcluder.cpp b/cpp/src/qpid/ha/ConnectionExcluder.cpp
index 6c413982f8..18b4432aa1 100644
--- a/cpp/src/qpid/ha/ConnectionExcluder.cpp
+++ b/cpp/src/qpid/ha/ConnectionExcluder.cpp
@@ -29,8 +29,8 @@
namespace qpid {
namespace ha {
-ConnectionExcluder::ConnectionExcluder(const LogPrefix& lp)
- : logPrefix(lp), backupAllowed(false) {}
+ConnectionExcluder::ConnectionExcluder(const LogPrefix& lp, const framing::Uuid& uuid)
+ : logPrefix(lp), backupAllowed(false), self(uuid) {}
void ConnectionExcluder::opened(broker::Connection& connection) {
if (connection.isLink()) return; // Allow all outgoing links
@@ -42,9 +42,14 @@ void ConnectionExcluder::opened(broker::Connection& connection) {
framing::FieldTable ft;
if (connection.getClientProperties().getTable(BACKUP_TAG, ft)) {
BrokerInfo info(ft);
- QPID_LOG(debug, logPrefix << "Backup connection " << info <<
- (backupAllowed ? " allowed" : " rejected"));
- if (backupAllowed) return;
+ if (info.getSystemId() == self) {
+ QPID_LOG(debug, logPrefix << "Self connection rejected");
+ }
+ else {
+ QPID_LOG(debug, logPrefix << "Backup connection " << info <<
+ (backupAllowed ? " allowed" : " rejected"));
+ if (backupAllowed) return;
+ }
}
// Abort the connection.
throw Exception(
diff --git a/cpp/src/qpid/ha/ConnectionExcluder.h b/cpp/src/qpid/ha/ConnectionExcluder.h
index 4a2ebcc127..042544c333 100644
--- a/cpp/src/qpid/ha/ConnectionExcluder.h
+++ b/cpp/src/qpid/ha/ConnectionExcluder.h
@@ -24,6 +24,7 @@
#include "LogPrefix.h"
#include "qpid/broker/ConnectionObserver.h"
+#include "qpid/framing/Uuid.h"
#include <boost/function.hpp>
namespace qpid {
@@ -45,7 +46,7 @@ class ConnectionExcluder : public broker::ConnectionObserver
static const std::string ADMIN_TAG;
static const std::string BACKUP_TAG;
- ConnectionExcluder(const LogPrefix&);
+ ConnectionExcluder(const LogPrefix&, const framing::Uuid& self);
void opened(broker::Connection& connection);
@@ -55,6 +56,7 @@ class ConnectionExcluder : public broker::ConnectionObserver
private:
LogPrefix logPrefix;
bool backupAllowed;
+ framing::Uuid self;
};
}} // namespace qpid::ha
diff --git a/cpp/src/qpid/ha/HaBroker.cpp b/cpp/src/qpid/ha/HaBroker.cpp
index 32261c560d..71995c1ac2 100644
--- a/cpp/src/qpid/ha/HaBroker.cpp
+++ b/cpp/src/qpid/ha/HaBroker.cpp
@@ -53,7 +53,7 @@ HaBroker::HaBroker(broker::Broker& b, const Settings& s)
settings(s),
mgmtObject(0),
status(STANDALONE),
- excluder(new ConnectionExcluder(logPrefix)),
+ excluder(new ConnectionExcluder(logPrefix, broker.getSystem()->getSystemId())),
brokerInfo(broker.getSystem()->getNodeName(),
broker.getSystem()->getSystemId())