Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Further clean up timeout logic

  • Loading branch information...
commit 48bed3172e7f91aad276ffa89dcf0a95b0e2ab31 1 parent d6a93f6
@keithw keithw authored
Showing with 11 additions and 12 deletions.
  1. +11 −12 src/network/transportsender.cc
View
23 src/network/transportsender.cc
@@ -79,23 +79,22 @@ void TransportSender<MyState>::calculate_timers( void )
next_ack_time = now + ACK_DELAY;
}
- if ( !(current_state == sent_states.back().state) ) { /* pending data to send */
+ if ( !(current_state == sent_states.back().state) ) {
if ( mindelay_clock == uint64_t( -1 ) ) {
mindelay_clock = now;
}
- if ( next_send_time > mindelay_clock + SEND_MINDELAY ) {
- next_send_time = mindelay_clock + SEND_MINDELAY;
- }
-
- if ( next_send_time < sent_states.back().timestamp + send_interval() ) {
- next_send_time = sent_states.back().timestamp + send_interval();
- }
- } else if ( ( !(current_state == assumed_receiver_state->state)
- && (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) ) {
- if ( next_send_time < sent_states.back().timestamp + send_interval() ) {
- next_send_time = sent_states.back().timestamp + send_interval();
+ next_send_time = max( mindelay_clock + SEND_MINDELAY,
+ sent_states.back().timestamp + send_interval() );
+ } else if ( !(current_state == assumed_receiver_state->state)
+ && (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
+ next_send_time = sent_states.back().timestamp + send_interval();
+ if ( mindelay_clock != uint64_t( -1 ) ) {
+ next_send_time = max( next_send_time, mindelay_clock + SEND_MINDELAY );
}
+ } else if ( !(current_state == sent_states.front().state )
+ && (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
+ next_send_time = sent_states.back().timestamp + connection->timeout() + ACK_DELAY;
} else {
next_send_time = uint64_t(-1);
}
Please sign in to comment.
Something went wrong with that request. Please try again.