Bugfixes.

This commit is contained in:
Gunnar Beutner 2012-06-14 16:39:14 +02:00
parent 146880c110
commit ac7d8688a8
3 changed files with 7 additions and 15 deletions

View File

@ -36,9 +36,6 @@ void CheckerComponent::Start(void)
m_CheckerEndpoint->RegisterPublication("checker::CheckResult"); m_CheckerEndpoint->RegisterPublication("checker::CheckResult");
GetEndpointManager()->RegisterEndpoint(m_CheckerEndpoint); 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 = make_shared<Timer>();
m_CheckTimer->SetInterval(10); m_CheckTimer->SetInterval(10);
m_CheckTimer->OnTimerExpired.connect(bind(&CheckerComponent::CheckTimerHandler, this, _1)); m_CheckTimer->OnTimerExpired.connect(bind(&CheckerComponent::CheckTimerHandler, this, _1));
@ -63,14 +60,6 @@ void CheckerComponent::Stop(void)
mgr->UnregisterEndpoint(m_CheckerEndpoint); 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) int CheckerComponent::CheckTimerHandler(const TimerEventArgs& ea)
{ {
time_t now; time_t now;
@ -122,6 +111,9 @@ int CheckerComponent::AssignServiceRequestHandler(const NewRequestEventArgs& nre
Application::Log("Accepted service '" + service.GetName() + "'"); Application::Log("Accepted service '" + service.GetName() + "'");
/* force a service check */
m_CheckTimer->Reschedule(0);
ResponseMessage rm; ResponseMessage rm;
rm.SetID(id); rm.SetID(id);

View File

@ -47,8 +47,6 @@ private:
Timer::Ptr m_CheckTimer; Timer::Ptr m_CheckTimer;
VirtualEndpoint::Ptr m_CheckerEndpoint; VirtualEndpoint::Ptr m_CheckerEndpoint;
int NewServiceHandler(const ObjectSetEventArgs<ConfigObject::Ptr>& ea);
int CheckTimerHandler(const TimerEventArgs& ea); int CheckTimerHandler(const TimerEventArgs& ea);
int AssignServiceRequestHandler(const NewRequestEventArgs& nrea); int AssignServiceRequestHandler(const NewRequestEventArgs& nrea);

View File

@ -82,10 +82,12 @@ void DelegationComponent::AssignService(const ConfigObject::Ptr& service)
int DelegationComponent::AssignServiceResponseHandler(const ConfigObject::Ptr& service, const NewResponseEventArgs& nrea) 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."); 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."); Application::Log("Service delegation for service '" + service->GetName() + "'was successful.");
}
return 0; return 0;
} }