代码拉取完成,页面将自动刷新
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。