aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-05-16 20:46:12 +0200
committerKim Alvefur <zash@zash.se>2020-05-16 20:46:12 +0200
commit29f51d7e6dd71d1a702410cf24ea59edd7e5afcd (patch)
tree019ff34d10a19d52645bfe4497a1075500b10de2
parente32f71d3d4ee4a69f57bf6891f8a255fa884f4ba (diff)
downloadprosody-29f51d7e6dd71d1a702410cf24ea59edd7e5afcd.tar.gz
prosody-29f51d7e6dd71d1a702410cf24ea59edd7e5afcd.zip
mod_admin_telnet: Update existing sessions on reload
This removes the need to disconnect and reconnect to the telnet console for changes to take effect.
-rw-r--r--plugins/mod_admin_telnet.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 3014517c..a082a851 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -161,6 +161,20 @@ end
local sessions = {};
+function module.save()
+ return { sessions = sessions }
+end
+
+function module.restore(data)
+ if data.sessions then
+ for conn in pairs(data.sessions) do
+ conn:setlistener(console_listener);
+ local session = console:new_session(conn);
+ sessions[conn] = session;
+ end
+ end
+end
+
function console_listener.onconnect(conn)
-- Handle new connection
local session = console:new_session(conn);