aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_admin_shell.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-11-27 14:15:55 +0100
committerKim Alvefur <zash@zash.se>2021-11-27 14:15:55 +0100
commit769a3ed263b5ff865bdac6bd6ccaf54ca650b8f6 (patch)
treeeaecfbe35ec2177a3e7a3273dc83bbed5c97557a /plugins/mod_admin_shell.lua
parent10664a88770bd63639c0da9ab311d3e4f2301dcf (diff)
downloadprosody-769a3ed263b5ff865bdac6bd6ccaf54ca650b8f6.tar.gz
prosody-769a3ed263b5ff865bdac6bd6ccaf54ca650b8f6.zip
mod_admin_shell: Remove now redundant promise awaiting in xmpp:ping()
Diffstat (limited to 'plugins/mod_admin_shell.lua')
-rw-r--r--plugins/mod_admin_shell.lua9
1 files changed, 3 insertions, 6 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index 2cdea60d..abfade16 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -1350,12 +1350,9 @@ function def_env.xmpp:ping(localhost, remotehost, timeout)
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_for(module:context(localhost):send_iq(iq, nil, timeout));
- if ret then
- return true, ("pong from %s in %gs"):format(ret.stanza.attr.from, time.now() - time_start);
- else
- return false, tostring(err);
- end
+ return module:context(localhost):send_iq(iq, nil, timeout):next(function (pong)
+ return ("pong from %s in %gs"):format(pong.stanza.attr.from, time.now() - time_start);
+ end);
end
def_env.dns = {};