From 5ca16b89699250a52d11ee5a181fef227fd399b6 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 18 Dec 2023 10:50:53 +0800
Subject: [PATCH] optimize shutdown exit process

---
 src/lstack/core/lstack_protocol_stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 8dbd9ad..564f055 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -722,7 +722,7 @@ void stack_shutdown(struct rpc_msg *msg)
     struct protocol_stack *stack = get_protocol_stack_by_fd(fd);
     struct lwip_sock *sock = get_socket(fd);
 
-    if (sock && NETCONN_IS_DATAOUT(sock)) {
+    if (sock && __atomic_load_n(&sock->call_num, __ATOMIC_ACQUIRE) > 0) {
         msg->recall_flag = 1;
         rpc_call(&stack->rpc_queue, msg);
         return;
-- 
2.27.0

