# HG changeset patch # User Kim Alvefur # Date 1582572106 -3600 # Node ID c2b79b44ded7d2900922c3599e59cc89f213c157 # Parent fd651ba2317fcaa259ad7ef5fe29a15071667662 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. diff -r fd651ba2317f -r c2b79b44ded7 net/dns.lua --- a/net/dns.lua Mon Feb 24 18:38:09 2020 +0100 +++ b/net/dns.lua Mon Feb 24 20:21:46 2020 +0100 @@ -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 @@ 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 ()