aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-16 14:53:29 +0200
committerKim Alvefur <zash@zash.se>2016-08-16 14:53:29 +0200
commit04b12c371638b06ba91d6e003894d06257b7c479 (patch)
tree92dadc8db6a5388938aeeb5c5803f69d6b9905e7
parentbf7da12bdfdfc10679e69640a76d0c2e314cba0c (diff)
downloadprosody-04b12c371638b06ba91d6e003894d06257b7c479.tar.gz
prosody-04b12c371638b06ba91d6e003894d06257b7c479.zip
net.server_epoll: Clear write flag before calling ondrain, fixes calling of ondisconnect on explicit close
-rw-r--r--net/server_epoll.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index fa79837d..f73b1a8c 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -250,13 +250,9 @@ function interface:onwriteable()
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