Skip to content

Commit 8abbfed

Browse files
committed
Add comment to clarify RTT wrapping logic.
Rejects F/481
1 parent 2575ee5 commit 8abbfed

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/wolfip.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3110,7 +3110,10 @@ static void tcp_ack(struct tsocket *t, const struct wolfIP_tcp_seg *tcp)
31103110
ack_frame_len = ETH_HEADER_LEN + ack_ip_len;
31113111
/* Prefer timestamp-based RTT sample from the incoming ACK. */
31123112
if (ack_frame_len == 0 || tcp_process_ts(t, tcp, ack_frame_len) < 0) {
3113-
/* No usable TS echo; use coarse RTT sample from send timestamp. */
3113+
/* No usable TS echo; use coarse RTT sample from send timestamp.
3114+
* time_sent is stored modulo 2^32, so this subtraction remains
3115+
* correct across a single tick wrap as long as the RTT sample
3116+
* itself fits in 32 bits. */
31143117
if (t->S->last_tick >= fresh_desc->time_sent) {
31153118
uint32_t rtt = (uint32_t)(t->S->last_tick - fresh_desc->time_sent);
31163119
tcp_rto_update_from_sample(t, rtt);

0 commit comments

Comments
 (0)