Software /
code /
prosody
Diff
net/server_epoll.lua @ 11812:42e98179c034
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 20 Sep 2021 15:51:43 +0200 |
parent | 11805:2327e03d1f8d |
parent | 11811:ae43166fe931 |
child | 11813:790bffbb9047 |
line wrap: on
line diff
--- a/net/server_epoll.lua Sun Sep 19 16:28:16 2021 +0200 +++ b/net/server_epoll.lua Mon Sep 20 15:51:43 2021 +0200 @@ -89,6 +89,9 @@ -- Reuse write buffer tables keep_buffers = true; + + --- How long to wait after getting the shutdown signal before forcefully tearing down every socket + shutdown_deadline = 5; }}; local cfg = default_config.__index; @@ -1004,6 +1007,21 @@ if quit then quitting = "quitting"; closeall(); + addtimer(1, function () + if quitting then + closeall(); + return 1; + end + end); + if cfg.shutdown_deadline then + addtimer(cfg.shutdown_deadline, function () + if quitting then + for fd, conn in pairs(fds) do -- luacheck: ignore 213/fd + conn:destroy(); + end + end + end); + end else quitting = nil; end