1 Star 0 Fork 32

吴昌盛/gazelle-tar

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0036-the-sending-of-sock-last-data-is-triggered-by-lstack.patch 2.26 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2022-03-18 15:18 . fix redis get key command block
From 6b05f21de47d2e3a49e6d99ee8a6af773266f117 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng12@huawei.com>
Date: Fri, 18 Mar 2022 14:54:37 +0800
Subject: [PATCH] the sending of sock last data is triggered by lstack
---
src/lstack/core/lstack_lwip.c | 5 +++--
src/lstack/core/lstack_protocol_stack.c | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 7bab92f..b4d75d2 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -214,7 +214,7 @@ void stack_replenish_send_idlembuf(struct protocol_stack *stack)
uint32_t replenish_cnt = rte_ring_free_count(stack->send_idle_ring);
for (uint32_t i = 0; i < replenish_cnt; i++) {
- struct pbuf *pbuf = lwip_alloc_pbuf(PBUF_TRANSPORT, MAX_PACKET_SZ - PBUF_TRANSPORT, PBUF_RAM);
+ struct pbuf *pbuf = lwip_alloc_pbuf(PBUF_TRANSPORT, TCP_MSS, PBUF_RAM);
if (pbuf == NULL) {
break;
}
@@ -361,7 +361,8 @@ void stack_send(struct rpc_msg *msg)
msg->result = write_lwip_data(sock, fd, flags);
__atomic_store_n(&sock->have_rpc_send, false, __ATOMIC_RELEASE);
- if (msg->result >= 0 && rte_ring_count(sock->send_ring)) {
+ if (msg->result >= 0 &&
+ (rte_ring_count(sock->send_ring) || sock->send_lastdata)) {
if (list_is_empty(&sock->send_list)) {
__atomic_store_n(&sock->have_rpc_send, true, __ATOMIC_RELEASE);
list_add_node(&stack->send_list, &sock->send_list);
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 1de546d..e5761a4 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -350,7 +350,8 @@ static void send_stack_list(struct protocol_stack *stack)
ssize_t ret = write_lwip_data(sock, sock->conn->socket, sock->send_flags);
__atomic_store_n(&sock->have_rpc_send, false, __ATOMIC_RELEASE);
- if (ret >= 0 && rte_ring_count(sock->send_ring)) {
+ if (ret >= 0 &&
+ (rte_ring_count(sock->send_ring) || sock->send_lastdata)) {
__atomic_store_n(&sock->have_rpc_send, true, __ATOMIC_RELEASE);
} else {
list_del_node_init(&sock->send_list);
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wu-changsheng/gazelle-tar.git
git@gitee.com:wu-changsheng/gazelle-tar.git
wu-changsheng
gazelle-tar
gazelle-tar
master

搜索帮助