]> granicus.if.org Git - icinga2/commitdiff
Fix initialization for the ApiListener class
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 21 Nov 2014 22:23:31 +0000 (23:23 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 21 Nov 2014 22:23:31 +0000 (23:23 +0100)
fixes #7780

lib/remote/apilistener.cpp
lib/remote/apilistener.hpp

index e8578b0d76b60175ced1933cb9567d8d1e9e19d8..807adbf2e1b9e928606e51695e60e2c3061eccdc 100644 (file)
@@ -80,14 +80,15 @@ void ApiListener::OnConfigLoaded(void)
                        Application::Exit(EXIT_FAILURE);
                }
        }
+}
 
+void ApiListener::OnAllConfigLoaded(void)
+{
        if (!Endpoint::GetByName(GetIdentity())) {
                Log(LogCritical, "ApiListener")
                    << "Endpoint object for '" << GetIdentity() << "' is missing.";
                Application::Exit(EXIT_FAILURE);
        }
-
-       SyncZoneDirs();
 }
 
 /**
@@ -95,6 +96,8 @@ void ApiListener::OnConfigLoaded(void)
  */
 void ApiListener::Start(void)
 {
+       SyncZoneDirs();
+
        if (std::distance(DynamicType::GetObjectsByType<ApiListener>().first, DynamicType::GetObjectsByType<ApiListener>().second) > 1) {
                Log(LogCritical, "ApiListener", "Only one ApiListener object is allowed.");
                return;
index 5299ed4a0e0d50998fa39c4adc9299ba4aef1851..ed303cb538a7038934a35c617d61d644c67c444c 100644 (file)
@@ -70,6 +70,7 @@ public:
 
 protected:
        virtual void OnConfigLoaded(void);
+       virtual void OnAllConfigLoaded(void);
        virtual void Start(void);
 
 private: