From 39b0806778a13733ec61d01baf40f6056443c83b Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 27 Feb 2013 17:20:22 +0100 Subject: [PATCH] Fixed reachability calculation for host checks. --- lib/icinga/service.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index 3ba7d670d..f8fdcb059 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -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; -- 2.40.0