From: Guilherme Maciel Ferreira Date: Tue, 2 Aug 2011 09:58:07 +0000 (-0300) Subject: Split the method, separated some functionality in schedule_timeout_rst_reply() X-Git-Tag: v1.1^2~36 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=81adfb7b908fb2a62d80697f9c82c818697336df;p=pingcheck Split the method, separated some functionality in schedule_timeout_rst_reply() --- diff --git a/src/tcp/tcppinger.cpp b/src/tcp/tcppinger.cpp index ea99374..01c5fa3 100644 --- a/src/tcp/tcppinger.cpp +++ b/src/tcp/tcppinger.cpp @@ -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; diff --git a/src/tcp/tcppinger.h b/src/tcp/tcppinger.h index 4013cdc..e2ae498 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 schedule_timeout_rst_reply(); void handle_timeout(); void start_receive();