Software /
code /
prosody
Changeset
7606:f40f1d9b7872
net.server_epoll: Set timers before calling onincoming, fixes traceback if connection is closed before onincoming returns
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 18 Aug 2016 17:41:00 +0200 |
parents | 7605:2481ebc7f715 |
children | 7619:f5016c8985d7 |
files | net/server_epoll.lua |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_epoll.lua Thu Aug 18 17:36:46 2016 +0200 +++ b/net/server_epoll.lua Thu Aug 18 17:41:00 2016 +0200 @@ -268,6 +268,12 @@ -- 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 @@ 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