1 Star 0 Fork 96

sky/gazelle_kylin_src

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0225-add-socket-check-before-write-it.patch 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
compile_success 提交于 2023-12-04 02:54 . add select and timeout for kylin
From da9f7797985fe2cc7bd6a5f1a5837bd833838982 Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Mon, 27 Mar 2023 22:15:48 +0800
Subject: [PATCH] add socket check before write it
---
src/lstack/api/lstack_wrap.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index aacb30c..f81328d 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -75,7 +75,9 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd, struct lwip_sock **socke
}
if (likely(CONN_TYPE_IS_LIBOS(sock->conn))) {
- *socket = sock;
+ if (socket) {
+ *socket = sock;
+ }
return PATH_LWIP;
}
@@ -83,7 +85,9 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd, struct lwip_sock **socke
/* after lwip connect, call send immediately, pcb->state is SYN_SENT, need return PATH_LWIP */
/* pcb->state default value is CLOSED when call socket, need return PATH_UNKNOW */
if (pcb != NULL && pcb->state <= ESTABLISHED && pcb->state >= LISTEN) {
- *socket = sock;
+ if (socket) {
+ *socket = sock;
+ }
return PATH_LWIP;
}
@@ -273,6 +277,7 @@ static int32_t do_connect(int32_t s, const struct sockaddr *name, socklen_t name
return posix_api->connect_fn(s, name, namelen);
}
+ sock = get_socket(s);
if (sock == NULL) {
return posix_api->connect_fn(s, name, namelen);
}
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nlgwcy/gazelle_kylin_src.git
git@gitee.com:nlgwcy/gazelle_kylin_src.git
nlgwcy
gazelle_kylin_src
gazelle_kylin_src
master

搜索帮助