mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 18:14:53 +00:00
Ensure SACKs are deleted when pbuf_free_ooseq() frees ooseq pbufs (because of memory shortage)
This commit is contained in:
parent
0b91888eb1
commit
2b2fa0ed71
@ -128,11 +128,10 @@ pbuf_free_ooseq(void)
|
||||
SYS_ARCH_SET(pbuf_free_ooseq_pending, 0);
|
||||
|
||||
for (pcb = tcp_active_pcbs; NULL != pcb; pcb = pcb->next) {
|
||||
if (NULL != pcb->ooseq) {
|
||||
if (pcb->ooseq != NULL) {
|
||||
/** Free the ooseq pbufs of one PCB only */
|
||||
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free_ooseq: freeing out-of-sequence pbufs\n"));
|
||||
tcp_segs_free(pcb->ooseq);
|
||||
pcb->ooseq = NULL;
|
||||
tcp_free_ooseq(pcb);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1176,12 +1176,8 @@ tcp_slowtmr_start:
|
||||
#if TCP_QUEUE_OOSEQ
|
||||
if (pcb->ooseq != NULL &&
|
||||
(tcp_ticks - pcb->tmr >= (u32_t)pcb->rto * TCP_OOSEQ_TIMEOUT)) {
|
||||
tcp_segs_free(pcb->ooseq);
|
||||
pcb->ooseq = NULL;
|
||||
LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: dropping OOSEQ queued data\n"));
|
||||
#if LWIP_TCP_SACK_OUT
|
||||
memset(pcb->rcv_sacks, 0, sizeof(pcb->rcv_sacks));
|
||||
#endif /* LWIP_TCP_SACK_OUT */
|
||||
tcp_free_ooseq(pcb);
|
||||
}
|
||||
#endif /* TCP_QUEUE_OOSEQ */
|
||||
|
||||
@ -1888,12 +1884,8 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
|
||||
#if TCP_QUEUE_OOSEQ
|
||||
if (pcb->ooseq != NULL) {
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->ooseq\n"));
|
||||
tcp_free_ooseq(pcb);
|
||||
}
|
||||
tcp_segs_free(pcb->ooseq);
|
||||
pcb->ooseq = NULL;
|
||||
#if LWIP_TCP_SACK_OUT
|
||||
memset(pcb->rcv_sacks, 0, sizeof(pcb->rcv_sacks));
|
||||
#endif /* LWIP_TCP_SACK_OUT */
|
||||
#endif /* TCP_QUEUE_OOSEQ */
|
||||
|
||||
/* Stop the retransmission timer as it will expect data on unacked
|
||||
@ -2113,6 +2105,19 @@ tcp_tcp_get_tcp_addrinfo(struct tcp_pcb *pcb, int local, ip_addr_t *addr, u16_t
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
/* Free all ooseq pbufs (and possibly reset SACK state) */
|
||||
void
|
||||
tcp_free_ooseq(struct tcp_pcb *pcb)
|
||||
{
|
||||
if (pcb->ooseq) {
|
||||
tcp_segs_free(pcb->ooseq);
|
||||
pcb->ooseq = NULL;
|
||||
#if LWIP_TCP_SACK_OUT
|
||||
memset(pcb->rcv_sacks, 0, sizeof(pcb->rcv_sacks));
|
||||
#endif /* LWIP_TCP_SACK_OUT */
|
||||
}
|
||||
}
|
||||
|
||||
#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
|
||||
/**
|
||||
* Print a tcp header for debugging purposes.
|
||||
|
@ -502,6 +502,10 @@ void tcp_timer_needed(void);
|
||||
|
||||
void tcp_netif_ip_addr_changed(const ip_addr_t* old_addr, const ip_addr_t* new_addr);
|
||||
|
||||
#if TCP_QUEUE_OOSEQ
|
||||
void tcp_free_ooseq(struct tcp_pcb *pcb);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user