Diff

plugins/mod_bosh.lua @ 2354:5a00668ba0ab

mod_bosh: Delay setup until after server is started.
author Waqas Hussain <waqas20@gmail.com>
date Thu, 10 Dec 2009 16:21:06 +0500
parent 2099:73e083d01449
child 2373:13090fc6ad90
line wrap: on
line diff
--- a/plugins/mod_bosh.lua	Thu Dec 10 05:08:59 2009 +0500
+++ b/plugins/mod_bosh.lua	Thu Dec 10 16:21:06 2009 +0500
@@ -298,7 +298,14 @@
 	end
 end
 
-local ports = module:get_option("bosh_ports") or { 5280 };
-httpserver.new_from_config(ports, handle_request, { base = "http-bind" });
 
-server.addtimer(on_timer);
+local function setup()
+	local ports = module:get_option("bosh_ports") or { 5280 };
+	httpserver.new_from_config(ports, handle_request, { base = "http-bind" });
+	server.addtimer(on_timer);
+end
+if prosody.start_time then -- already started
+	setup();
+else
+	prosody.events.add_handler("server-started", setup);
+end