Changeset

10491:6f7a77aff9d5

net.server_epoll: Change timer rescheduling method to match util.timer Relative to current time instead of absolute time, in preparation for switching to monotonic time.
author Kim Alvefur <zash@zash.se>
date Sun, 08 Dec 2019 14:20:56 +0100 (2019-12-08)
parents 10490:c9cff02c0528
children 10492:8e1d9bba9244
files net/server_epoll.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Sun Dec 08 13:40:42 2019 +0100
+++ b/net/server_epoll.lua	Sun Dec 08 14:20:56 2019 +0100
@@ -86,6 +86,7 @@
 end
 
 local function reschedule(t, time)
+	time = gettime() + time;
 	t[1] = time;
 	timers:reprioritize(t.id, time);
 end
@@ -253,7 +254,7 @@
 	end
 	t = t or cfg.read_timeout;
 	if self._readtimeout then
-		self._readtimeout:reschedule(gettime() + t);
+		self._readtimeout:reschedule(t);
 	else
 		self._readtimeout = addtimer(t, function ()
 			if self:on("readtimeout") then
@@ -279,7 +280,7 @@
 	end
 	t = t or cfg.send_timeout;
 	if self._writetimeout then
-		self._writetimeout:reschedule(gettime() + t);
+		self._writetimeout:reschedule(t);
 	else
 		self._writetimeout = addtimer(t, function ()
 			self:debug("Write timeout");