Comparison

net/server_epoll.lua @ 11658:36942fa001b4

net.server_epoll: Ensure timeout after closing This should make sure that if there's data left to be written when closing a connection, there's also a timeout so that it doesn't wait forever.
author Kim Alvefur <zash@zash.se>
date Sat, 31 Oct 2020 00:33:29 +0100
parent 11595:8985efc6792d
child 11659:00295a8e5bcf
comparison
equal deleted inserted replaced
11657:46fa1b939e88 11658:36942fa001b4
512 512
513 -- Close, possibly after writing is done 513 -- Close, possibly after writing is done
514 function interface:close() 514 function interface:close()
515 if self.writebuffer and self.writebuffer[1] then 515 if self.writebuffer and self.writebuffer[1] then
516 self:set(false, true); -- Flush final buffer contents 516 self:set(false, true); -- Flush final buffer contents
517 self:setwritetimeout();
517 self.write, self.send = noop, noop; -- No more writing 518 self.write, self.send = noop, noop; -- No more writing
518 self:debug("Close after writing remaining buffered data"); 519 self:debug("Close after writing remaining buffered data");
519 self.ondrain = interface.close; 520 self.ondrain = interface.close;
520 else 521 else
521 self:debug("Closing now"); 522 self:debug("Closing now");