Changeset

7564:f95ffd24e042

net.server_epoll: Clear write flag before calling ondrain, fixes calling of ondisconnect on explicit close
author Kim Alvefur <zash@zash.se>
date Tue, 16 Aug 2016 14:53:29 +0200
parents 7563:71dc0d89a9b8
children 7573:0f0a6febbc5a
files net/server_epoll.lua
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Sun Aug 14 01:09:55 2016 +0200
+++ b/net/server_epoll.lua	Tue Aug 16 14:53:29 2016 +0200
@@ -250,13 +250,9 @@
 		for i = #buffer, 1, -1 do
 			buffer[i] = nil;
 		end
-		self:ondrain();
-		if not buffer[1] then
-			self:setflags(nil, false);
-			self:setwritetimeout(false);
-		else
-			self:setwritetimeout();
-		end
+		self:setflags(nil, false);
+		self:setwritetimeout(false);
+		self:ondrain(); -- Be aware of writes in ondrain
 	elseif partial then
 		buffer[1] = data:sub(partial+1)
 		for i = #buffer, 2, -1 do