aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-02-24 20:21:46 +0100
committerKim Alvefur <zash@zash.se>2020-02-24 20:21:46 +0100
commit1c68c0e36cb05b880857246cd0fc851384ab6520 (patch)
treedc8b6ff1bf5163d7121f6eb8a076335f58edf964 /net
parentcd774239f73bb1eedb9a7acb872a83dbb6db122c (diff)
downloadprosody-1c68c0e36cb05b880857246cd0fc851384ab6520.tar.gz
prosody-1c68c0e36cb05b880857246cd0fc851384ab6520.zip
net.dns: Handle being loaded outside of Prosody
`if timer ...` suggests that this was intended, but it did not work because net.timer depends on net.server which refuses to be loaded outside of Prosody.
Diffstat (limited to 'net')
-rw-r--r--net/dns.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/dns.lua b/net/dns.lua
index 3902f95c..193067e3 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -13,7 +13,7 @@
local socket = require "socket";
-local timer = require "util.timer";
+local have_timer, timer = pcall(require, "util.timer");
local new_ip = require "util.ip".new_ip;
local have_util_net, util_net = pcall(require, "util.net");
@@ -871,7 +871,7 @@ function resolver:query(qname, qtype, qclass) -- - - - - - - - - - -- query
set(self.wanted, qclass, qtype, qname, co, true);
end
- if timer and self.timeout then
+ if have_timer and self.timeout then
local num_servers = #self.server;
local i = 1;
timer.add_task(self.timeout, function ()