Comparison

net/server_epoll.lua @ 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
parent 11812:42e98179c034
child 11814:f27b9319e0da
comparison
equal deleted inserted replaced
11812:42e98179c034 11813:790bffbb9047
571 end 571 end
572 interface.send = interface.write; 572 interface.send = interface.write;
573 573
574 -- Close, possibly after writing is done 574 -- Close, possibly after writing is done
575 function interface:close() 575 function interface:close()
576 if self.writebuffer and (self.writebuffer[1] or type(self.writebuffer) == "string") then 576 if self._connected and self.writebuffer and (self.writebuffer[1] or type(self.writebuffer) == "string") then
577 self:set(false, true); -- Flush final buffer contents 577 self:set(false, true); -- Flush final buffer contents
578 self:setreadtimeout(false); 578 self:setreadtimeout(false);
579 self:setwritetimeout(); 579 self:setwritetimeout();
580 self.write, self.send = noop, noop; -- No more writing 580 self.write, self.send = noop, noop; -- No more writing
581 self:debug("Close after writing remaining buffered data"); 581 self:debug("Close after writing remaining buffered data");