Comparison

plugins/mod_admin_telnet.lua @ 10095:a3c66d0294e1

mod_admin_telnet: Use already generated session id Don't need to construct it from components again
author Kim Alvefur <zash@zash.se>
date Sun, 28 Jul 2019 01:43:10 +0200
parent 10094:6b1e89868328
child 10239:5c8526790a18
comparison
equal deleted inserted replaced
10094:6b1e89868328 10095:a3c66d0294e1
908 elseif from == to then 908 elseif from == to then
909 return false, "Both from and to are the same... you can't do that :)"; 909 return false, "Both from and to are the same... you can't do that :)";
910 end 910 end
911 911
912 for _, session in pairs(s2s_sessions) do 912 for _, session in pairs(s2s_sessions) do
913 local id = session.type..tostring(session):match("[a-f0-9]+$"); 913 local id = session.id or (session.type..tostring(session):match("[a-f0-9]+$"));
914 if (match_id and match_id == id) 914 if (match_id and match_id == id)
915 or (session.from_host == from and session.to_host == to) then 915 or (session.from_host == from and session.to_host == to) then
916 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id)); 916 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id));
917 (session.close or s2smanager.destroy_session)(session, build_reason(text, condition)); 917 (session.close or s2smanager.destroy_session)(session, build_reason(text, condition));
918 count = count + 1 ; 918 count = count + 1 ;