aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-12 01:13:26 +0200
committerKim Alvefur <zash@zash.se>2016-08-12 01:13:26 +0200
commitfd025274c6f71d82cd2494f6c2deadf134f8d45e (patch)
tree6085241bdf81493cebe2caeb5834458a4eef9642
parent488af5f9a8904b4304cb90a38526cc8160bf89ff (diff)
downloadprosody-fd025274c6f71d82cd2494f6c2deadf134f8d45e.tar.gz
prosody-fd025274c6f71d82cd2494f6c2deadf134f8d45e.zip
net.server_epoll: Continue reading after a slight delay if there is buffered data after a read
-rw-r--r--net/server_epoll.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 66d9841c..7bc93b33 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -28,6 +28,7 @@ local cfg = {
write_timeout = 7;
tcp_backlog = 128;
accept_retry_interval = 10;
+ read_retry_delay = 1e-06;
};
local fds = createtable(10, 0); -- FD -> conn
@@ -236,6 +237,9 @@ function interface:onreadable()
return;
end
self:setreadtimeout();
+ if self.conn:dirty() then
+ self:pausefor(cfg.read_retry_delay);
+ end
end
function interface:onwriteable()
@@ -420,6 +424,9 @@ function interface:pausefor(t)
self._pausefor = addtimer(t, function ()
self._pausefor = nil;
self:setflags(true);
+ if self.conn:dirty() then
+ self:onreadable();
+ end
end);
end