From 92b9277abcb72de83018ba3a56705d052abbb3fd Mon Sep 17 00:00:00 2001 From: huangxin Date: Mon, 30 May 2022 20:16:06 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=AD=A3pbuf?= =?UTF-8?q?=E5=86=85=E5=AD=98=E5=A4=9A=E6=AC=A1=E9=87=8A=E6=94=BE=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- srcs/lwip/src/arch_linux/include/lwipopts.h | 6 +++--- srcs/lwip/src/core/pbuf.c | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/srcs/lwip/src/arch_linux/include/lwipopts.h b/srcs/lwip/src/arch_linux/include/lwipopts.h index 5ace1e9..c681f5a 100644 --- a/srcs/lwip/src/arch_linux/include/lwipopts.h +++ b/srcs/lwip/src/arch_linux/include/lwipopts.h @@ -177,7 +177,7 @@ /** * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ -#define PBUF_POOL_SIZE 10000 +#define PBUF_POOL_SIZE 8 /* --------------------------------- @@ -477,7 +477,7 @@ void sys_unlock_tcpip_core(void); #define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH) //#define ETHARP_DEBUG LWIP_DBG_ON -#define NETIF_DEBUG LWIP_DBG_ON +//#define NETIF_DEBUG LWIP_DBG_ON //#define PBUF_DEBUG LWIP_DBG_ON //#define API_LIB_DEBUG LWIP_DBG_ON //#define API_MSG_DEBUG LWIP_DBG_ON @@ -502,7 +502,7 @@ void sys_unlock_tcpip_core(void); //#define TCP_QLEN_DEBUG LWIP_DBG_ON //#define UDP_DEBUG LWIP_DBG_ON //#define TCPIP_DEBUG LWIP_DBG_ON -#define PPP_DEBUG LWIP_DBG_ON +//#define PPP_DEBUG LWIP_DBG_ON //#define SLIP_DEBUG LWIP_DBG_ON //#define DHCP_DEBUG LWIP_DBG_ON //#define AUTOIP_DEBUG LWIP_DBG_ON diff --git a/srcs/lwip/src/core/pbuf.c b/srcs/lwip/src/core/pbuf.c index 7638dfd..5d6ca20 100644 --- a/srcs/lwip/src/core/pbuf.c +++ b/srcs/lwip/src/core/pbuf.c @@ -750,7 +750,11 @@ pbuf_free(struct pbuf *p) * further protection. */ SYS_ARCH_PROTECT(old_level); /* all pbufs in a chain are referenced at least once */ - LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0); + //LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0); + if(p->ref == 0) { + return 1; + } + /* decrease reference count (number of pointers to pbuf) */ ref = --(p->ref); SYS_ARCH_UNPROTECT(old_level);