From c080e30b41f47848de441e96232d255e541a7c1a Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Thu, 1 Aug 2024 15:55:50 +0800
Subject: [PATCH] fix redis coredump: ctrl+c during the pressure test

---
 src/lstack/core/lstack_protocol_stack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 2867711..f0f2735 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -882,7 +882,7 @@ void stack_tcp_send(struct rpc_msg *msg)
     int replenish_again;
 
     struct lwip_sock *sock = lwip_get_socket(fd);
-    if (sock == NULL) {
+    if (POSIX_IS_CLOSED(sock)) {
         msg->result = -1;
         LSTACK_LOG(ERR, LSTACK, "get sock error! fd=%d, len=%ld\n", fd, len);
         return;
@@ -919,6 +919,6 @@ void stack_udp_send(struct rpc_msg *msg)
 
     struct lwip_sock *sock = lwip_get_socket(fd);
-    if (sock == NULL) {
+    if (POSIX_IS_CLOSED(sock)) {
         msg->result = -1;
         LSTACK_LOG(ERR, LSTACK, "get sock error! fd=%d, len=%ld\n", fd, len);
         return;
-- 
2.33.0

