1 Star 0 Fork 32

hantwofish/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0093-fix-gazellectl-c-msg-error.patch 1.78 KB
一键复制 编辑 原始数据 按行查看 历史
From 887130c90c7875b4c0860ed0667224418e690752 Mon Sep 17 00:00:00 2001
From: jinag12 <jiangheng14@huawei.com>
Date: Thu, 21 Dec 2023 09:03:02 +0000
Subject: [PATCH] fix gazellectl -c msg error
Signed-off-by: jinag12 <jiangheng14@huawei.com>
---
src/lstack/core/lstack_lwip.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 15f99f9..1913d03 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -1158,15 +1158,14 @@ static void copy_pcb_to_conn(struct gazelle_stat_lstack_conn_info *conn, const s
conn->keep_intvl = pcb->keep_intvl;
conn->keep_cnt = pcb->keep_cnt;
- if (netconn != NULL && netconn->recvmbox != NULL) {
- conn->recv_cnt = rte_ring_count(netconn->recvmbox->ring);
+ if (netconn != NULL) {
conn->fd = netconn->socket;
-
+ conn->recv_cnt = (netconn->recvmbox == NULL) ? 0 : rte_ring_count(netconn->recvmbox->ring);
struct lwip_sock *sock = get_socket(netconn->socket);
- if (netconn->socket > 0 && sock != NULL && sock->recv_ring != NULL && sock->send_ring != NULL) {
- conn->recv_ring_cnt = gazelle_ring_readable_count(sock->recv_ring);
+ if (sock != NULL) {
+ conn->recv_ring_cnt = (sock->recv_ring == NULL) ? 0 : gazelle_ring_readable_count(sock->recv_ring);
conn->recv_ring_cnt += (sock->recv_lastdata) ? 1 : 0;
- conn->send_ring_cnt = gazelle_ring_readover_count(sock->send_ring);
+ conn->send_ring_cnt = (sock->send_ring == NULL) ? 0 : gazelle_ring_readover_count(sock->send_ring);
conn->events = sock->events;
conn->epoll_events = sock->epoll_events;
conn->eventlist = !list_is_null(&sock->event_list);
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hantwofish/gazelle_1.git
git@gitee.com:hantwofish/gazelle_1.git
hantwofish
gazelle_1
gazelle_1
master

搜索帮助