mod_admin_telnet: Use promise based DNS resolving

Mostly done for testing this new API
This commit is contained in:
Kim Alvefur 2020-01-24 23:29:14 +01:00
parent c305f96931
commit b37a36b1be

View file

@ -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(...)