Fixed bug: If one ping fails, the subsequent analysis report that the ping is down.
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Tue, 19 Apr 2011 11:51:10 +0000 (13:51 +0200)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Tue, 19 Apr 2011 11:53:07 +0000 (13:53 +0200)
- 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
src/host/hoststatusanalyzer.cpp

diff --git a/TODO b/TODO
index 30fad44..401d9d5 100644 (file)
--- 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.
index 5263d64..20ccb83 100644 (file)
@@ -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 ) );
 }