28 lines
959 B
Diff
28 lines
959 B
Diff
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
|
|
|