加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0168-fix-tcp-recv-does-not-return-pkg-when-ring-buffer-is.patch 959 Bytes
一键复制 编辑 原始数据 按行查看 历史
yc555 提交于 2024-04-19 16:05 . sync adapt dpdk-23.11 remove kni
From 5fff605ff68741482d7fff992343eaccb383115f Mon Sep 17 00:00:00 2001
From: li_yunqing <liyunqing@kylinos.cn>
Date: Fri, 22 Mar 2024 15:47:19 +0800
Subject: [PATCH] fix tcp recv does not return pkg when ring buffer is empty
---
src/lstack/core/lstack_lwip.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index a604a62..51238ba 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -925,7 +925,9 @@ static ssize_t recv_ring_tcp_read(struct lwip_sock *sock, void *buf, size_t len,
}
while (recv_left > 0) {
- if (recv_ring_get_one(sock, noblock, &pbuf) != 0) {
+ if (recv_ring_get_one(sock, noblock | recvd, &pbuf) != 0) {
+ /* When the buffer is empty, it will be returned directly
+ if in non-blocking mode or if data has already been received */
break;
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化