Software /
code /
prosody
Comparison
plugins/mod_admin_shell.lua @ 11953:848a522fd731
mod_admin_shell: Remove now redundant promise awaiting in xmpp:ping()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 27 Nov 2021 14:15:55 +0100 |
parent | 11950:d2a9e95fd27b |
child | 11954:b963ac00c967 |
comparison
equal
deleted
inserted
replaced
11952:b78a341e72e7 | 11953:848a522fd731 |
---|---|
1348 return nil, "Both hosts are local"; | 1348 return nil, "Both hosts are local"; |
1349 end | 1349 end |
1350 local iq = st.iq{ from=localhost, to=remotehost, type="get", id=new_id()} | 1350 local iq = st.iq{ from=localhost, to=remotehost, type="get", id=new_id()} |
1351 :tag("ping", {xmlns="urn:xmpp:ping"}); | 1351 :tag("ping", {xmlns="urn:xmpp:ping"}); |
1352 local time_start = time.now(); | 1352 local time_start = time.now(); |
1353 local ret, err = async.wait_for(module:context(localhost):send_iq(iq, nil, timeout)); | 1353 return module:context(localhost):send_iq(iq, nil, timeout):next(function (pong) |
1354 if ret then | 1354 return ("pong from %s in %gs"):format(pong.stanza.attr.from, time.now() - time_start); |
1355 return true, ("pong from %s in %gs"):format(ret.stanza.attr.from, time.now() - time_start); | 1355 end); |
1356 else | |
1357 return false, tostring(err); | |
1358 end | |
1359 end | 1356 end |
1360 | 1357 |
1361 def_env.dns = {}; | 1358 def_env.dns = {}; |
1362 local adns = require"net.adns"; | 1359 local adns = require"net.adns"; |
1363 | 1360 |