From c250b3ed2e42aa5abd23d0c0672378807bb06c74 Mon Sep 17 00:00:00 2001 From: Zhang Jun Hao Date: Tue, 24 Jul 2018 16:58:56 +0800 Subject: [PATCH] fix(lwip): fix exist more pbufs after TX_SINGLE_PBUF enabled --- components/lwip/lwip/src/core/tcp_out.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/lwip/lwip/src/core/tcp_out.c b/components/lwip/lwip/src/core/tcp_out.c index 2435408a..84d39677 100644 --- a/components/lwip/lwip/src/core/tcp_out.c +++ b/components/lwip/lwip/src/core/tcp_out.c @@ -481,6 +481,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) LWIP_ASSERT("inconsistent oversize vs. len", (oversize == 0) || (pos == len)); #endif /* TCP_OVERSIZE */ +#if !LWIP_NETIF_TX_SINGLE_PBUF /* * Phase 2: Chain a new pbuf to the end of pcb->unsent. * @@ -491,6 +492,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) * We don't extend segments containing SYN/FIN flags or options * (len==0). The new pbuf is kept in concat_p and pbuf_cat'ed at * the end. + * + * This phase is skipped for LWIP_NETIF_TX_SINGLE_PBUF as we could only execute + * it after rexmit puts a segment from unacked to unsent and at this point, + * oversize info is lost. */ if ((pos < len) && (space > 0) && (last_unsent->len > 0)) { u16_t seglen = LWIP_MIN(space, len - pos); @@ -543,6 +548,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) pos += seglen; } +#endif /* !LWIP_NETIF_TX_SINGLE_PBUF */ } else { #if TCP_OVERSIZE LWIP_ASSERT("unsent_oversize mismatch (pcb->unsent is NULL)",