From 4ab3c2ccc73f6a935e05b914adcdafdf416a0f2f Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Fri, 2 Aug 2024 17:09:02 +0800
Subject: [PATCH] WRAP:fix double connect lead posix api disable

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

diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 947b273..5e60c36 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -319,7 +319,7 @@ static int32_t do_connect(int32_t s, const struct sockaddr *name, socklen_t name
     } else {
 	/* When the socket is POSIX_LWIP_OR_KERNEL, connect to lwip first and then connect to kernel. */
         ret = g_wrap_api->connect_fn(s, name, namelen);
-        if (ret == 0) {
+        if (ret == 0 || (ret != 0 && errno == EINPROGRESS)) {
             POSIX_SET_TYPE(sock, POSIX_LWIP);
 	} else {
 	    ret = posix_api->connect_fn(s, name, namelen);
-- 
2.33.0

