Renamed handle_timeout_echo_reply() to handle_timeout_icmp_packet()
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Mon, 2 May 2011 12:17:11 +0000 (14:17 +0200)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Mon, 2 May 2011 12:17:11 +0000 (14:17 +0200)
- 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
src/host/boostpinger.h

index da72f42..96c6578 100644 (file)
@@ -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
index 09adb07..42740cf 100644 (file)
@@ -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;