Comparison

plugins/mod_admin_telnet.lua @ 6838:229e95aecf41

mod_admin_telnet: Fix indentation
author Kim Alvefur <zash@zash.se>
date Fri, 18 Sep 2015 16:16:10 +0200
parent 6781:05cd80ec107c
child 6839:298182fd2387
child 6927:566e1cfcb814
comparison
equal deleted inserted replaced
6837:13b44929ae49 6838:229e95aecf41
828 or (session.from_host == from and session.to_host == to) then 828 or (session.from_host == from and session.to_host == to) then
829 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id)); 829 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id));
830 (session.close or s2smanager.destroy_session)(session); 830 (session.close or s2smanager.destroy_session)(session);
831 count = count + 1 ; 831 count = count + 1 ;
832 end 832 end
833 end 833 end
834 return true, "Closed "..count.." s2s session"..((count == 1 and "") or "s"); 834 return true, "Closed "..count.." s2s session"..((count == 1 and "") or "s");
835 end 835 end
836 836
837 function def_env.s2s:closeall(host) 837 function def_env.s2s:closeall(host)
838 local count = 0; 838 local count = 0;
839 local s2s_sessions = module:shared"/*/s2s/sessions"; 839 local s2s_sessions = module:shared"/*/s2s/sessions";
840 for _,session in pairs(s2s_sessions) do 840 for _,session in pairs(s2s_sessions) do
841 if not host or session.from_host == host or session.to_host == host then 841 if not host or session.from_host == host or session.to_host == host then
842 session:close(); 842 session:close();
843 count = count + 1; 843 count = count + 1;
844 end 844 end
845 end 845 end
846 if count == 0 then return false, "No sessions to close."; 846 if count == 0 then return false, "No sessions to close.";
847 else return true, "Closed "..count.." s2s session"..((count == 1 and "") or "s"); end 847 else return true, "Closed "..count.." s2s session"..((count == 1 and "") or "s"); end
848 end 848 end
849 849
850 def_env.host = {}; def_env.hosts = def_env.host; 850 def_env.host = {}; def_env.hosts = def_env.host;