From: Gunnar Beutner Date: Mon, 9 Sep 2013 08:06:49 +0000 (+0200) Subject: cluster: Fix some bugs. X-Git-Tag: v0.0.3~591 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a695d8cdd65446b888b0439d0842fe9073544e33;p=icinga2 cluster: Fix some bugs. --- diff --git a/components/cluster/clustercomponent.cpp b/components/cluster/clustercomponent.cpp index 96dbbce8f..220548b89 100644 --- a/components/cluster/clustercomponent.cpp +++ b/components/cluster/clustercomponent.cpp @@ -415,6 +415,7 @@ void ClusterComponent::NewClientHandler(const Socket::Ptr& client, TlsRole role) Array::Ptr configFiles = endpoint->GetConfigFiles(); if (configFiles) { + ObjectLock olock(configFiles); BOOST_FOREACH(const String& pattern, configFiles) { Utility::Glob(pattern, boost::bind(&ClusterComponent::ConfigGlobHandler, boost::cref(config), _1, false)); } @@ -458,8 +459,10 @@ void ClusterComponent::ClusterTimerHandler(void) BOOST_FOREACH(const String& peer, peers) { Endpoint::Ptr endpoint = Endpoint::GetByName(peer); - if (!endpoint) + if (!endpoint) { + Log(LogWarning, "cluster", "Attempted to reconnect to endpoint '" + peer + "': No configuration found."); continue; + } if (endpoint->IsConnected()) continue; @@ -995,6 +998,7 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction bool accept = false; if (acceptConfig) { + ObjectLock olock(acceptConfig); BOOST_FOREACH(const String& pattern, acceptConfig) { if (Utility::Match(pattern, sender->GetName())) { accept = true; @@ -1030,6 +1034,7 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction String key; Value value; + ObjectLock olock(remoteConfig); BOOST_FOREACH(boost::tie(key, value), remoteConfig) { Dictionary::Ptr remoteFile = value; bool writeFile = false; @@ -1061,6 +1066,7 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction localConfig->Remove(hash); } + ObjectLock olock2(localConfig); BOOST_FOREACH(boost::tie(key, boost::tuples::ignore), localConfig) { String path = dir + "/" + key; Log(LogInformation, "cluster", "Removing obsolete config file: " + path); diff --git a/components/compat/compatlog.cpp b/components/compat/compatlog.cpp index da2797606..918bbecd8 100644 --- a/components/compat/compatlog.cpp +++ b/components/compat/compatlog.cpp @@ -49,6 +49,8 @@ CompatLog::CompatLog(void) */ void CompatLog::Start(void) { + DynamicObject::Start(); + Service::OnNewCheckResult.connect(bind(&CompatLog::CheckResultHandler, this, _1, _2)); // Service::OnDowntimeTriggered.connect(bind(&CompatLog::DowntimeHandler, this, _1)); Service::OnNotificationSentChanged.connect(bind(&CompatLog::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6));