From 2c10f87b899fd64b9c2ea5af119620a038915f1b Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Tue, 19 Apr 2011 13:51:10 +0200 Subject: [PATCH] Fixed bug: If one ping fails, the subsequent analysis report that the ping is down. - The reason was that in HostStatusAnalyzer, analyze_ping_failed_count() was called from within increase_ping_failed_count(), thus only when the ping failed the ExceededPingFailedLimit was updated, to false. There were no path where ExceededPingFailedLimit was updated to true. Now, the analyze_ping_failed_count() is called everytime we call update_ping_statistics(), which updates ExceededPingFailedLimit everytime. --- TODO | 10 +++++++--- src/host/hoststatusanalyzer.cpp | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 30fad44..401d9d5 100644 --- a/TODO +++ b/TODO @@ -48,6 +48,13 @@ Known Bugs returns only after a reply or timeout, thus increasing the interval to the next schedule ping to the same host and to the other hosts. +- The sequence number is always 1. As the BoostPinger is created for just one + ping. + + +Fixed Bugs +======================================= + - If one ping fails, the subsequent analysis report that the ping is down: Example: Request timed out @@ -63,6 +70,3 @@ Known Bugs - Host down: www.ufsc.br - Speeding up ping interval to: 30s - Time elapsed since last ping: 31s - -- The sequence number is always 1. As the BoostPinger is created for just one - ping. diff --git a/src/host/hoststatusanalyzer.cpp b/src/host/hoststatusanalyzer.cpp index 5263d64..20ccb83 100644 --- a/src/host/hoststatusanalyzer.cpp +++ b/src/host/hoststatusanalyzer.cpp @@ -74,6 +74,8 @@ void HostStatusAnalyzer::update_ping_statistics( bool ping_success ) increase_ping_failed_count(); } + analyze_ping_failed_count(); + // after we tried all IPs resolved for this host, we can analyze how many // failed if ( tried_all_resolved_ip() ) @@ -88,7 +90,7 @@ void HostStatusAnalyzer::update_ping_statistics( bool ping_success ) bool HostStatusAnalyzer::tried_all_resolved_ip() const { - BOOST_ASSERT( ( 0 <= PingsPerformedCount ) && ( PingsPerformedCount <= ResolvedIpCount ) ); + BOOST_ASSERT( ( 0 < PingsPerformedCount ) && ( PingsPerformedCount <= ResolvedIpCount ) ); return ( PingsPerformedCount == ResolvedIpCount ); } @@ -127,8 +129,6 @@ void HostStatusAnalyzer::increase_ping_failed_count() { ++PingsFailedCount; - analyze_ping_failed_count(); - BOOST_ASSERT( ( 0 <= PingsFailedCount ) && ( PingsFailedCount <= PingsPerformedCount ) ); } -- 1.7.1