From 2890b45f8471a8a86e1e6094044affaf4ec6a19d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 18 Jul 2009 18:51:04 +0100 Subject: prosody: Send friendly text with system-shutdown stream error --- prosody | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'prosody') diff --git a/prosody b/prosody index 4e9ab2cc..e0d9f768 100755 --- a/prosody +++ b/prosody @@ -119,6 +119,7 @@ function init_global_state() -- Function to initiate prosody shutdown function prosody.shutdown(reason) log("info", "Shutting down: %s", reason or "unknown reason"); + prosody.shutdown_reason = reason; prosody.events.fire_event("server-stopping", {reason = reason}); server.setquitting(true); end @@ -278,10 +279,14 @@ function cleanup() for hostname, host in pairs(hosts) do log("debug", "Shutdown status: Closing client connections for %s", hostname) if host.sessions then + local reason = { condition = "system-shutdown", text = "Server is shutting down" }; + if prosody.shutdown_reason then + reason.text = reason.text..": "..prosody.shutdown_reason; + end for username, user in pairs(host.sessions) do for resource, session in pairs(user.sessions) do log("debug", "Closing connection for %s@%s/%s", username, hostname, resource); - session:close("system-shutdown"); + session:close(reason); end end end -- cgit v1.2.3