Software /
code /
prosody
Changeset
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 |
parents | 10663:fd651ba2317f |
children | 10666:dfc8257d8445 |
files | net/dns.lua |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
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 ()