Diff

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
line wrap: on
line diff
--- 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