]> granicus.if.org Git - icinga2/commitdiff
Bugfixes.
authorGunnar Beutner <gunnar@beutner.name>
Thu, 14 Jun 2012 14:39:14 +0000 (16:39 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 14 Jun 2012 14:39:14 +0000 (16:39 +0200)
components/checker/checkercomponent.cpp
components/checker/checkercomponent.h
components/delegation/delegationcomponent.cpp

index c65cb6ba7dfb0b8d3c7ef809e4559a0d067117c3..036bed4abc521f6b669f7da78cca223865000d40 100644 (file)
@@ -36,9 +36,6 @@ void CheckerComponent::Start(void)
        m_CheckerEndpoint->RegisterPublication("checker::CheckResult");
        GetEndpointManager()->RegisterEndpoint(m_CheckerEndpoint);
 
-       // TODO: get rid of this
-       ConfigObject::GetAllObjects()->OnObjectAdded.connect(bind(&CheckerComponent::NewServiceHandler, this, _1));
-
        m_CheckTimer = make_shared<Timer>();
        m_CheckTimer->SetInterval(10);
        m_CheckTimer->OnTimerExpired.connect(bind(&CheckerComponent::CheckTimerHandler, this, _1));
@@ -63,14 +60,6 @@ void CheckerComponent::Stop(void)
                mgr->UnregisterEndpoint(m_CheckerEndpoint);
 }
 
-int CheckerComponent::NewServiceHandler(const ObjectSetEventArgs<ConfigObject::Ptr>& ea)
-{
-       if (ea.Target->GetType() == "service")
-               m_Services.push(ea.Target);
-
-       return 0;
-}
-
 int CheckerComponent::CheckTimerHandler(const TimerEventArgs& ea)
 {
        time_t now;
@@ -122,6 +111,9 @@ int CheckerComponent::AssignServiceRequestHandler(const NewRequestEventArgs& nre
 
        Application::Log("Accepted service '" + service.GetName() + "'");
 
+       /* force a service check */
+       m_CheckTimer->Reschedule(0);
+
        ResponseMessage rm;
        rm.SetID(id);
 
index 320de7d3c164e1962c0d8d417d9eb35913edaea6..4198ad1730407c7f62a7347ef5da87b4e83d1f73 100644 (file)
@@ -47,8 +47,6 @@ private:
        Timer::Ptr m_CheckTimer;
        VirtualEndpoint::Ptr m_CheckerEndpoint;
 
-       int NewServiceHandler(const ObjectSetEventArgs<ConfigObject::Ptr>& ea);
-
        int CheckTimerHandler(const TimerEventArgs& ea);
 
        int AssignServiceRequestHandler(const NewRequestEventArgs& nrea);
index cbce44c3fcbb9b43aa03f5132b0945a74ea0a8e8..4bab9472da6b9d5445ba73c6ffc50285dc9d90d8 100644 (file)
@@ -82,10 +82,12 @@ void DelegationComponent::AssignService(const ConfigObject::Ptr& service)
 
 int DelegationComponent::AssignServiceResponseHandler(const ConfigObject::Ptr& service, const NewResponseEventArgs& nrea)
 {
-       if (nrea.TimedOut)
+       if (nrea.TimedOut) {
                Application::Log("Service delegation for service '" + service->GetName() + "' timed out.");
-       else
+       } else {
+               service->SetTag("checker", nrea.Sender->GetIdentity());
                Application::Log("Service delegation for service '" + service->GetName() + "'was successful.");
+       }
 
        return 0;
 }