Comparison

plugins/mod_s2s.lua @ 12299:ff36ac5c7d2b

mod_s2s: Disable creation of new outgoing connections during shutdown
author Kim Alvefur <zash@zash.se>
date Fri, 11 Feb 2022 21:41:04 +0100
parent 12298:cb459f8fa740
child 12301:4f1fe6eb1ddb
comparison
equal deleted inserted replaced
12298:cb459f8fa740 12299:ff36ac5c7d2b
962 local pm = require "core.portmanager"; 962 local pm = require "core.portmanager";
963 for _, netservice in pairs(module.items["net-provider"]) do 963 for _, netservice in pairs(module.items["net-provider"]) do
964 pm.unregister_service(netservice.name, netservice); 964 pm.unregister_service(netservice.name, netservice);
965 end 965 end
966 966
967 -- Stop opening new connections
968 for host in pairs(prosody.hosts) do
969 if prosody.hosts[host].modules.s2s then
970 module:context(host):unhook("route/remote", route_to_new_session);
971 end
972 end
973
967 -- Close sessions 974 -- Close sessions
968 local reason = event.reason; 975 local reason = event.reason;
969 for _, session in pairs(sessions) do 976 for _, session in pairs(sessions) do
970 session:close{ condition = "system-shutdown", text = reason }; 977 session:close{ condition = "system-shutdown", text = reason };
971 end 978 end