aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_admin_telnet.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-10-06 19:35:35 +0200
committerKim Alvefur <zash@zash.se>2019-10-06 19:35:35 +0200
commit7b43531fa9779ba0ec001e87cbe5004cc8e303f1 (patch)
tree0f3d588eca10df99ff99cc0861893d3c584e2f6f /plugins/mod_admin_telnet.lua
parent193bc49cac95c2876afcd223379a93eff9855770 (diff)
downloadprosody-7b43531fa9779ba0ec001e87cbe5004cc8e303f1.tar.gz
prosody-7b43531fa9779ba0ec001e87cbe5004cc8e303f1.zip
mod_admin_telnet: xmpp:ping: Log ping time
Diffstat (limited to 'plugins/mod_admin_telnet.lua')
-rw-r--r--plugins/mod_admin_telnet.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 24230257..afb4fb4b 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -33,6 +33,7 @@ local envloadfile = require "util.envload".envloadfile;
local has_pposix, pposix = pcall(require, "util.pposix");
local async = require "util.async";
local serialize = require "util.serialization".new({ fatal = false, unquoted = true});
+local time = require "util.time";
local commands = module:shared("commands")
local def_env = module:shared("env");
@@ -1148,9 +1149,10 @@ function def_env.xmpp:ping(localhost, remotehost, timeout)
end
local iq = st.iq{ from=localhost, to=remotehost, type="get", id=new_id()}
:tag("ping", {xmlns="urn:xmpp:ping"});
+ local time_start = time.now();
local ret, err = async.wait(module:context(localhost):send_iq(iq, nil, timeout));
if ret then
- return true, "pong from " .. ret.stanza.attr.from;
+ return true, ("pong from %s in %gs"):format(ret.stanza.attr.from, time.now() - time_start);
else
return false, tostring(err);
end