mirror of https://github.com/Icinga/icinga2.git
parent
f9efc2ffe7
commit
864cdee8d9
|
@ -607,18 +607,18 @@ void ApiListener::SyncSendMessage(const Endpoint::Ptr& endpoint, const Dictionar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApiListener::RelayMessageOne(const Zone::Ptr& targetZone, const MessageOrigin::Ptr& origin, const Dictionary::Ptr& message)
|
bool ApiListener::RelayMessageOne(const Zone::Ptr& targetZone, const MessageOrigin::Ptr& origin, const Dictionary::Ptr& message, const Endpoint::Ptr& currentMaster)
|
||||||
{
|
{
|
||||||
ASSERT(targetZone);
|
ASSERT(targetZone);
|
||||||
|
|
||||||
bool is_master = IsMaster();
|
|
||||||
Endpoint::Ptr master = GetMaster();
|
|
||||||
Zone::Ptr myZone = Zone::GetLocalZone();
|
Zone::Ptr myZone = Zone::GetLocalZone();
|
||||||
|
|
||||||
/* only relay the message to a) the same zone, b) the parent zone and c) direct child zones */
|
/* only relay the message to a) the same zone, b) the parent zone and c) direct child zones */
|
||||||
if (targetZone != myZone && targetZone != myZone->GetParent() && targetZone->GetParent() != myZone)
|
if (targetZone != myZone && targetZone != myZone->GetParent() && targetZone->GetParent() != myZone)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
Endpoint::Ptr myEndpoint = GetLocalEndpoint();
|
||||||
|
|
||||||
std::vector<Endpoint::Ptr> skippedEndpoints;
|
std::vector<Endpoint::Ptr> skippedEndpoints;
|
||||||
|
|
||||||
bool relayed = false, log_needed = false, log_done = false;
|
bool relayed = false, log_needed = false, log_done = false;
|
||||||
|
@ -659,7 +659,7 @@ bool ApiListener::RelayMessageOne(const Zone::Ptr& targetZone, const MessageOrig
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only relay message to the master if we're not currently the master */
|
/* only relay message to the master if we're not currently the master */
|
||||||
if (!is_master && master != endpoint) {
|
if (currentMaster != myEndpoint && currentMaster != endpoint) {
|
||||||
skippedEndpoints.push_back(endpoint);
|
skippedEndpoints.push_back(endpoint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -703,10 +703,12 @@ void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin,
|
||||||
if (!target_zone)
|
if (!target_zone)
|
||||||
target_zone = Zone::GetLocalZone();
|
target_zone = Zone::GetLocalZone();
|
||||||
|
|
||||||
bool need_log = !RelayMessageOne(target_zone, origin, message);
|
Endpoint::Ptr master = GetMaster();
|
||||||
|
|
||||||
|
bool need_log = !RelayMessageOne(target_zone, origin, message, master);
|
||||||
|
|
||||||
BOOST_FOREACH(const Zone::Ptr& zone, target_zone->GetAllParents()) {
|
BOOST_FOREACH(const Zone::Ptr& zone, target_zone->GetAllParents()) {
|
||||||
if (!RelayMessageOne(zone, origin, message))
|
if (!RelayMessageOne(zone, origin, message, master))
|
||||||
need_log = true;
|
need_log = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ private:
|
||||||
Stream::Ptr m_LogFile;
|
Stream::Ptr m_LogFile;
|
||||||
size_t m_LogMessageCount;
|
size_t m_LogMessageCount;
|
||||||
|
|
||||||
bool RelayMessageOne(const Zone::Ptr& zone, const MessageOrigin::Ptr& origin, const Dictionary::Ptr& message);
|
bool RelayMessageOne(const Zone::Ptr& zone, const MessageOrigin::Ptr& origin, const Dictionary::Ptr& message, const Endpoint::Ptr& currentMaster);
|
||||||
void SyncRelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log);
|
void SyncRelayMessage(const MessageOrigin::Ptr& origin, const ConfigObject::Ptr& secobj, const Dictionary::Ptr& message, bool log);
|
||||||
void PersistMessage(const Dictionary::Ptr& message, const ConfigObject::Ptr& secobj);
|
void PersistMessage(const Dictionary::Ptr& message, const ConfigObject::Ptr& secobj);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue