util/startup.lua
changeset 13018 06453c564141
parent 12986 fc0109c59807
child 13123 df57c62165fc
equal deleted inserted replaced
13017:430333198e4c 13018:06453c564141
   428 end
   428 end
   429 
   429 
   430 function startup.prepare_to_start()
   430 function startup.prepare_to_start()
   431 	log("info", "Prosody is using the %s backend for connection handling", server.get_backend());
   431 	log("info", "Prosody is using the %s backend for connection handling", server.get_backend());
   432 	-- Signal to modules that we are ready to start
   432 	-- Signal to modules that we are ready to start
   433 	prosody.events.fire_event("server-starting");
   433 	prosody.started = require "util.promise".new(function (resolve)
   434 	prosody.start_time = os.time();
   434 		prosody.events.add_handler("server-started", function ()
       
   435 			resolve();
       
   436 		end);
       
   437 		prosody.log("debug", "Firing server-starting event");
       
   438 		prosody.events.fire_event("server-starting");
       
   439 		prosody.start_time = os.time();
       
   440 	end):catch(function (err)
       
   441 		prosody.log("error", "Prosody startup error: %s", err);
       
   442 	end);
   435 end
   443 end
   436 
   444 
   437 function startup.init_global_protection()
   445 function startup.init_global_protection()
   438 	-- Catch global accesses
   446 	-- Catch global accesses
   439 	-- luacheck: ignore 212/t
   447 	-- luacheck: ignore 212/t
   474 function startup.log_greeting()
   482 function startup.log_greeting()
   475 	log("info", "Hello and welcome to Prosody version %s", prosody.version);
   483 	log("info", "Hello and welcome to Prosody version %s", prosody.version);
   476 end
   484 end
   477 
   485 
   478 function startup.notify_started()
   486 function startup.notify_started()
   479 	prosody.events.fire_event("server-started");
   487 	require "util.timer".add_task(0, function ()
       
   488 		prosody.log("debug", "Firing server-started event");
       
   489 		prosody.events.fire_event("server-started");
       
   490 	end);
   480 end
   491 end
   481 
   492 
   482 -- Override logging config (used by prosodyctl)
   493 -- Override logging config (used by prosodyctl)
   483 function startup.force_console_logging()
   494 function startup.force_console_logging()
   484 	original_logging_config = config.get("*", "log");
   495 	original_logging_config = config.get("*", "log");