aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-18 17:41:00 +0200
committerKim Alvefur <zash@zash.se>2016-08-18 17:41:00 +0200
commitc41b7e9f46cbe2f8f2b251f825dcfebf86d17cf9 (patch)
tree1d02824355af30da2929e2e62f546555d5ac45c1
parent5ce8cd7c944d2e59621a79fb0fdc51a49f42af5e (diff)
downloadprosody-c41b7e9f46cbe2f8f2b251f825dcfebf86d17cf9.tar.gz
prosody-c41b7e9f46cbe2f8f2b251f825dcfebf86d17cf9.zip
net.server_epoll: Set timers before calling onincoming, fixes traceback if connection is closed before onincoming returns
-rw-r--r--net/server_epoll.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 20c49daf..b3d24c7b 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -268,6 +268,12 @@ end
-- Called when socket is readable
function interface:onreadable()
local data, err, partial = self.conn:receive(self._pattern);
+ if self.conn:dirty() then
+ self:setreadtimeout(false);
+ self:pausefor(cfg.read_retry_delay);
+ else
+ self:setreadtimeout();
+ end
if data or partial then
self:on("incoming", data or partial, err);
end
@@ -280,12 +286,6 @@ function interface:onreadable()
self:destroy()
return;
end
- if self.conn:dirty() then
- self:setreadtimeout(false);
- self:pausefor(cfg.read_retry_delay);
- else
- self:setreadtimeout();
- end
end
-- Called when socket is writable