Changeset

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
parents 2353:54e650624ded
children 2355:08f02de5ab9d
files plugins/mod_bosh.lua
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
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