Software /
code /
prosody
Changeset
10845:785fa0112411
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 16 May 2020 20:46:12 +0200 |
parents | 10844:05f4386c846e |
children | 10846:d0b098d0f6c3 |
files | plugins/mod_admin_telnet.lua |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua Fri May 15 21:26:54 2020 +0200 +++ b/plugins/mod_admin_telnet.lua Sat May 16 20:46:12 2020 +0200 @@ -161,6 +161,20 @@ 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);