From 1d7d7cb2032205a90422bc1eb564d262e2751010 Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Fri, 20 Jan 2012 08:09:26 -0200 Subject: [PATCH] Fix: The ping_fail_absolute_limit calculation was incorrect. - The intend of this variable is to provide the maximum number failed pings taking in consideration the amount of IP resolved for the host. --- src/host/hoststatusanalyzer.cpp | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/host/hoststatusanalyzer.cpp b/src/host/hoststatusanalyzer.cpp index 1b072d6..93c5e84 100644 --- a/src/host/hoststatusanalyzer.cpp +++ b/src/host/hoststatusanalyzer.cpp @@ -156,8 +156,15 @@ void HostStatusAnalyzer::analyze_ping_failed_count() BOOST_ASSERT( ( 0 <= PingFailPercentageLimit ) && ( PingFailPercentageLimit <= 100 ) ); BOOST_ASSERT( ( 0 <= PingsFailedCount ) && ( PingsFailedCount <= PingsPerformedCount ) ); - int ping_fail_absolute_limit = PingFailPercentageLimit / 100; // TODO possible precision loss, check with care + int ping_fail_absolute_limit = ( ResolvedIpCount * PingFailPercentageLimit ) / 100; // keep a boolean variable because the PingsFailedCount can be reseted - ExceededPingFailedLimit = ( PingsFailedCount > ping_fail_absolute_limit ); + if ( PingsFailedCount > ping_fail_absolute_limit ) + { + ExceededPingFailedLimit = true; + } + else + { + ExceededPingFailedLimit = false; + } } -- 1.7.1