Changeset

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
parents 11952:b78a341e72e7
children 11954:b963ac00c967
files plugins/mod_admin_shell.lua
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua	Sat Nov 27 12:53:56 2021 +0100
+++ b/plugins/mod_admin_shell.lua	Sat Nov 27 14:15:55 2021 +0100
@@ -1350,12 +1350,9 @@
 	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 = {};