prosody
changeset 8685 151ecd18d624
parent 8638 47e3b8b6f17a
child 8717 e1c4bdb2cd25
equal deleted inserted replaced
8684:0c077800cd70 8685:151ecd18d624
    48 	print("Perhaps you meant to use prosodyctl instead?");
    48 	print("Perhaps you meant to use prosodyctl instead?");
    49 	return 1;
    49 	return 1;
    50 end
    50 end
    51 
    51 
    52 local startup = require "util.startup";
    52 local startup = require "util.startup";
       
    53 local async = require "util.async";
    53 
    54 
    54 startup.prosody();
    55 -- Note: it's important that this thread is not GC'd, as some C libraries
       
    56 -- that are initialized here store a pointer to it ( :/ ).
       
    57 local thread = async.runner();
       
    58 
       
    59 thread:run(startup.prosody);
    55 
    60 
    56 local function loop()
    61 local function loop()
    57 	-- Error handler for errors that make it this far
    62 	-- Error handler for errors that make it this far
    58 	local function catch_uncaught_error(err)
    63 	local function catch_uncaught_error(err)
    59 		if type(err) == "string" and err:match("interrupted!$") then
    64 		if type(err) == "string" and err:match("interrupted!$") then
    86 log("info", "Shutting down...");
    91 log("info", "Shutting down...");
    87 cleanup();
    92 cleanup();
    88 prosody.events.fire_event("server-stopped");
    93 prosody.events.fire_event("server-stopped");
    89 log("info", "Shutdown complete");
    94 log("info", "Shutdown complete");
    90 
    95 
    91 os.exit(prosody.shutdown_code)
    96 os.exit(prosody.shutdown_code);