tcp: Avoid 3-second delay for a half-open connection

If lwIP encounters a half-open connection (e.g. due to a restarted
application reusing the same port numbers) it will correctly send a
RST but will not resend the SYN until one retransmission timeout later
(approximately three seconds).  This can increase the time taken by
lpxelinux.0 to fetch its configuration file from a few milliseconds to
around 30 seconds.

Fix by immediately retransmitting the SYN whenever a half-open
connection is detected.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
Michael Brown 2016-07-04 12:25:22 +02:00 committed by goldsimon
parent fd83f4fb22
commit 2e26fc9224

View File

@ -812,6 +812,10 @@ tcp_process(struct tcp_pcb *pcb)
/* send a RST to bring the other side in a non-synchronized state. */
tcp_rst(ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
/* Resend SYN immediately (don't wait for rto timeout) to establish
connection faster */
pcb->rtime = 0;
tcp_rexmit_rto(pcb);
}
break;
case SYN_RCVD: