changeset 727:99f5846bcd85

mod_host_guard: during configuration reload the host handlers should be reinitialized as well, so reverted changed and added back the "redundant code".
author Marco Cirillo <maranda@lightwitch.org>
date Tue, 26 Jun 2012 10:57:24 +0000
parents 455a9b8fac27
children 8ad2e24f5efd
files mod_host_guard/mod_host_guard.lua
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_host_guard/mod_host_guard.lua	Mon Jun 25 23:53:40 2012 +0000
+++ b/mod_host_guard/mod_host_guard.lua	Tue Jun 26 10:57:24 2012 +0000
@@ -64,7 +64,14 @@
 
 local function init_hosts()
 	for n in pairs(hosts) do
-		if guard_blockall:contains(n) or guard_protect:contains(n) then	handle_activation(n) end
+		if guard_blockall:contains(n) or guard_protect:contains(n) then
+			-- required as during config:reload() handlers should be reinitialized as well.
+			hosts[n].events.remove_handler("s2sin-established", s2s_hook)
+			hosts[n].events.remove_handler("route/remote", rr_hook)
+			hosts[n].events.remove_handler("stanza/jabber:server:dialback:result", s2s_hook)
+			
+			handle_activation(n) 
+		end
 	end
 end