So I was studying the section of tcp_receive() that handles processing an ACK for
new data. What I found strange is that there is logic to check the unsent queue
and update pcb->snd_buf outside from the check of whether the ACK acknowledge
new data. I was expecting this logic to be within the conditional that checks
ackno is between lastack+1 and snd_nxt
} else if (TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_nxt)) {
/* We come here when the ACK acknowledges new data. */
…
} else {
/* Out of sequence ACK, didn't really ack anything */
tcp_send_empty_ack(pcb);
}
/* We go through the ->unsent list to see if any of the segments
on the list are acknowledged by the ACK. This may seem
strange since an "unsent" segment shouldn't be acked. The
rationale is that lwIP puts all outstanding segments on the
->unsent list after a retransmission, so these segments may
in fact have been sent once. */
...
}
pcb->snd_buf += recv_acked;
/* End of ACK for new data processing. */
I dug through the history and this organization goes all the way back to the
original commit in git. Is this a bug or is there a reason to run through the
logic outside of the conditional (which checks for an ACK covering new data)?
Thanks,
Joel
_______________________________________________
lwip-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-devel