From 53e047492b5d5711a5990f7b8e4965723ef2a536 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 18 Aug 2016 16:41:22 +0200 Subject: net.server_epoll: Prevent further writing after closing a socket --- net/server_epoll.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'net') diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 62fb9863..89f358a5 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -334,10 +334,13 @@ interface.send = interface.write; function interface:close() if self._wantwrite then + self:setflags(false, true); -- Flush final buffer contents + self.write, self.send = noop, noop; -- No more writing log("debug", "Close %s after writing", tostring(self)); self._toclose = true; else log("debug", "Close %s now", tostring(self)); + self.write, self.send = noop, noop; self.close = noop; self:on("disconnect"); self:destroy(); -- cgit v1.2.3