summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Winstein <keithw@mit.edu>2012-05-02 16:26:43 -0400
committerKeith Winstein <keithw@mit.edu>2012-05-02 16:26:43 -0400
commit48bed3172e7f91aad276ffa89dcf0a95b0e2ab31 (patch)
treeea7840d32243c514896613ea0fc46b981e3b1d2c
parentd6a93f6dcb485097c58541e724193f3a3734e87c (diff)
Further clean up timeout logicexperiment
-rw-r--r--src/network/transportsender.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/network/transportsender.cc b/src/network/transportsender.cc
index 79c6d30..c955d1e 100644
--- a/src/network/transportsender.cc
+++ b/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);
}