Split the method, separated some functionality in schedule_timeout_rst_reply()
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Tue, 2 Aug 2011 09:58:07 +0000 (06:58 -0300)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Tue, 2 Aug 2011 09:58:07 +0000 (06:58 -0300)
src/tcp/tcppinger.cpp
src/tcp/tcppinger.h

index ea99374..01c5fa3 100644 (file)
@@ -199,14 +199,7 @@ void TcpPinger::start_send()
                 << ex.what() << endl;
     }
 
-    // Wait up to N seconds for a reply.
-    ReceivedReply = false;
-    (void) TcpSegmentReceiveTimer.expires_at(
-            TimeSent + seconds( RstReplyTimeoutInSec )
-    );
-    TcpSegmentReceiveTimer.async_wait(
-            boost::bind( &TcpPinger::handle_timeout, this )
-    );
+    schedule_timeout_rst_reply();
 }
 
 TcpHeader TcpPinger::create_tcp_header(
@@ -231,6 +224,18 @@ TcpHeader TcpPinger::create_tcp_header(
     return tcp_header;
 }
 
+void TcpPinger::schedule_timeout_rst_reply()
+{
+    // Wait up to N seconds for a reply.
+    ReceivedReply = false;
+    (void) TcpSegmentReceiveTimer.expires_at(
+            TimeSent + seconds( RstReplyTimeoutInSec )
+    );
+    TcpSegmentReceiveTimer.async_wait(
+            boost::bind( &TcpPinger::handle_timeout, this )
+    );
+}
+
 void TcpPinger::handle_timeout()
 {
     ReceivedReply = false;
index 4013cdc..e2ae498 100644 (file)
@@ -73,6 +73,7 @@ private:
             const uint16_t destination_port,
             const uint16_t sequence_number
     ) const;
+    void schedule_timeout_rst_reply();
     void handle_timeout();
 
     void start_receive();