# HG changeset patch # User Matthew Wild # Date 1247939464 -3600 # Node ID 04442f3ebe40c4dfc066835d1b3f213a6eda3e7b # Parent a8c14a350de56ee7a99383dce3b54c8b81608667 prosody: Send friendly text with system-shutdown stream error diff -r a8c14a350de5 -r 04442f3ebe40 prosody --- a/prosody Sat Jul 18 18:49:54 2009 +0100 +++ b/prosody Sat Jul 18 18:51:04 2009 +0100 @@ -119,6 +119,7 @@ -- 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 @@ 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