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 */