diff mod_admin_web/admin_web/mod_admin_web.lua @ 303:0f53c88bab9a

mod_admin_web: Move pubsub service initialisation into a server-started handler, in case we get loaded before the service
author Matthew Wild <mwild1@gmail.com>
date Mon, 27 Dec 2010 04:24:44 +0000
parents b241c79a0eb7
children 8f3499ae1e27
line wrap: on
line diff
--- a/mod_admin_web/admin_web/mod_admin_web.lua	Mon Dec 27 04:24:34 2010 +0100
+++ b/mod_admin_web/admin_web/mod_admin_web.lua	Mon Dec 27 04:24:44 2010 +0000
@@ -151,6 +151,10 @@
 	local host_session = prosody.hosts[host];
 	local http_conf = config.get("*", "core", "webadmin_http_ports");
 
+	httpserver.new_from_config(http_conf, handle_file_request, { base = "admin" });
+end
+
+module:hook("server-started", function ()
 	if not select(2, hosts[service].modules.pubsub.service:get_nodes(service))[xmlns_s2s_session] then
 		local ok, errmsg = hosts[service].modules.pubsub.service:create(xmlns_s2s_session, service);
 		if not ok then
@@ -181,9 +185,7 @@
 			add_client(session);
 		end
 	end
-
-	httpserver.new_from_config(http_conf, handle_file_request, { base = "admin" });
-end
+end);
 
 module:hook("resource-bind", function(event)
 	add_client(event.session);