From 6fa305e36d968836ce210d09bd72c27722534651 Mon Sep 17 00:00:00 2001 From: "Deomid \"rojer\" Ryabkov" Date: Mon, 15 Mar 2021 21:34:26 +0000 Subject: [PATCH] Remove ESP8266 pbuf chain length check It's been pushed up to LWIP: https://github.com/mongoose-os-libs/lwip/commit/f92662566e71238bd6559b23fee37b0728ecb8e7 --- mongoose.c | 10 ---------- src/common/platforms/lwip/mg_lwip_net_if.c | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/mongoose.c b/mongoose.c index e7be5e00..0f6241f3 100644 --- a/mongoose.c +++ b/mongoose.c @@ -15052,16 +15052,6 @@ static err_t mg_lwip_tcp_recv_cb(void *arg, struct tcp_pcb *tpcb, mgos_lock(); if (cs->rx_chain == NULL) { cs->rx_offset = 0; - } else if (pbuf_clen(cs->rx_chain) >= 4) { - /* ESP SDK has a limited pool of 5 pbufs. We must not hog them all or RX - * will be completely blocked. We already have at least 4 in the chain, - * this one is the last, so we have to make a copy and release this one. */ - struct pbuf *np = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); - if (np != NULL) { - pbuf_copy(np, p); - pbuf_free(p); - p = np; - } } mg_lwip_recv_common(nc, p); mgos_unlock(); diff --git a/src/common/platforms/lwip/mg_lwip_net_if.c b/src/common/platforms/lwip/mg_lwip_net_if.c index d6fdb52d..281ddd3f 100644 --- a/src/common/platforms/lwip/mg_lwip_net_if.c +++ b/src/common/platforms/lwip/mg_lwip_net_if.c @@ -187,16 +187,6 @@ static err_t mg_lwip_tcp_recv_cb(void *arg, struct tcp_pcb *tpcb, mgos_lock(); if (cs->rx_chain == NULL) { cs->rx_offset = 0; - } else if (pbuf_clen(cs->rx_chain) >= 4) { - /* ESP SDK has a limited pool of 5 pbufs. We must not hog them all or RX - * will be completely blocked. We already have at least 4 in the chain, - * this one is the last, so we have to make a copy and release this one. */ - struct pbuf *np = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); - if (np != NULL) { - pbuf_copy(np, p); - pbuf_free(p); - p = np; - } } mg_lwip_recv_common(nc, p); mgos_unlock();