From: Guilherme Maciel Ferreira Date: Mon, 2 May 2011 12:17:11 +0000 (+0200) Subject: Renamed handle_timeout_echo_reply() to handle_timeout_icmp_packet() X-Git-Tag: v1.0~47 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=bd1a223157c49899f11d01ac2a5c41cd92ebea57;p=pingcheck Renamed handle_timeout_echo_reply() to handle_timeout_icmp_packet() - the name is more appropriate once the timeout is not triggered if any kind of ICMP packet arrive, not just echo reply --- diff --git a/src/host/boostpinger.cpp b/src/host/boostpinger.cpp index da72f42..96c6578 100644 --- a/src/host/boostpinger.cpp +++ b/src/host/boostpinger.cpp @@ -184,22 +184,10 @@ void BoostPinger::schedule_timeout_echo_reply() TimeSent + seconds( EchoReplyTimeoutInSec ) ); IcmpPacketReceiveTimer.async_wait( - boost::bind( &BoostPinger::handle_timeout_echo_reply, this ) + boost::bind( &BoostPinger::handle_timeout_icmp_packet, this ) ); } -void BoostPinger::handle_timeout_echo_reply() -{ - if ( RepliesCount == 0 ) - { - print_request_timeout(); - - set_ping_status( PingStatus_FailureTimeout ); - } - - schedule_next_echo_request(); -} - void BoostPinger::schedule_next_echo_request() { // Requests must be sent no less than one second apart. @@ -224,6 +212,18 @@ void BoostPinger::start_receive() ); } +void BoostPinger::handle_timeout_icmp_packet() +{ + if ( RepliesCount == 0 ) + { + print_request_timeout(); + + set_ping_status( PingStatus_FailureTimeout ); + } + + schedule_next_echo_request(); +} + void BoostPinger::handle_receive_icmp_packet( const size_t &bytes_transferred ) { // The actual number of bytes received is committed to the buffer so that we diff --git a/src/host/boostpinger.h b/src/host/boostpinger.h index 09adb07..42740cf 100644 --- a/src/host/boostpinger.h +++ b/src/host/boostpinger.h @@ -43,10 +43,10 @@ private: IcmpPacket create_echo_request( const uint16_t sequence_number ) const; void send_echo_request( const IcmpPacket &icmp_packet ); void schedule_timeout_echo_reply(); - void handle_timeout_echo_reply(); void schedule_next_echo_request(); void start_receive(); + void handle_timeout_icmp_packet(); void handle_receive_icmp_packet( const std::size_t &bytes_transferred ); void print_request_timeout() const;