Fixed reachability calculation for host checks.

This commit is contained in:
Gunnar Beutner 2013-02-27 17:20:22 +01:00
parent a960237139
commit 39b0806778
1 changed files with 15 additions and 0 deletions

View File

@ -159,9 +159,20 @@ String Service::GetShortName(void) const
bool Service::IsReachable(const Service::Ptr& self)
{
String service_name;
{
ObjectLock olock(self);
service_name = self->GetName();
}
BOOST_FOREACH(const Service::Ptr& service, Service::GetParentServices(self)) {
ObjectLock olock(service);
/* ignore ourselves */
if (service->GetName() == service_name)
continue;
/* ignore pending services */
if (!service->GetLastCheckResult())
continue;
@ -182,6 +193,10 @@ bool Service::IsReachable(const Service::Ptr& self)
Service::Ptr hc = Host::GetHostCheckService(host);
ObjectLock olock(hc);
/* ignore ourselves */
if (hc->GetName() == service_name)
continue;
/* ignore hosts that are up */
if (hc && hc->GetState() == StateOK)
continue;