From 474f04e8640337193c425a635df60df82aaa684a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BB=94?= <41766775+huahua132@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:26:40 +0800 Subject: [PATCH] fix socketchannel closed thread not wakeup (#2020) --- lualib/skynet/socketchannel.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lualib/skynet/socketchannel.lua b/lualib/skynet/socketchannel.lua index 24e8de75..b7646fd5 100644 --- a/lualib/skynet/socketchannel.lua +++ b/lualib/skynet/socketchannel.lua @@ -116,6 +116,11 @@ local function dispatch_by_session(self) end skynet.wakeup(co) end + if not self.__sock then + -- closed + wakeup_all(self, "channel_closed") + break + end else self.__thread[session] = nil skynet.error("socket: unknown session :", session) @@ -211,6 +216,11 @@ local function dispatch_by_order(self) self.__result_data[co] = result_data end skynet.wakeup(co) + if not self.__sock then + -- closed + wakeup_all(self, "channel_closed") + break + end else close_channel_socket(self) local errmsg