mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-01 19:04:39 +02:00
ApiListener#RelayMessageOne(): log to which Endpoint messages are relayed
if they're for our parent Zone.
This commit is contained in:
parent
fc70825cb2
commit
e8da951c1f
@ -1226,11 +1226,12 @@ bool ApiListener::RelayMessageOne(const Zone::Ptr& targetZone, const MessageOrig
|
|||||||
ASSERT(targetZone);
|
ASSERT(targetZone);
|
||||||
|
|
||||||
Zone::Ptr localZone = Zone::GetLocalZone();
|
Zone::Ptr localZone = Zone::GetLocalZone();
|
||||||
|
auto parentZone (localZone->GetParent());
|
||||||
|
|
||||||
/* only relay the message to a) the same local zone, b) the parent zone and c) direct child zones. Exception is a global zone. */
|
/* only relay the message to a) the same local zone, b) the parent zone and c) direct child zones. Exception is a global zone. */
|
||||||
if (!targetZone->GetGlobal() &&
|
if (!targetZone->GetGlobal() &&
|
||||||
targetZone != localZone &&
|
targetZone != localZone &&
|
||||||
targetZone != localZone->GetParent() &&
|
targetZone != parentZone &&
|
||||||
targetZone->GetParent() != localZone) {
|
targetZone->GetParent() != localZone) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1309,12 +1310,26 @@ bool ApiListener::RelayMessageOne(const Zone::Ptr& targetZone, const MessageOrig
|
|||||||
bool isMaster = (currentZoneMaster == localEndpoint);
|
bool isMaster = (currentZoneMaster == localEndpoint);
|
||||||
|
|
||||||
if (!isMaster && targetEndpoint != currentZoneMaster) {
|
if (!isMaster && targetEndpoint != currentZoneMaster) {
|
||||||
|
if (currentTargetZone == parentZone) {
|
||||||
|
if (m_CurrentParentEndpoint.exchange(currentZoneMaster.get()) != currentZoneMaster.get()) {
|
||||||
|
Log(LogInformation, "ApiListener") << "Relaying messages for parent Zone '"
|
||||||
|
<< parentZone->GetName() << "' to Endpoint '" << currentZoneMaster->GetName() << "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
skippedEndpoints.push_back(targetEndpoint);
|
skippedEndpoints.push_back(targetEndpoint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
relayed = true;
|
relayed = true;
|
||||||
|
|
||||||
|
if (currentTargetZone == parentZone) {
|
||||||
|
if (m_CurrentParentEndpoint.exchange(targetEndpoint.get()) != targetEndpoint.get()) {
|
||||||
|
Log(LogInformation, "ApiListener") << "Relaying messages for parent Zone '"
|
||||||
|
<< parentZone->GetName() << "' to Endpoint '" << targetEndpoint->GetName() << "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SyncSendMessage(targetEndpoint, message);
|
SyncSendMessage(targetEndpoint, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "remote/httpserverconnection.hpp"
|
#include "remote/httpserverconnection.hpp"
|
||||||
#include "remote/endpoint.hpp"
|
#include "remote/endpoint.hpp"
|
||||||
#include "remote/messageorigin.hpp"
|
#include "remote/messageorigin.hpp"
|
||||||
|
#include "base/atomic.hpp"
|
||||||
#include "base/configobject.hpp"
|
#include "base/configobject.hpp"
|
||||||
#include "base/process.hpp"
|
#include "base/process.hpp"
|
||||||
#include "base/shared.hpp"
|
#include "base/shared.hpp"
|
||||||
@ -177,6 +178,7 @@ private:
|
|||||||
Timer::Ptr m_RenewOwnCertTimer;
|
Timer::Ptr m_RenewOwnCertTimer;
|
||||||
|
|
||||||
Endpoint::Ptr m_LocalEndpoint;
|
Endpoint::Ptr m_LocalEndpoint;
|
||||||
|
Atomic<Endpoint*> m_CurrentParentEndpoint {nullptr};
|
||||||
|
|
||||||
static ApiListener::Ptr m_Instance;
|
static ApiListener::Ptr m_Instance;
|
||||||
static std::atomic<bool> m_UpdatedObjectAuthority;
|
static std::atomic<bool> m_UpdatedObjectAuthority;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user