diff --git a/src/sender_utils.c b/src/sender_utils.c index 08b6b437161e52c748db96b0ed774d3a883ff479..db31c725e66f902745039abe801e3f323d30dabc 100644 --- a/src/sender_utils.c +++ b/src/sender_utils.c @@ -151,7 +151,8 @@ int handle_returning_ack_nack(sender_state_t *state, int socket_fd) state->r_window_size = r_window; uint8_t upper_bound = (place_last_ack + 1) % WINDOW_SIZE; // The oldest seqnum sended - while (state->tail != upper_bound) + // A do while is necessary here in case we want to make a full revolution (ack from 1 to 1 not included for example) + do { pkt_t *n_pkt = state->buffer[state->tail]; seqnum = pkt_get_seqnum(n_pkt); @@ -162,7 +163,7 @@ int handle_returning_ack_nack(sender_state_t *state, int socket_fd) state->s_window_size++; state->tail = (state->tail + 1) % WINDOW_SIZE; - } + } while (state->tail != upper_bound); // Send back the asked ACK if there is one to send back if (place_last_nack != OUT_OFF_WINDOW) diff --git a/tests/advanced_test.sh b/tests/advanced_test.sh index 2b66943a974d5d4dad8fb194f777121c092b7957..297f4975a7d70e7169204bf2d55e9e46bdbfa445 100755 --- a/tests/advanced_test.sh +++ b/tests/advanced_test.sh @@ -30,7 +30,7 @@ port1=$(comm -23 <(seq 65000 65200 | sort) <(ss -Htan | awk '{print $4}' | cut - port2=$(comm -23 <(seq 65000 65200 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1) # We first launch the link simulator -./linksimulator/link_sim -p $port2 -P $port1 -l 0 -d 0 -e 0 -c 0 -R \ +./linksimulator/link_sim -p $port2 -P $port1 -l 20 -d 300 -e 8 -c 12 -R \ &>${TEST_OUTPUT_FILES}/adv_${BSN_PRE}_link.log & link_pid=$! # We launch the receiver and capture its output