# HG changeset patch # User Matthew Wild # Date 1363951494 0 # Node ID 38e7a5fafb28aba2970d023c6cd4b27f85d9e0d3 # Parent e44cfbf0ae8d22d3158db19cb56a5a36fb48e0fe hostmanager: Use rawget to check for activated hosts to prevent recursion in dynamic host loaders diff -r e44cfbf0ae8d -r 38e7a5fafb28 core/hostmanager.lua --- a/core/hostmanager.lua Fri Mar 22 11:24:13 2013 +0000 +++ b/core/hostmanager.lua Fri Mar 22 11:24:54 2013 +0000 @@ -25,7 +25,7 @@ local incoming_s2s = _G.prosody.incoming_s2s; local core_route_stanza = _G.prosody.core_route_stanza; -local pairs, select = pairs, select; +local pairs, select, rawget = pairs, select, rawget; local tostring, type = tostring, type; module "hostmanager" @@ -67,7 +67,7 @@ end function activate(host, host_config) - if hosts[host] then return nil, "The host "..host.." is already activated"; end + if rawget(hosts, host) then return nil, "The host "..host.." is already activated"; end host_config = host_config or configmanager.getconfig()[host]; if not host_config then return nil, "Couldn't find the host "..tostring(host).." defined in the current config"; end local host_session = {