]> granicus.if.org Git - icinga2/commitdiff
cluster: Fix some bugs.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 9 Sep 2013 08:06:49 +0000 (10:06 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 9 Sep 2013 08:06:49 +0000 (10:06 +0200)
components/cluster/clustercomponent.cpp
components/compat/compatlog.cpp

index 96dbbce8f4b09347cff1adab60ac3f67507b5b86..220548b899e85b5aafca5832bf195c70e37f5eef 100644 (file)
@@ -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);
index da2797606842a25b68218dcc5a5a74af82f6a7c0..918bbecd81446c181e1cf5ba6db9345f02ef4f90 100644 (file)
@@ -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));