Fixed crash while unloading auth/sub components.

This commit is contained in:
Gunnar Beutner 2012-04-20 16:10:38 +02:00
parent fb53dd345c
commit 5ae2c4aa5b
2 changed files with 14 additions and 3 deletions

View File

@ -25,12 +25,17 @@ void AuthenticationComponent::Start(void)
void AuthenticationComponent::Stop(void)
{
IcingaApplication::Ptr app = GetIcingaApplication();
if (app) {
EndpointManager::Ptr mgr = app->GetEndpointManager();
mgr->UnregisterEndpoint(m_AuthenticationEndpoint);
}
}
int AuthenticationComponent::NewEndpointHandler(const NewEndpointEventArgs& neea)
{
if (neea.Endpoint->IsLocal())
if (neea.Endpoint->IsLocal() || neea.Endpoint->HasIdentity())
return 0;
JsonRpcRequest request;
@ -42,6 +47,8 @@ int AuthenticationComponent::NewEndpointHandler(const NewEndpointEventArgs& neea
request.SetParams(params);
neea.Endpoint->ProcessRequest(m_AuthenticationEndpoint, request);
return 0;
}
int AuthenticationComponent::IdentityMessageHandler(const NewRequestEventArgs& nrea)

View File

@ -29,8 +29,12 @@ void SubscriptionComponent::Start(void)
void SubscriptionComponent::Stop(void)
{
EndpointManager::Ptr mgr = GetIcingaApplication()->GetEndpointManager();
mgr->UnregisterEndpoint(m_SubscriptionEndpoint);
IcingaApplication::Ptr app = GetIcingaApplication();
if (app) {
EndpointManager::Ptr mgr = app->GetEndpointManager();
mgr->UnregisterEndpoint(m_SubscriptionEndpoint);
}
}
int SubscriptionComponent::SyncSubscription(Endpoint::Ptr target, string type, const NewMethodEventArgs& nmea)