diff options
author | Kim Alvefur <zash@zash.se> | 2016-08-22 17:12:58 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-08-22 17:12:58 +0200 |
commit | 65802705d25e52b4e7df5b0c11d7d697c33c77b9 (patch) | |
tree | 8a733ea7ad64b042a8458a788118011dc2ab91a4 | |
parent | b64910fc5d530f585e294c22eb9f6bb16130c990 (diff) | |
download | prosody-65802705d25e52b4e7df5b0c11d7d697c33c77b9.tar.gz prosody-65802705d25e52b4e7df5b0c11d7d697c33c77b9.zip |
net.server_epoll: Make maximum wait time configurable
-rw-r--r-- | net/server_epoll.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index b3d24c7b..542441f4 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -34,6 +34,7 @@ local cfg = { read_retry_delay = 1e-06; connect_timeout = 20; handshake_timeout = 60; + max_wait = 86400; }; local fds = createtable(10, 0); -- FD -> conn @@ -63,7 +64,7 @@ end -- Run callbacks of expired timers -- Return time until next timeout -local function runtimers() +local function runtimers(next_delay) if resort_timers then -- Sort earliest timers to the end t_sort(timers, function (a, b) return a[1] > b[1]; end); @@ -80,8 +81,6 @@ local function runtimers() end --]] - local next_delay = 86400; - -- Iterate from the end and remove completed timers for i = #timers, 1, -1 do local timer = timers[i]; @@ -579,7 +578,7 @@ end local function loop() repeat - local t = runtimers(); + local t = runtimers(cfg.max_wait); local fd, r, w = epoll.wait(t); if fd then local conn = fds[fd]; |