Make sure new state is inserted even on NetworkException (per stellex)

This commit is contained in:
Keith Winstein
2011-09-16 17:55:11 -04:00
parent cfa6d7b8df
commit 14111f861e
+8 -11
View File
@@ -141,9 +141,8 @@ void TransportSender<MyState>::send_to_receiver( string diff )
new_num = uint64_t( -1 ); new_num = uint64_t( -1 );
} }
bool done = false;
int MTU_tries = 0; int MTU_tries = 0;
while ( !done ) { while ( 1 ) {
MTU_tries++; MTU_tries++;
if ( MTU_tries > 20 ) { if ( MTU_tries > 20 ) {
@@ -151,21 +150,19 @@ void TransportSender<MyState>::send_to_receiver( string diff )
connection->get_MTU() ); connection->get_MTU() );
} }
try {
send_in_fragments( diff, new_num );
done = true;
} catch ( MTUException m ) {
fprintf( stderr, "Caught Path MTU exception, MTU now = %d\n", connection->get_MTU() );
done = false;
}
if ( new_num == sent_states.back().num ) { 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++; try {
send_in_fragments( diff, new_num ); // Can throw NetworkException
break;
} catch ( MTUException m ) {
fprintf( stderr, "Caught Path MTU exception, MTU now = %d\n", connection->get_MTU() );
new_num++;
}
} }
/* successfully sent, probably */ /* successfully sent, probably */