skip empty srv records

This commit is contained in:
Daniel Gultsch 2018-02-10 12:16:18 +01:00
parent facc56bc7b
commit f828b89cbd

View file

@ -99,6 +99,9 @@ public class Resolver {
ResolverResult<SRV> result = resolveWithFallback(dnsName, SRV.class); ResolverResult<SRV> result = resolveWithFallback(dnsName, SRV.class);
List<Result> results = new ArrayList<>(); List<Result> results = new ArrayList<>();
for (SRV record : result.getAnswersOrEmptySet()) { for (SRV record : result.getAnswersOrEmptySet()) {
if (record.name.length() == 0 && record.priority == 0) {
continue;
}
final boolean addedIPv4 = results.addAll(resolveIp(record, A.class, result.isAuthenticData(), directTls)); final boolean addedIPv4 = results.addAll(resolveIp(record, A.class, result.isAuthenticData(), directTls));
results.addAll(resolveIp(record, AAAA.class, result.isAuthenticData(), directTls)); results.addAll(resolveIp(record, AAAA.class, result.isAuthenticData(), directTls));
if (!addedIPv4 && !Thread.currentThread().isInterrupted()) { if (!addedIPv4 && !Thread.currentThread().isInterrupted()) {