11 Star 75 Fork 103

OpenHarmony/third_party_lwip

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
0032-fix-free-pbuf-miss-data.patch 2.09 KB
一键复制 编辑 原始数据 按行查看 历史
Aurora 提交于 2023-12-07 03:26 . update lwip to 2.1.3-39.oe2203sp1
From 0c7d7ad7f9a79a557a867a6009aa2aac067d454e Mon Sep 17 00:00:00 2001
From: wuchangsheng <wuchangsheng2@huawei.com>
Date: Thu, 6 Oct 2022 21:07:12 +0800
Subject: [PATCH] fix free pbuf miss data
---
src/core/tcp_out.c | 18 ++++++++++++++++++
src/include/lwipopts.h | 2 +-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index dd780d3..2834ba3 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -682,11 +682,24 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
if (queuelen > LWIP_MIN(TCP_SND_QUEUELEN, TCP_SNDQUEUELEN_OVERFLOW)) {
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_write: queue too long %"U16_F" (%d)\n",
queuelen, (int)TCP_SND_QUEUELEN));
+#if USE_LIBOS
+ if (pos > 0) {
+ queuelen -= pbuf_clen(p);
+ break;
+ }
+#else
pbuf_free(p);
+#endif
goto memerr;
}
if ((seg = tcp_create_segment(pcb, p, 0, pcb->snd_lbb + pos, optflags)) == NULL) {
+#if USE_LIBOS
+ if (pos > 0) {
+ queuelen -= pbuf_clen(p);
+ break;
+ }
+#endif
goto memerr;
}
#if TCP_OVERSIZE_DBGCHECK
@@ -714,6 +727,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
lwip_ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg)));
pos += seglen;
+#if USE_LIBOS
+ write_lwip_over((struct lwip_sock*)arg, 1);
+#endif
}
/*
@@ -825,12 +841,14 @@ memerr:
tcp_set_flags(pcb, TF_NAGLEMEMERR);
TCP_STATS_INC(tcp.memerr);
+#if !USE_LIBOS
if (concat_p != NULL) {
pbuf_free(concat_p);
}
if (queue != NULL) {
tcp_segs_free(queue);
}
+#endif
if (pcb->snd_queuelen != 0) {
LWIP_ASSERT("tcp_write: valid queue length", pcb->unacked != NULL ||
pcb->unsent != NULL);
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 75d3c74..7459991 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -133,7 +133,7 @@
#define USE_LIBOS 1
-#define LWIP_DEBUG 1
+//#define LWIP_DEBUG 1
#define LWIP_PERF 1
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/third_party_lwip.git
git@gitee.com:openharmony/third_party_lwip.git
openharmony
third_party_lwip
third_party_lwip
master

搜索帮助