10 Star 4 Fork 33

src-openEuler/gazelle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0251-fix-when-errno-is-ENOTCONN-ignore-it.patch 2.85 KB
一键复制 编辑 原始数据 按行查看 历史
From 015eea5899cfea961247686d711a67917cb7a7b9 Mon Sep 17 00:00:00 2001
From: hkk <hankangkang5@huawei.com>
Date: Thu, 5 Sep 2024 14:37:07 +0800
Subject: [PATCH] fix: when errno is ENOTCONN, ignore it
---
src/lstack/core/lstack_protocol_stack.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index ba90d86..49b3ec8 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -559,18 +559,18 @@ int32_t stack_group_init_mempool(void)
LSTACK_LOG(INFO, LSTACK,
"config::num_cpu=%d num_process=%d \n", cfg_params->num_cpu, cfg_params->num_process);
-
+
for (int cpu_idx = 0; cpu_idx < cfg_params->num_queue; cpu_idx++) {
cpu_id = cfg_params->cpus[cpu_idx];
numa_id = numa_node_of_cpu(cpu_id);
-
+
for (int process_idx = 0; process_idx < cfg_params->num_process; process_idx++) {
queue_id = cpu_idx * cfg_params->num_process + process_idx;
if (queue_id >= PROTOCOL_STACK_MAX) {
LSTACK_LOG(ERR, LSTACK, "index is over\n");
return -1;
}
-
+
total_mbufs = (total_conn_mbufs / cfg_params->num_queue) + total_nic_mbufs + MBUFPOOL_RESERVE_NUM;
rxtx_mbuf = create_pktmbuf_mempool("rxtx_mbuf", total_mbufs, RXTX_CACHE_SZ, queue_id, numa_id);
if (rxtx_mbuf == NULL) {
@@ -578,7 +578,7 @@ int32_t stack_group_init_mempool(void)
cpu_id, numa_id, queue_id);
return -1;
}
-
+
get_protocol_stack_group()->total_rxtx_pktmbuf_pool[queue_id] = rxtx_mbuf;
}
}
@@ -723,13 +723,13 @@ void stack_close(struct rpc_msg *msg)
int32_t fd = msg->args[MSG_ARG_0].i;
struct protocol_stack *stack = get_protocol_stack_by_fd(fd);
struct lwip_sock *sock = lwip_get_socket(fd);
-
+
if (sock && __atomic_load_n(&sock->call_num, __ATOMIC_ACQUIRE) > 0) {
msg->recall_flag = 1;
rpc_call(&stack->rpc_queue, msg); /* until stack_send recall finish */
return;
}
-
+
msg->result = lwip_close(fd);
if (msg->result != 0) {
LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d failed %ld\n", get_stack_tid(), msg->args[MSG_ARG_0].i, msg->result);
@@ -750,7 +750,7 @@ void stack_shutdown(struct rpc_msg *msg)
}
msg->result = lwip_shutdown(fd, how);
- if (msg->result != 0) {
+ if (msg->result != 0 && errno != ENOTCONN) {
LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d fail %ld\n", get_stack_tid(), fd, msg->result);
}
@@ -935,7 +935,7 @@ void stack_udp_send(struct rpc_msg *msg)
rpc_call_replenish(&stack->rpc_queue, sock);
return;
}
-
+
__sync_fetch_and_sub(&sock->call_num, 1);
return;
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/gazelle.git
git@gitee.com:src-openeuler/gazelle.git
src-openeuler
gazelle
gazelle
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385