Changeset

7560:785fa1138293

net.server_epoll: Continue reading after a slight delay if there is buffered data after a read
author Kim Alvefur <zash@zash.se>
date Fri, 12 Aug 2016 01:13:26 +0200
parents 7559:b1b27dedf4cf
children 7562:bc40f6d626a0
files net/server_epoll.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Fri Aug 12 01:11:59 2016 +0200
+++ b/net/server_epoll.lua	Fri Aug 12 01:13:26 2016 +0200
@@ -28,6 +28,7 @@
 	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 @@
 		return;
 	end
 	self:setreadtimeout();
+	if self.conn:dirty() then
+		self:pausefor(cfg.read_retry_delay);
+	end
 end
 
 function interface:onwriteable()
@@ -420,6 +424,9 @@
 	self._pausefor = addtimer(t, function ()
 		self._pausefor = nil;
 		self:setflags(true);
+		if self.conn:dirty() then
+			self:onreadable();
+		end
 	end);
 end