From bd1a223157c49899f11d01ac2a5c41cd92ebea57 Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Mon, 2 May 2011 14:17:11 +0200 Subject: [PATCH] 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 --- src/host/boostpinger.cpp | 26 +++++++++++++------------- src/host/boostpinger.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) 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; -- 1.7.1