aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
commit286527bbc911a241e2b7c287686056dcc68c12ba (patch)
tree1d02824355af30da2929e2e62f546555d5ac45c1 /net
parent782117034dc44969e35e4d35663045e5658b2913 (diff)
downloadprosody-286527bbc911a241e2b7c287686056dcc68c12ba.tar.gz
prosody-286527bbc911a241e2b7c287686056dcc68c12ba.zip
net.server_epoll: Set timers before calling onincoming, fixes traceback if connection is closed before onincoming returns
Diffstat (limited to 'net')
-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