16th October 2004 - Kieran Mansley - kjm25@cam.ac.uk

- Add code to tcp_recved() to send an ACK (window update)
immediately, even if one is already pending, if the rcv_wnd is above a
threshold (currently TCP_WND/2)
 - This avoids waiting for a timer to expire to send a delayed ACK in
order to open the window if the stack is only receiving data.
This commit is contained in:
kieranm 2004-10-16 12:57:52 +00:00
parent 252dcd8626
commit 751557bcbf

View File

@ -445,6 +445,16 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len)
*/ */
tcp_ack(pcb); tcp_ack(pcb);
} }
else if (pcb->flags & TF_ACK_DELAY && pcb->rcv_wnd >= TCP_WND/2) {
/* If we can send a window update such that there is a full
* segment available in the window, do so now. This is sort of
* nagle-like in its goals, and tries to hit a compromise between
* sending acks each time the window is updated, and only sending
* window updates when a timer expires. The "threshold" used
* above (currently TCP_WND/2) can be tuned to be more or less
* aggressive */
tcp_ack_now(pcb);
}
LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %u bytes, wnd %u (%u).\n", LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %u bytes, wnd %u (%u).\n",
len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd)); len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd));