Changeset

7593:0266434d7df1

net.server_epoll: Prevent further writing after closing a socket
author Kim Alvefur <zash@zash.se>
date Thu, 18 Aug 2016 16:41:22 +0200
parents 7592:10d2f008321d
children 7594:5e884501a9ac
files net/server_epoll.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Thu Aug 18 16:33:12 2016 +0200
+++ b/net/server_epoll.lua	Thu Aug 18 16:41:22 2016 +0200
@@ -334,10 +334,13 @@
 
 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();