# HG changeset patch # User Kim Alvefur # Date 1471352009 -7200 # Node ID f95ffd24e0423beab84a4ce15ce866fa55ae32e3 # Parent 71dc0d89a9b8991fac6f76c8501da7877d468fc9 net.server_epoll: Clear write flag before calling ondrain, fixes calling of ondisconnect on explicit close diff -r 71dc0d89a9b8 -r f95ffd24e042 net/server_epoll.lua --- 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