aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-12-28 15:14:11 +0100
committerKim Alvefur <zash@zash.se>2012-12-28 15:14:11 +0100
commit45f6b0c64c3ab63603fe8bc8b29f2dbc835b4e92 (patch)
tree0203d6bd6df69296fe7defc78a44293a3e08767d /plugins
parent93fcefee1c694c8917be74879d4d204730904e07 (diff)
parent71f54b16f9bf4a2561f80058affb049850c90327 (diff)
downloadprosody-45f6b0c64c3ab63603fe8bc8b29f2dbc835b4e92.tar.gz
prosody-45f6b0c64c3ab63603fe8bc8b29f2dbc835b4e92.zip
Merge 0.9->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_admin_telnet.lua2
-rw-r--r--plugins/mod_c2s.lua9
-rw-r--r--plugins/mod_s2s/mod_s2s.lua9
3 files changed, 20 insertions, 0 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 12ab2355..e1b90684 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -149,6 +149,7 @@ function console_listener.onincoming(conn, data)
end
for line in data:gmatch("[^\n]*[\n\004]") do
+ if session.closed then return end
console:process_line(session, line);
session.send(string.char(0));
end
@@ -168,6 +169,7 @@ end
function commands.bye(session)
session.print("See you! :)");
+ session.closed = true;
session.disconnect();
end
commands.quit, commands.exit = commands.bye, commands.bye;
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index 72085113..89d678ca 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -265,6 +265,15 @@ function listener.associate_session(conn, session)
sessions[conn] = session;
end
+module:hook("server-stopping", function(event)
+ local reason = event.reason;
+ for _, session in pairs(sessions) do
+ session:close{ condition = "system-shutdown", text = reason };
+ end
+end, 1000);
+
+
+
module:provides("net", {
name = "c2s";
listener = listener;
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index 788a64af..ad628a9b 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -506,6 +506,15 @@ end
s2sout.set_listener(listener);
+module:hook("server-stopping", function(event)
+ local reason = event.reason;
+ for _, session in pairs(sessions) do
+ session:close{ condition = "system-shutdown", text = reason };
+ end
+end,500);
+
+
+
module:provides("net", {
name = "s2s";
listener = listener;