From 14111f861e07f911e5f4aefb04cc239572d9ab08 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Fri, 16 Sep 2011 17:55:11 -0400 Subject: [PATCH] Make sure new state is inserted even on NetworkException (per stellex) --- transportsender.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/transportsender.cpp b/transportsender.cpp index 65ab4a3..7cba7b1 100644 --- a/transportsender.cpp +++ b/transportsender.cpp @@ -141,9 +141,8 @@ void TransportSender::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,21 +150,19 @@ void TransportSender::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( 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 */