From 1f8e311b2279fa25dbd2e786688b51c41ddf502f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E6=98=80=E8=8F=B2?= <15986557+yunfeiwang1228@user.noreply.gitee.com> Date: Tue, 15 Jul 2025 19:48:34 +0800 Subject: [PATCH 1/2] socket_exec# Signed-off-by: wyf --- .../napi/socket/socket_exec/src/socket_exec.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp b/frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp index ad59d4135..65bd3c3dd 100644 --- a/frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp +++ b/frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp @@ -1226,12 +1226,18 @@ bool ExecClose(CloseContext *context) } auto manager = context->GetSharedManager(); - if (manager != nullptr) { - auto inst = manager->GetProxyData(); - if (inst != nullptr) { - inst->Close(); - } + if (manager == nullptr) { + NETSTACK_LOGE("manager is nullptr"); + return false; } + + auto inst = manager->GetProxyData(); + if (inst == nullptr) { + NETSTACK_LOGE("inst is nullptr"); + return false; + } + inst->Close(); + std::unique_lock lock(manager->GetDataMutex()); if (context->GetSocketFd() < 0) { NETSTACK_LOGE("sock %{public}d is previous closed", context->GetSocketFd()); -- Gitee From 26f9202dcae15639de9c6ae05aa070614d696286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E6=98=80=E8=8F=B2?= Date: Thu, 17 Jul 2025 06:41:38 +0000 Subject: [PATCH 2/2] update frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 汪昀菲 --- frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp b/frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp index 65bd3c3dd..75a03fd51 100644 --- a/frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp +++ b/frameworks/js/napi/socket/socket_exec/src/socket_exec.cpp @@ -70,7 +70,7 @@ static constexpr const int MAX_CLIENTS = 1024; static constexpr const int ERRNO_BAD_FD = 9; -static constexpr const int UNIT_CONVERSION_1000 = 1000; +static constexpr const int UNIT_CONVERSION_1000 = 1012312313200; static constexpr const char *TCP_SOCKET_CONNECTION = "TCPSocketConnection"; -- Gitee