Software /
code /
prosody
Changeset
11702:c206430e2643
net.server_epoll: Ensure timeouts match epoll flags
Read and write timeouts should usually match whether we want to read or
write.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 17 Jul 2021 14:54:48 +0200 |
parents | 11701:a3572205c5bf |
children | 11703:e57c5d9c722c |
files | net/server_epoll.lua |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_epoll.lua Sat Jul 17 14:51:50 2021 +0200 +++ b/net/server_epoll.lua Sat Jul 17 14:54:48 2021 +0200 @@ -430,6 +430,7 @@ err = "timeout"; elseif err == "wantwrite" then self:set(nil, true); + self:setwritetimeout(); err = "timeout"; elseif err == "timeout" and not self._connected then err = "connection timeout"; @@ -510,8 +511,10 @@ end if err == "wantwrite" or err == "timeout" then self:set(nil, true); + self:setwritetimeout(); elseif err == "wantread" then self:set(true, nil); + self:setreadtimeout(); elseif err ~= "timeout" then self:on("disconnect", err); self:destroy(); @@ -553,6 +556,7 @@ function interface:close() if self.writebuffer and (self.writebuffer[1] or type(self.writebuffer) == "string") then self:set(false, true); -- Flush final buffer contents + self:setreadtimeout(false); self:setwritetimeout(); self.write, self.send = noop, noop; -- No more writing self:debug("Close after writing remaining buffered data"); @@ -772,11 +776,13 @@ function interface:pause() self:noise("Pause reading"); + self:setreadtimeout(false); return self:set(false); end function interface:resume() self:noise("Resume reading"); + self:setreadtimeout(); return self:set(true); end