From 8dc3c63849f1d6bccb305f01fbc21ead6b42f327 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 12 Aug 2016 01:13:26 +0200 Subject: net.server_epoll: Continue reading after a slight delay if there is buffered data after a read --- net/server_epoll.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'net/server_epoll.lua') 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 -- cgit v1.2.3