From ef4af820d50031d0b17771ffb2fe90d34e9c497c Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Fri, 21 May 2021 10:15:21 +0800 Subject: [PATCH] Do not resume the fd after closing, see #1408 --- lualib/skynet/socket.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lualib/skynet/socket.lua b/lualib/skynet/socket.lua index 2ba2a32e..2c44d052 100644 --- a/lualib/skynet/socket.lua +++ b/lualib/skynet/socket.lua @@ -28,7 +28,7 @@ local function wakeup(s) end local function pause_socket(s, size) - if s.pause then + if s.pause ~= nil then return end if size then @@ -254,7 +254,7 @@ end function socket.pause(id) local s = socket_pool[id] - if s == nil or s.pause then + if s == nil then return end pause_socket(s) @@ -280,6 +280,7 @@ function socket.close(id) end driver.close(id) if s.connected then + s.pause = false -- Do not resume this fd if it paused. if s.co then -- reading this socket on another coroutine, so don't shutdown (clear the buffer) immediately -- wait reading coroutine read the buffer.