Changeset

11813:790bffbb9047

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
author Kim Alvefur <zash@zash.se>
date Wed, 22 Sep 2021 11:27:55 +0200
parents 11812:42e98179c034
children 11814:f27b9319e0da
files net/server_epoll.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Mon Sep 20 15:51:43 2021 +0200
+++ b/net/server_epoll.lua	Wed Sep 22 11:27:55 2021 +0200
@@ -573,7 +573,7 @@
 
 -- 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();