Changeset

10292:8fb546e40756

mod_admin_telnet: Use new compact function for waiting on promises
author Kim Alvefur <zash@zash.se>
date Sun, 29 Sep 2019 18:44:58 +0200
parents 10291:7b48b620164c
children 10294:b61a7173f838
files plugins/mod_admin_telnet.lua
diffstat 1 files changed, 1 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sun Sep 29 18:42:35 2019 +0200
+++ b/plugins/mod_admin_telnet.lua	Sun Sep 29 18:44:58 2019 +0200
@@ -1148,13 +1148,7 @@
 	end
 	local iq = st.iq{ from=localhost, to=remotehost, type="get", id=new_id()}
 			:tag("ping", {xmlns="urn:xmpp:ping"});
-	local ret, err;
-	local wait, done = async.waiter();
-	module:context(localhost):send_iq(iq, nil, timeout)
-		:next(function (ret_) ret = ret_; end,
-			function (err_) err = err_; end)
-		:finally(done);
-	wait();
+	local ret, err = async.wait(module:context(localhost):send_iq(iq, nil, timeout));
 	if ret then
 		return true, "pong from " .. ret.stanza.attr.from;
 	else