Fix initialization for the ApiListener class

fixes #7780
This commit is contained in:
Gunnar Beutner 2014-11-21 23:23:31 +01:00
parent 6f4ae74e1e
commit 8611682cdb
2 changed files with 6 additions and 2 deletions

View 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;

View File

@ -70,6 +70,7 @@ public:
protected:
virtual void OnConfigLoaded(void);
virtual void OnAllConfigLoaded(void);
virtual void Start(void);
private: