Software /
code /
prosody
Changeset
10310:b03065cd033a
mod_admin_telnet: xmpp:ping: Log ping time
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 06 Oct 2019 19:35:35 +0200 |
parents | 10309:2a31571efce0 |
children | 10311:1bb1e16f24b0 |
files | plugins/mod_admin_telnet.lua |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua Sun Oct 06 19:34:03 2019 +0200 +++ b/plugins/mod_admin_telnet.lua Sun Oct 06 19:35:35 2019 +0200 @@ -33,6 +33,7 @@ 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 @@ 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