aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
commit8dc3c63849f1d6bccb305f01fbc21ead6b42f327 (patch)
tree6085241bdf81493cebe2caeb5834458a4eef9642 /net
parentcd4065264283a20c1ec1b90443724a5e743604ac (diff)
downloadprosody-8dc3c63849f1d6bccb305f01fbc21ead6b42f327.tar.gz
prosody-8dc3c63849f1d6bccb305f01fbc21ead6b42f327.zip
net.server_epoll: Continue reading after a slight delay if there is buffered data after a read
Diffstat (limited to 'net')
-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