diff mod_admin_web/admin_web/mod_admin_web.lua @ 295:e373de5907aa

mod_admin_web: Only create the node once when loading onto multiple hosts
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 24 Dec 2010 01:59:28 +0100
parents a9e69088e678
children b241c79a0eb7
line wrap: on
line diff
--- a/mod_admin_web/admin_web/mod_admin_web.lua	Thu Dec 23 22:40:58 2010 +0100
+++ b/mod_admin_web/admin_web/mod_admin_web.lua	Fri Dec 24 01:59:28 2010 +0100
@@ -118,9 +118,11 @@
 	local host_session = prosody.hosts[host];
 	local http_conf = config.get("*", "core", "webadmin_http_ports");
 
-	local ok, errmsg = hosts[service].modules.pubsub.service:create(xmlns_sessions, service);
-	if not ok then
-		error("Could not create node: " .. tostring(errmsg));
+	if not select(2, hosts[service].modules.pubsub.service:get_nodes(service))[xmlns_sessions] then
+		local ok, errmsg = hosts[service].modules.pubsub.service:create(xmlns_sessions, service);
+		if not ok then
+			error("Could not create node: " .. tostring(errmsg));
+		end
 	end
 
 	for remotehost, session in pairs(host_session.s2sout) do