From 61b0c0cd3ad805281ea5021278ecd6372296c9c5 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 19 Nov 2024 00:41:02 +0100 Subject: net.server_epoll: Don't try to flush buffer on closed connections Attempt to fix a bug where connections are somehow closed twice, leading to bad things happening elsewhere. With LuaSec, closed connections are generally already too closed to write anything to anyway since it does not support unidirectional shutdown. --- net/server_epoll.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/server_epoll.lua b/net/server_epoll.lua index ce2782c1..b4477375 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -508,7 +508,8 @@ function interface:onreadable() end if err == "closed" and self._connected then self:debug("Connection closed by remote"); - self:close(err); + self:on("disconnect", err); + self:destroy(); return; elseif err ~= "timeout" then self:debug("Read error, closing (%s)", err); -- cgit v1.2.3