1 Star 0 Fork 48

zhangyulongkylinos/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0033-alloc-socket-fail-clean-sock.patch 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
吴昌盛 提交于 2022-10-11 21:50 . alloc socket fail clean sock
From fc2a5b52f7d9f02eb43931414767635e5cf4c8c1 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Tue, 11 Oct 2022 21:47:24 +0800
Subject: [PATCH] alloc socket fail clean sock
---
src/api/sockets.c | 3 +++
src/include/lwipsock.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 14f2b35..3552599 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -598,6 +598,9 @@ alloc_socket(struct netconn *newconn, int accepted)
sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1);
sockets[i].errevent = 0;
return i + LWIP_SOCKET_OFFSET;
+ } else {
+ lwip_close(i);
+ gazelle_clean_sock(i);
}
err:
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index 912d471..2ffb077 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -130,6 +130,7 @@ extern void add_recv_list(int32_t fd);
extern ssize_t read_lwip_data(struct lwip_sock *sock, int32_t flags, u8_t apiflags);
extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8_t *apiflags);
extern void gazelle_init_sock(int32_t fd);
+extern void gazelle_clean_sock(int32_t fd);
extern void write_lwip_over(struct lwip_sock *sock, uint32_t n);
#endif /* USE_LIBOS */
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangyulongkylinos/lwip.git
git@gitee.com:zhangyulongkylinos/lwip.git
zhangyulongkylinos
lwip
lwip
master

搜索帮助