Software /
code /
prosody-modules
Comparison
mod_graceful_shutdown/mod_graceful_shutdown.lua @ 4892:8dbaa5e753f3
mod_graceful_shutdown: Deactivate direct TLS c2s along with plain c2s
Stops clients from reconnecting that way after their sessions are closed
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 11 Feb 2022 16:11:55 +0100 |
parent | 2170:4652a112a4ba |
child | 4893:d4ce29c772ac |
comparison
equal
deleted
inserted
replaced
4891:99cdc7cde150 | 4892:8dbaa5e753f3 |
---|---|
18 prosody.shutdown_code = code; | 18 prosody.shutdown_code = code; |
19 timer.add_task(pause, prosody.shutdown); | 19 timer.add_task(pause, prosody.shutdown); |
20 coroutine.yield(true, "shutdown initiated"); | 20 coroutine.yield(true, "shutdown initiated"); |
21 -- Close c2s ports, stop accepting new connections | 21 -- Close c2s ports, stop accepting new connections |
22 portman.deactivate("c2s"); | 22 portman.deactivate("c2s"); |
23 portman.deactivate("legacy_ssl"); | |
24 portman.deactivate("c2s_direct_tls"); | |
25 | |
23 -- Close all c2s sessions | 26 -- Close all c2s sessions |
24 for _, sess in pairs(prosody.full_sessions) do | 27 for _, sess in pairs(prosody.full_sessions) do |
25 sess:close{ condition = "system-shutdown", text = reason } | 28 sess:close{ condition = "system-shutdown", text = reason } |
26 end | 29 end |
27 -- Wait for notifications to be sent | 30 -- Wait for notifications to be sent |