aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-05-02 16:59:37 +0100
committerMatthew Wild <mwild1@gmail.com>2009-05-02 16:59:37 +0100
commitce1be686ab71efb0e68beeb3b292596df38eb602 (patch)
tree33995f56279871b4b5c22bb4c70abed4aeeedf27
parent50945d24e0e8d256221276534d5f90f643c0fc85 (diff)
downloadprosody-ce1be686ab71efb0e68beeb3b292596df38eb602.tar.gz
prosody-ce1be686ab71efb0e68beeb3b292596df38eb602.zip
mod_console: Add s2s:show() command to list s2s connections
-rw-r--r--plugins/mod_console.lua58
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua
index 502e0d06..feff195e 100644
--- a/plugins/mod_console.lua
+++ b/plugins/mod_console.lua
@@ -194,6 +194,64 @@ end
function def_env.hosts:add(name)
end
+def_env.s2s = {};
+function def_env.s2s:show()
+ local _print = self.session.print;
+ local print = self.session.print;
+ 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
+ print(" "..host.." -> "..remotehost);
+ if session.sendq then
+ print(" There are "..#session.sendq.." queued outgoing stanzas for this connection");
+ end
+ if session.type == "s2sout_unauthed" then
+ if session.connecting then
+ print(" Connection not yet established");
+ if not session.srv_hosts then
+ if not session.conn then
+ print(" We do not yet have a DNS answer for this host's SRV records");
+ else
+ print(" This host has no SRV records, using A record instead");
+ end
+ elseif session.srv_choice then
+ print(" We are on SRV record "..session.srv_choice.." of "..#session.srv_hosts);
+ local srv_choice = session.srv_hosts[session.srv_choice];
+ print(" Using "..(srv_choice.target or ".")..":"..(srv_choice.port or 5269));
+ end
+ elseif session.notopen then
+ print(" The <stream> has not yet been opened");
+ elseif not session.dialback_key then
+ print(" Dialback has not been initiated yet");
+ elseif session.dialback_key then
+ print(" Dialback has been requested, but no result received");
+ end
+ end
+ end
+
+ for session in pairs(incoming_s2s) do
+ if session.to_host == host then
+ print(" "..host.." <- "..(session.from_host or "(unknown)"));
+ if session.type == "s2sin_unauthed" then
+ print(" Connection not yet authenticated");
+ end
+ for name in pairs(session.hosts) do
+ if name ~= session.from_host then
+ print(" also hosts "..tostring(name));
+ end
+ end
+ end
+ end
+ print = _print;
+ end
+ for session in pairs(incoming_s2s) do
+ if not session.to_host then
+ print("Other incoming s2s connections");
+ print(" (unknown) <- "..(session.from_host or "(unknown)"));
+ end
+ end
+end
+
-------------
function printbanner(session)