Make sure new state is inserted even on NetworkException (per stellex)
This commit is contained in:
+7
-10
@@ -141,9 +141,8 @@ void TransportSender<MyState>::send_to_receiver( string diff )
|
||||
new_num = uint64_t( -1 );
|
||||
}
|
||||
|
||||
bool done = false;
|
||||
int MTU_tries = 0;
|
||||
while ( !done ) {
|
||||
while ( 1 ) {
|
||||
MTU_tries++;
|
||||
|
||||
if ( MTU_tries > 20 ) {
|
||||
@@ -151,22 +150,20 @@ void TransportSender<MyState>::send_to_receiver( string diff )
|
||||
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 ) {
|
||||
sent_states.back().timestamp = timestamp();
|
||||
} else {
|
||||
sent_states.push_back( TimestampedState<MyState>( timestamp(), new_num, current_state ) );
|
||||
}
|
||||
|
||||
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 */
|
||||
/* ("probably" because the FIRST size-exceeded datagram doesn't get an error) */
|
||||
|
||||
Reference in New Issue
Block a user