From ac7d8688a86db9c0de49de97500a25f7c6745af0 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 14 Jun 2012 16:39:14 +0200 Subject: [PATCH] Bugfixes. --- components/checker/checkercomponent.cpp | 14 +++----------- components/checker/checkercomponent.h | 2 -- components/delegation/delegationcomponent.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/components/checker/checkercomponent.cpp b/components/checker/checkercomponent.cpp index c65cb6ba7..036bed4ab 100644 --- a/components/checker/checkercomponent.cpp +++ b/components/checker/checkercomponent.cpp @@ -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(); 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& 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); diff --git a/components/checker/checkercomponent.h b/components/checker/checkercomponent.h index 320de7d3c..4198ad173 100644 --- a/components/checker/checkercomponent.h +++ b/components/checker/checkercomponent.h @@ -47,8 +47,6 @@ private: Timer::Ptr m_CheckTimer; VirtualEndpoint::Ptr m_CheckerEndpoint; - int NewServiceHandler(const ObjectSetEventArgs& ea); - int CheckTimerHandler(const TimerEventArgs& ea); int AssignServiceRequestHandler(const NewRequestEventArgs& nrea); diff --git a/components/delegation/delegationcomponent.cpp b/components/delegation/delegationcomponent.cpp index cbce44c3f..4bab9472d 100644 --- a/components/delegation/delegationcomponent.cpp +++ b/components/delegation/delegationcomponent.cpp @@ -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; }