diff options
author | Kim Alvefur <zash@zash.se> | 2020-01-24 23:29:14 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-01-24 23:29:14 +0100 |
commit | b37a36b1be0a8a91e851bcffe1f3e84c9f0f6151 (patch) | |
tree | 8f99793290e6a8019d1320667f45ea9c8634b7d6 /plugins | |
parent | c305f9693143e0df2e33fabc52a216700a55b256 (diff) | |
download | prosody-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.lua | 12 |
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(...) |