From 751557bcbf9c6434f2a6f567180da5c0308d6afa Mon Sep 17 00:00:00 2001 From: kieranm Date: Sat, 16 Oct 2004 12:57:52 +0000 Subject: [PATCH] 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. --- src/core/tcp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/tcp.c b/src/core/tcp.c index 205af53d..3f4ce641 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -444,6 +444,16 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len) * continue to transmit. */ 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",