aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-07-18 18:51:04 +0100
committerMatthew Wild <mwild1@gmail.com>2009-07-18 18:51:04 +0100
commit2890b45f8471a8a86e1e6094044affaf4ec6a19d (patch)
treeea2523be18e5076310bbe7c2bb57fc5bfffb3fa2
parent741a5cf67bacc08629d548bb72531b6644369d93 (diff)
downloadprosody-2890b45f8471a8a86e1e6094044affaf4ec6a19d.tar.gz
prosody-2890b45f8471a8a86e1e6094044affaf4ec6a19d.zip
prosody: Send friendly text with system-shutdown stream error
-rwxr-xr-xprosody7
1 files changed, 6 insertions, 1 deletions
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