diff options
author | Kim Alvefur <zash@zash.se> | 2016-08-18 17:41:00 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-08-18 17:41:00 +0200 |
commit | c41b7e9f46cbe2f8f2b251f825dcfebf86d17cf9 (patch) | |
tree | 1d02824355af30da2929e2e62f546555d5ac45c1 /net/server_epoll.lua | |
parent | 5ce8cd7c944d2e59621a79fb0fdc51a49f42af5e (diff) | |
download | prosody-c41b7e9f46cbe2f8f2b251f825dcfebf86d17cf9.tar.gz prosody-c41b7e9f46cbe2f8f2b251f825dcfebf86d17cf9.zip |
net.server_epoll: Set timers before calling onincoming, fixes traceback if connection is closed before onincoming returns
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r-- | net/server_epoll.lua | 12 |
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 |