mod_s2s: Close connections attached to a host being deactivated
authorKim Alvefur <zash@zash.se>
Wed, 14 Jul 2021 02:39:54 +0200
changeset 11687 41b144a93897
parent 11686 7843f1ca3b33
child 11688 8b0baf3003fb
mod_s2s: Close connections attached to a host being deactivated Couldn't use those with the host being deactivated. Problem: This kicks in on reload, which isn't needed.
plugins/mod_s2s.lua
--- a/plugins/mod_s2s.lua	Wed Jul 14 02:41:15 2021 +0200
+++ b/plugins/mod_s2s.lua	Wed Jul 14 02:39:54 2021 +0200
@@ -259,6 +259,14 @@
 			return true;
 		end
 	end, -1);
+
+	function module.unload()
+		for _, session in pairs(sessions) do
+			if session.to_host == module.host or session.from_host == module.host then
+				session:close("host-gone");
+			end
+		end
+	end
 end
 
 -- Stream is authorised, and ready for normal stanzas