Don't cycle DNS servers while cycling DNS record types.
Motivation: Each server should be checked for every record type. Currently, if there are only two configured servers and the first is down, it is impossible to query for IPv4 addresses because the second server is only ever queried for type AAAA. Modifications: Do not cycle DNS servers while cycling DNS record types (A and AAAA) Result: Name resolution is less fragile when the number of available DNS servers is 2.
This commit is contained in:
parent
613c8b22e1
commit
1da1d89105
@ -100,6 +100,7 @@ abstract class DnsNameResolverContext<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void resolve() {
|
void resolve() {
|
||||||
|
InetSocketAddress nameServerAddrToTry = nameServerAddrs.next();
|
||||||
for (InternetProtocolFamily f: resolveAddressTypes) {
|
for (InternetProtocolFamily f: resolveAddressTypes) {
|
||||||
final DnsRecordType type;
|
final DnsRecordType type;
|
||||||
switch (f) {
|
switch (f) {
|
||||||
@ -113,7 +114,7 @@ abstract class DnsNameResolverContext<T> {
|
|||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
query(nameServerAddrs.next(), new DefaultDnsQuestion(hostname, type));
|
query(nameServerAddrToTry, new DefaultDnsQuestion(hostname, type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user