mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-23 06:35:57 +00:00
tcp_in.c: Fix bug #20126 : Zero ssthresh bug (by Per-Henrik Lundblom and Kieran Mansley).
This commit is contained in:
parent
6784fd64f3
commit
e89f5983be
|
@ -701,12 +701,18 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||||
/*pcb->ssthresh = LWIP_MAX((pcb->snd_max -
|
/*pcb->ssthresh = LWIP_MAX((pcb->snd_max -
|
||||||
pcb->lastack) / 2,
|
pcb->lastack) / 2,
|
||||||
2 * pcb->mss);*/
|
2 * pcb->mss);*/
|
||||||
/* Set ssthresh to half of the minimum of the currenct cwnd and the advertised window */
|
/* Set ssthresh to half of the minimum of the current cwnd and the advertised window */
|
||||||
if (pcb->cwnd > pcb->snd_wnd)
|
if (pcb->cwnd > pcb->snd_wnd)
|
||||||
pcb->ssthresh = pcb->snd_wnd / 2;
|
pcb->ssthresh = pcb->snd_wnd / 2;
|
||||||
else
|
else
|
||||||
pcb->ssthresh = pcb->cwnd / 2;
|
pcb->ssthresh = pcb->cwnd / 2;
|
||||||
|
|
||||||
|
/* The minimum value for ssthresh should be 2 MSS */
|
||||||
|
if (pcb->ssthresh < 2*pcb->mss) {
|
||||||
|
LWIP_DEBUGF(TCP_FR_DEBUG, ("tcp_receive: The minimum value for ssthresh %"U16_F" should be min 2 mss %"U16_F"...\n", pcb->ssthresh, 2*pcb->mss));
|
||||||
|
pcb->ssthresh = 2*pcb->mss;
|
||||||
|
}
|
||||||
|
|
||||||
pcb->cwnd = pcb->ssthresh + 3 * pcb->mss;
|
pcb->cwnd = pcb->ssthresh + 3 * pcb->mss;
|
||||||
pcb->flags |= TF_INFR;
|
pcb->flags |= TF_INFR;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user