Software /
code /
prosody
Diff
net/server_epoll.lua @ 12828:f33887f925e1
net.server_epoll: Remove delay on last main loop iteration when quitting
Main difference is that timers are not checked unconditionally before
each poll, only when running out of previous poll results (hidden by
util.poll). This removes a final poll at shutdown that usually delays
the 'not quitting' condition check by one second.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 06 Jan 2023 04:38:39 +0100 |
parent | 12827:0605d4f03e25 |
child | 12974:ba409c67353b |
line wrap: on
line diff
--- a/net/server_epoll.lua Fri Jan 06 02:31:21 2023 +0100 +++ b/net/server_epoll.lua Fri Jan 06 04:38:39 2023 +0100 @@ -1109,10 +1109,11 @@ return loop_once(); end - repeat - local t = runtimers(cfg.max_wait, cfg.min_wait); + local t = 0; + while not quitting do local fd, r, w = poll:wait(t); - while fd do + if fd then + t = 0; local conn = fds[fd]; if conn then if r then @@ -1125,12 +1126,12 @@ log("debug", "Removing unknown fd %d", fd); poll:del(fd); end - fd, r, w = poll:wait(0); - end - if r ~= "timeout" and r ~= "signal" then + elseif r == "timeout" then + t = runtimers(cfg.max_wait, cfg.min_wait); + elseif r ~= "signal" then log("debug", "epoll_wait error: %s[%d]", r, w); end - until (quitting and next(fds) == nil); + end return quitting; end