From b594b7d95a02467863f2c6ba10c4a995ab978edd Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Tue, 2 Aug 2011 07:12:57 -0300 Subject: [PATCH] Move the ACK segment send functionality to the send_ack_request() method --- src/tcp/tcppinger.cpp | 7 ++++++- src/tcp/tcppinger.h | 1 + 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/tcp/tcppinger.cpp b/src/tcp/tcppinger.cpp index 01c5fa3..6b6a5eb 100644 --- a/src/tcp/tcppinger.cpp +++ b/src/tcp/tcppinger.cpp @@ -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(); } diff --git a/src/tcp/tcppinger.h b/src/tcp/tcppinger.h index e2ae498..f1babc1 100644 --- a/src/tcp/tcppinger.h +++ b/src/tcp/tcppinger.h @@ -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(); -- 1.7.1