Make sure resends (with new framing) get new state number -- pretty hairy!

This commit is contained in:
Keith Winstein
2011-08-12 05:05:05 -04:00
parent 7b1ff634d0
commit 17804b2230
+7 -7
View File
@@ -93,10 +93,8 @@ void Transport<MyState, RemoteState>::send_to_receiver( void )
uint64_t new_num; uint64_t new_num;
if ( current_state == sent_states.back().state ) { /* previously sent */ if ( current_state == sent_states.back().state ) { /* previously sent */
new_num = sent_states.back().num; new_num = sent_states.back().num;
fprintf( stderr, "Sending OLD state %d\r\n", (int)new_num );
} else { /* new state */ } else { /* new state */
new_num = sent_states.back().num + 1; new_num = sent_states.back().num + 1;
fprintf( stderr, "Sending NEW state %d\r\n", (int)new_num );
} }
bool done = false; bool done = false;
@@ -116,12 +114,14 @@ void Transport<MyState, RemoteState>::send_to_receiver( void )
fprintf( stderr, "Caught Path MTU exception, MTU now = %d\n", connection.get_MTU() ); fprintf( stderr, "Caught Path MTU exception, MTU now = %d\n", connection.get_MTU() );
done = false; done = false;
} }
}
if ( current_state == sent_states.back().state ) { if ( new_num == sent_states.back().num ) {
sent_states.back().timestamp = timestamp(); sent_states.back().timestamp = timestamp();
} else { } else {
sent_states.push_back( TimestampedState<MyState>( timestamp(), new_num, current_state ) ); sent_states.push_back( TimestampedState<MyState>( timestamp(), new_num, current_state ) );
}
new_num++;
} }
/* successfully sent, probably */ /* successfully sent, probably */