From 7e8a3af45fd5448056ff016ddb171b20e791c43b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 22 Sep 2021 11:27:55 +0200 Subject: net.server_epoll: Skip attempt to flush write buffer when not connected Before 22825cb5dcd8 connection attempts that failed (e.g. connection refused) would be immediately destroyed. After, it would schedule another write cycle and then report 'ondisconnect' again when failing. Thanks Martin for reporting --- net/server_epoll.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 90d3929f..ec2dd5b8 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -573,7 +573,7 @@ interface.send = interface.write; -- Close, possibly after writing is done function interface:close() - if self.writebuffer and (self.writebuffer[1] or type(self.writebuffer) == "string") then + if self._connected and self.writebuffer and (self.writebuffer[1] or type(self.writebuffer) == "string") then self:set(false, true); -- Flush final buffer contents self:setreadtimeout(false); self:setwritetimeout(); -- cgit v1.2.3