aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_epoll.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-22 17:13:39 +0200
committerKim Alvefur <zash@zash.se>2016-08-22 17:13:39 +0200
commite0bc7dd70fca9540373bcab41010941be5765c42 (patch)
treece2409a32e893ac002a7f3a41dbc1c5c6807d42b /net/server_epoll.lua
parent65802705d25e52b4e7df5b0c11d7d697c33c77b9 (diff)
downloadprosody-e0bc7dd70fca9540373bcab41010941be5765c42.tar.gz
prosody-e0bc7dd70fca9540373bcab41010941be5765c42.zip
net.server_epoll: Comments
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r--net/server_epoll.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 542441f4..c3b9974c 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -85,7 +85,8 @@ local function runtimers(next_delay)
for i = #timers, 1, -1 do
local timer = timers[i];
local t, f = timer[1], timer[2];
- local now = gettime(); -- inside or before the loop?
+ -- Get time for every iteration to increase accuracy
+ local now = gettime();
if t > now then
-- This timer should not fire yet
local diff = t - now;
@@ -96,6 +97,8 @@ local function runtimers(next_delay)
end
local new_timeout = f(now);
if new_timeout then
+ -- Schedlue for 'delay' from the time actually sheduled,
+ -- not from now, in order to prevent timer drift.
timer[1] = t + new_timeout;
resort_timers = true;
else
@@ -487,6 +490,7 @@ function interface:resume()
self:setflags(true);
end
+-- Pause connection for some time
function interface:pausefor(t)
if self._pausefor then
self._pausefor:close();