aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 = {};