aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
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
commitb37a36b1be0a8a91e851bcffe1f3e84c9f0f6151 (patch)
tree8f99793290e6a8019d1320667f45ea9c8634b7d6 /plugins
parentc305f9693143e0df2e33fabc52a216700a55b256 (diff)
downloadprosody-b37a36b1be0a8a91e851bcffe1f3e84c9f0f6151.tar.gz
prosody-b37a36b1be0a8a91e851bcffe1f3e84c9f0f6151.zip
mod_admin_telnet: Use promise based DNS resolving
Mostly done for testing this new API
Diffstat (limited to 'plugins')
-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(...)