# HG changeset patch # User Waqas Hussain # Date 1260444093 -18000 # Node ID 08f02de5ab9df722fea6f74171360ce2c30b3944 # Parent 5a00668ba0ab37f1e7c9b585b75037b31c848635 mod_httpserver: Delay setup until after server is started. diff -r 5a00668ba0ab -r 08f02de5ab9d plugins/mod_httpserver.lua --- a/plugins/mod_httpserver.lua Thu Dec 10 16:21:06 2009 +0500 +++ b/plugins/mod_httpserver.lua Thu Dec 10 16:21:33 2009 +0500 @@ -56,6 +56,13 @@ return serve_file(path); end -local ports = config.get(module.host, "core", "http_ports") or { 5280 }; -httpserver.set_default_handler(handle_default_request); -httpserver.new_from_config(ports, handle_file_request, { base = "files" }); +local function setup() + local ports = config.get(module.host, "core", "http_ports") or { 5280 }; + httpserver.set_default_handler(handle_default_request); + httpserver.new_from_config(ports, handle_file_request, { base = "files" }); +end +if prosody.start_time then -- already started + setup(); +else + prosody.events.add_handler("server-started", setup); +end