Software /
code /
prosody
Changeset
1322:33d103b0283f
mod_console: Show total incoming/outgoing s2s connections
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 06 Jun 2009 21:29:34 +0100 |
parents | 1321:0698d0d39b35 |
children | 1328:0709c9564b1c |
files | plugins/mod_console.lua |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_console.lua Sat Jun 06 17:17:16 2009 +0100 +++ b/plugins/mod_console.lua Sat Jun 06 21:29:34 2009 +0100 @@ -318,10 +318,14 @@ function def_env.s2s:show(match_jid) local _print = self.session.print; local print = self.session.print; + + local count_in, count_out = 0,0; + for host, host_session in pairs(hosts) do print = function (...) _print(host); _print(...); print = _print; end for remotehost, session in pairs(host_session.s2sout) do if (not match_jid) or remotehost:match(match_jid) or host:match(match_jid) then + count_out = count_out + 1; print(" "..host.." -> "..remotehost); if session.sendq then print(" There are "..#session.sendq.." queued outgoing stanzas for this connection"); @@ -354,6 +358,7 @@ for session in pairs(incoming_s2s) do if session.to_host == host and ((not match_jid) or host:match(match_jid) or (session.from_host and session.from_host:match(match_jid))) then + count_in = count_in + 1; print(" "..host.." <- "..(session.from_host or "(unknown)")); if session.type == "s2sin_unauthed" then print(" Connection not yet authenticated"); @@ -371,10 +376,13 @@ for session in pairs(incoming_s2s) do if not session.to_host and ((not match_jid) or session.from_host and session.from_host:match(match_jid)) then + count_in = count_in + 1; print("Other incoming s2s connections"); print(" (unknown) <- "..(session.from_host or "(unknown)")); end end + + return true, "Total: "..count_out.." outgoing, "..count_in.." incoming connections"; end -------------