From: Gunnar Beutner Date: Tue, 3 Sep 2013 08:48:34 +0000 (+0200) Subject: cluster: Prevent message loops when replaying logs. X-Git-Tag: v0.0.3~613 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b97e69604d2900fa000e0493875215a7043818ca;p=icinga2 cluster: Prevent message loops when replaying logs. --- diff --git a/components/cluster/clustercomponent.cpp b/components/cluster/clustercomponent.cpp index aa704c895..7edc099b8 100644 --- a/components/cluster/clustercomponent.cpp +++ b/components/cluster/clustercomponent.cpp @@ -208,6 +208,10 @@ void ClusterComponent::RelayMessage(const Endpoint::Ptr& except, const Dictionar Dictionary::Ptr pmessage = boost::make_shared(); double ts = Utility::GetTime(); pmessage->Set("timestamp", ts); + + if (except) + pmessage->Set("except", except->GetName()); + pmessage->Set("message", message); ObjectLock olock(this); @@ -320,6 +324,9 @@ void ClusterComponent::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Pt if (pmessage->Get("timestamp") < endpoint->GetLocalLogPosition()) continue; + if (pmessage->Get("except") == endpoint->GetName()) + continue; + String json = Value(pmessage->Get("message")).Serialize(); NetString::WriteStringToStream(stream, json); count++;