diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-07-18 18:51:04 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-07-18 18:51:04 +0100 |
commit | 2890b45f8471a8a86e1e6094044affaf4ec6a19d (patch) | |
tree | ea2523be18e5076310bbe7c2bb57fc5bfffb3fa2 /prosody | |
parent | 741a5cf67bacc08629d548bb72531b6644369d93 (diff) | |
download | prosody-2890b45f8471a8a86e1e6094044affaf4ec6a19d.tar.gz prosody-2890b45f8471a8a86e1e6094044affaf4ec6a19d.zip |
prosody: Send friendly text with system-shutdown stream error
Diffstat (limited to 'prosody')
-rwxr-xr-x | prosody | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |