Software /
code /
prosody
Diff
net/dns.lua @ 10664:c2b79b44ded7
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 24 Feb 2020 20:21:46 +0100 |
parent | 9952:6402bc76f51a |
child | 10955:7bcfac630b65 |
line wrap: on
line diff
--- 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 ()