66 lines
2.2 KiB
Diff
66 lines
2.2 KiB
Diff
From 30d1ef00734485405c4babbf7d4cfe670ac8b52f Mon Sep 17 00:00:00 2001
|
|
From: Lemmy Huang <huangliming5@huawei.com>
|
|
Date: Fri, 2 Jun 2023 15:31:08 +0800
|
|
Subject: [PATCH] fix socket init and clean
|
|
|
|
Signed-off-by: Lemmy Huang <huangliming5@huawei.com>
|
|
---
|
|
src/lstack/core/lstack_lwip.c | 6 +-----
|
|
src/lstack/core/lstack_protocol_stack.c | 6 ------
|
|
2 files changed, 1 insertion(+), 11 deletions(-)
|
|
|
|
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
|
index 2e40862..ca63c22 100644
|
|
--- a/src/lstack/core/lstack_lwip.c
|
|
+++ b/src/lstack/core/lstack_lwip.c
|
|
@@ -173,7 +173,7 @@ void gazelle_init_sock(int32_t fd)
|
|
static _Atomic uint32_t name_tick = 0;
|
|
struct protocol_stack *stack = get_protocol_stack();
|
|
struct lwip_sock *sock = lwip_get_socket_nouse(fd);
|
|
- if (sock == NULL || sock->conn == NULL) {
|
|
+ if (sock == NULL) {
|
|
return;
|
|
}
|
|
|
|
@@ -1248,13 +1248,9 @@ int32_t gazelle_socket(int domain, int type, int protocol)
|
|
return fd;
|
|
}
|
|
|
|
- gazelle_init_sock(fd);
|
|
-
|
|
struct lwip_sock *sock = lwip_get_socket_nouse(fd);
|
|
if (sock == NULL || sock->conn == NULL || sock->stack == NULL) {
|
|
lwip_close(fd);
|
|
- gazelle_clean_sock(fd);
|
|
- posix_api->close_fn(fd);
|
|
return -1;
|
|
}
|
|
|
|
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
|
index 8638cd5..2fbe62c 100644
|
|
--- a/src/lstack/core/lstack_protocol_stack.c
|
|
+++ b/src/lstack/core/lstack_protocol_stack.c
|
|
@@ -639,10 +639,6 @@ void stack_close(struct rpc_msg *msg)
|
|
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);
|
|
}
|
|
-
|
|
- gazelle_clean_sock(fd);
|
|
-
|
|
- posix_api->close_fn(fd);
|
|
}
|
|
|
|
void stack_bind(struct rpc_msg *msg)
|
|
@@ -685,8 +681,6 @@ void stack_accept(struct rpc_msg *msg)
|
|
struct lwip_sock *sock = lwip_get_socket_nouse(accept_fd);
|
|
if (sock == NULL || sock->conn == NULL || sock->stack == NULL) {
|
|
lwip_close(accept_fd);
|
|
- gazelle_clean_sock(accept_fd);
|
|
- posix_api->close_fn(accept_fd);
|
|
LSTACK_LOG(ERR, LSTACK, "fd %d ret %d\n", fd, accept_fd);
|
|
return;
|
|
}
|
|
--
|
|
2.23.0
|
|
|