mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-22 09:17:43 +02:00
Merge pull request #10393 from Icinga/zone-endpoint-log
ApiListener#RelayMessageOne(): log🪵 to which Endpoint messages are relayed
This commit is contained in:
commit
5f2ee6e119
@ -1269,11 +1269,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;
|
||||||
}
|
}
|
||||||
@ -1352,12 +1353,28 @@ 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()
|
||||||
|
<< "' through Endpoint '" << currentZoneMaster->GetName() << "' of our own Zone";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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()
|
||||||
|
<< "' directly to Endpoint '" << targetEndpoint->GetName() << "' of that Zone";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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"
|
||||||
@ -187,6 +188,7 @@ private:
|
|||||||
Timer::Ptr m_RenewOwnCertTimer;
|
Timer::Ptr m_RenewOwnCertTimer;
|
||||||
|
|
||||||
Endpoint::Ptr m_LocalEndpoint;
|
Endpoint::Ptr m_LocalEndpoint;
|
||||||
|
Atomic<Endpoint*> m_CurrentParentEndpoint {nullptr};
|
||||||
StoppableWaitGroup::Ptr m_WaitGroup = new StoppableWaitGroup();
|
StoppableWaitGroup::Ptr m_WaitGroup = new StoppableWaitGroup();
|
||||||
|
|
||||||
static ApiListener::Ptr m_Instance;
|
static ApiListener::Ptr m_Instance;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user