# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1241292737 -3600
# Node ID 5ca2d3a332698c3c2690bb2cd0070ba9e2e564f7
# Parent  e47310ca513b6430e155b0d9ac8bc5da326c2b4a
prosody: Define prosody_shutdown() before emitting the server-starting event

diff -r e47310ca513b -r 5ca2d3a33269 prosody
--- a/prosody	Sat May 02 20:30:50 2009 +0100
+++ b/prosody	Sat May 02 20:32:17 2009 +0100
@@ -114,8 +114,17 @@
 
 ----------- End of out-of-place code --------------
 
+-- Global function to initiate prosody shutdown
+function prosody_shutdown(reason)
+	log("info", "Shutting down: %s", reason or "unknown reason");
+	eventmanager.fire_event("server-stopping", { reason = reason });
+	server.setquitting(true);
+end
+
+-- Signal to modules that we are ready to start
 eventmanager.fire_event("server-starting");
 
+-- Load SSL settings from config, and create a ctx table
 local global_ssl_ctx = ssl and config.get("*", "core", "ssl");
 if global_ssl_ctx then
 	local default_ssl_ctx = { mode = "server", protocol = "sslv23", capath = "/etc/ssl/certs", verify = "none"; };
@@ -153,13 +162,6 @@
 	cl.start("console", { interface = config.get("*", "core", "console_interface") or "127.0.0.1" })
 end
 
--- Global function to initiate prosody shutdown
-function prosody_shutdown(reason)
-	log("info", "Shutting down: %s", reason or "unknown reason");
-	eventmanager.fire_event("server-stopping", { reason = reason });
-	server.setquitting(true);
-end
-
 -- Catch global accesses --
 local locked_globals_mt = { __index = function (t, k) error("Attempt to read a non-existent global '"..k.."'", 2); end, __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end }