Move the ACK segment send functionality to the send_ack_request() method
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Tue, 2 Aug 2011 10:12:57 +0000 (07:12 -0300)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Tue, 2 Aug 2011 10:12:57 +0000 (07:12 -0300)
src/tcp/tcppinger.cpp
src/tcp/tcppinger.h

index 01c5fa3..6b6a5eb 100644 (file)
@@ -170,12 +170,16 @@ void TcpPinger::start_send()
     );
     tcp_header.checksum( cksum );
 
+    send_ack_request( tcp_header );
+}
+
+void TcpPinger::send_ack_request( const TcpHeader &tcp_header )
+{
     // Encode the request packet.
     boost::asio::streambuf request_buffer;
     ostream os( &request_buffer );
     os << tcp_header;
 
-    // Send the request.
     TimeSent = microsec_clock::universal_time();
 
     string dest_address_string = DestinationEndpoint.address().to_string();
@@ -199,6 +203,7 @@ void TcpPinger::start_send()
                 << ex.what() << endl;
     }
 
+    // Tell how long to wait for the reply
     schedule_timeout_rst_reply();
 }
 
index e2ae498..f1babc1 100644 (file)
@@ -73,6 +73,7 @@ private:
             const uint16_t destination_port,
             const uint16_t sequence_number
     ) const;
+    void send_ack_request( const TcpHeader &tcp_header );
     void schedule_timeout_rst_reply();
     void handle_timeout();