mod_s2s: Disable creation of new outgoing connections during shutdown
authorKim Alvefur <zash@zash.se>
Fri, 11 Feb 2022 21:41:04 +0100
changeset 12303 ff36ac5c7d2b
parent 12302 cb459f8fa740
child 12304 fb74ff16620c
mod_s2s: Disable creation of new outgoing connections during shutdown
plugins/mod_s2s.lua
--- a/plugins/mod_s2s.lua	Fri Feb 11 21:36:53 2022 +0100
+++ b/plugins/mod_s2s.lua	Fri Feb 11 21:41:04 2022 +0100
@@ -964,6 +964,13 @@
 		pm.unregister_service(netservice.name, netservice);
 	end
 
+	-- Stop opening new connections
+	for host in pairs(prosody.hosts) do
+		if prosody.hosts[host].modules.s2s then
+			module:context(host):unhook("route/remote", route_to_new_session);
+		end
+	end
+
 	-- Close sessions
 	local reason = event.reason;
 	for _, session in pairs(sessions) do