From: Guilherme Maciel Ferreira Date: Mon, 7 Mar 2011 14:30:28 +0000 (+0100) Subject: Fixed assertion range on times_to_ping X-Git-Tag: v1.0~159 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=7c0eaa49f23acb40284a2ba16e605e12da568a56;p=pingcheck Fixed assertion range on times_to_ping --- diff --git a/src/ping/boostpinger.cpp b/src/ping/boostpinger.cpp index 8e44269..70c4eee 100644 --- a/src/ping/boostpinger.cpp +++ b/src/ping/boostpinger.cpp @@ -35,7 +35,7 @@ BoostPinger::BoostPinger( ReplyBuffer(), RepliesCount( 0 ), TimesToPingTotal( 0 ), - MinTimesToPing( 0 ), + MinTimesToPing( 1 ), MaxTimesToPing( numeric_limits::max() ) { } @@ -50,7 +50,7 @@ void BoostPinger::ping( ) { BOOST_ASSERT( !destination.empty() ); - BOOST_ASSERT( ( MinTimesToPing < times_to_ping ) && ( times_to_ping < MaxTimesToPing ) ); + BOOST_ASSERT( ( MinTimesToPing <= times_to_ping ) && ( times_to_ping <= MaxTimesToPing ) ); icmp::resolver::query query( icmp::v4(), destination, "" ); DestinationEndpoint = *Resolver.resolve( query ); @@ -92,7 +92,6 @@ IcmpPacket BoostPinger::create_echo_request_packet() { IcmpData icmp_data( "ping-message" ); - // Create an ICMP header for an echo request. SequenceNumber++; IcmpHeader::IcmpType type = IcmpHeader::EchoRequest; uint8_t code = 0; @@ -101,7 +100,6 @@ IcmpPacket BoostPinger::create_echo_request_packet() uint16_t checksum = calculator.compute( type, code, identifier, SequenceNumber ); IcmpHeader icmp_header( type, code, checksum, identifier, SequenceNumber ); - // Encode the ICMP header and data in an ICMP packet. return IcmpPacket( icmp_header, icmp_data ); }