[icinga-checkins] icinga.org: icinga2/master: Fix initialization for the ApiListener class

git at icinga.org git at icinga.org
Fri Nov 21 23:23:59 CET 2014


Module: icinga2
Branch: master
Commit: 8611682cdbf257b59ccf00ee6a3cb358703e3644
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=8611682cdbf257b59ccf00ee6a3cb358703e3644

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Nov 21 23:23:31 2014 +0100

Fix initialization for the ApiListener class

fixes #7780

---

 lib/remote/apilistener.cpp |    7 +++++--
 lib/remote/apilistener.hpp |    1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp
index e8578b0..807adbf 100644
--- a/lib/remote/apilistener.cpp
+++ b/lib/remote/apilistener.cpp
@@ -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;
diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp
index 5299ed4..ed303cb 100644
--- a/lib/remote/apilistener.hpp
+++ b/lib/remote/apilistener.hpp
@@ -70,6 +70,7 @@ public:
 
 protected:
 	virtual void OnConfigLoaded(void);
+	virtual void OnAllConfigLoaded(void);
 	virtual void Start(void);
 
 private:



More information about the icinga-checkins mailing list