aboutsummaryrefslogtreecommitdiffstats
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
commit522e9778eaf37c99ef15cdebdeee58cedfa5af5c (patch)
treedc8b6ff1bf5163d7121f6eb8a076335f58edf964
parent1969b96da192e7d8e3233883bdea256942c73a7b (diff)
downloadprosody-522e9778eaf37c99ef15cdebdeee58cedfa5af5c.tar.gz
prosody-522e9778eaf37c99ef15cdebdeee58cedfa5af5c.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.
-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 ()