While we are getting duplicate ACKs, and are likely in fast recovery,
keep resetting the retransmission timer, so that if fast recovery takes
longer than the RTO, we don't trigger a slow start.
When we do get a real timeout during fast recovery, reset the duplicate
ACK counter to signal we are no longer in fast recovery.
We also should not do anything when receiving duplicate ACKs when all
data has already been ACKed.
}
c->rtt_start.tv_sec = 0; // invalidate RTT timer
+ c->dupack = 0; // cancel any ongoing fast recovery
cleanup:
free(pkt);
break;
}
} else {
- if(!len && is_reliable(c)) {
+ if(!len && is_reliable(c) && c->snd.una != c->snd.last) {
c->dupack++;
debug(c, "duplicate ACK %d\n", c->dupack);
debug_cwnd(c);
}
+
+ // We got an ACK which indicates the other side did get one of our packets.
+ // Reset the retransmission timer to avoid going to slow start,
+ // but don't touch the connection timeout.
+ start_retransmit_timer(c);
}
}