- The intend of this variable is to provide the maximum number failed
pings taking in consideration the amount of IP resolved for the host.
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;
+ }
}