Mercurial > prosody-hg
comparison net/resolvers/basic.lua @ 10626:26fb44b61a17
net.resolvers.basic: Fix continuing if IPv6 or Legacy IP is disabled
The code expects ready() to be called twice, but with IPv4 or v6
disabled it would only be called once.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 26 Jan 2020 14:35:35 +0100 |
| parents | 0725b7b8dc14 |
| children | 2edb72ef312a |
comparison
equal
deleted
inserted
replaced
| 10625:3bfb20be844c | 10626:26fb44b61a17 |
|---|---|
| 50 table.insert(targets, { self.conn_type.."4", record.a, self.port, self.extra }); | 50 table.insert(targets, { self.conn_type.."4", record.a, self.port, self.extra }); |
| 51 end | 51 end |
| 52 end | 52 end |
| 53 ready(); | 53 ready(); |
| 54 end, self.hostname, "A", "IN"); | 54 end, self.hostname, "A", "IN"); |
| 55 else | |
| 56 ready(); | |
| 55 end | 57 end |
| 56 | 58 |
| 57 if not self.extra or self.extra.use_ipv6 ~= false then | 59 if not self.extra or self.extra.use_ipv6 ~= false then |
| 58 dns_resolver:lookup(function (answer) | 60 dns_resolver:lookup(function (answer) |
| 59 if answer then | 61 if answer then |
| 61 table.insert(targets, { self.conn_type.."6", record.aaaa, self.port, self.extra }); | 63 table.insert(targets, { self.conn_type.."6", record.aaaa, self.port, self.extra }); |
| 62 end | 64 end |
| 63 end | 65 end |
| 64 ready(); | 66 ready(); |
| 65 end, self.hostname, "AAAA", "IN"); | 67 end, self.hostname, "AAAA", "IN"); |
| 68 else | |
| 69 ready(); | |
| 66 end | 70 end |
| 67 end | 71 end |
| 68 | 72 |
| 69 local function new(hostname, port, conn_type, extra) | 73 local function new(hostname, port, conn_type, extra) |
| 70 local ascii_host = idna_to_ascii(hostname); | 74 local ascii_host = idna_to_ascii(hostname); |
