aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-09-20 15:51:43 +0200
committerKim Alvefur <zash@zash.se>2021-09-20 15:51:43 +0200
commitda8329037d6ee0cd1514437cd9c5ac1e73188027 (patch)
tree451443aa649e739a5f9aa193f8e956f6fc74b4c9 /net
parentb49c57d53ff76e47389f7bb9fa6d5d0853fd2b66 (diff)
parent24111569bb5b75ea37cbf2c29d49d88206365ae2 (diff)
downloadprosody-da8329037d6ee0cd1514437cd9c5ac1e73188027.tar.gz
prosody-da8329037d6ee0cd1514437cd9c5ac1e73188027.zip
Merge 0.11->trunk
Diffstat (limited to 'net')
-rw-r--r--net/server_epoll.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 610a0fbf..90d3929f 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -89,6 +89,9 @@ local default_config = { __index = {
-- 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 @@ local function setquitting(quit)
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