aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-01-24 23:29:14 +0100
committerKim Alvefur <zash@zash.se>2020-01-24 23:29:14 +0100
commitf507f3bb8b78a112f60aa4c429f488c3543cd10e (patch)
tree8f99793290e6a8019d1320667f45ea9c8634b7d6
parent48f0b3b44cb1de52fa358161814cf5ce2aab1b45 (diff)
downloadprosody-f507f3bb8b78a112f60aa4c429f488c3543cd10e.tar.gz
prosody-f507f3bb8b78a112f60aa4c429f488c3543cd10e.zip
mod_admin_telnet: Use promise based DNS resolving
Mostly done for testing this new API
-rw-r--r--plugins/mod_admin_telnet.lua12
1 files changed, 5 insertions, 7 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 5ffd40e0..fba10faf 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -1189,14 +1189,12 @@ end
function def_env.dns:lookup(name, typ, class)
local resolver = get_resolver(self.session);
- local ret = "Query sent";
- local print = self.session.print;
- local function handler(...)
- ret = "Got response";
- print(...);
+ local ret, err = async.wait(resolver:lookup_promise(name, typ, class));
+ if ret then
+ return true, ret;
+ elseif err then
+ return false, err;
end
- resolver:lookup(handler, name, typ, class);
- return true, ret;
end
function def_env.dns:addnameserver(...)