diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/Resolver.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/Resolver.java b/src/main/java/de/pixart/messenger/utils/Resolver.java index c405a8397..ddff9cb59 100644 --- a/src/main/java/de/pixart/messenger/utils/Resolver.java +++ b/src/main/java/de/pixart/messenger/utils/Resolver.java @@ -13,6 +13,8 @@ import java.util.List; import de.measite.minidns.DNSClient; import de.measite.minidns.DNSName; +import de.measite.minidns.Question; +import de.measite.minidns.Record; import de.measite.minidns.dnssec.DNSSECResultNotAuthenticException; import de.measite.minidns.dnsserverlookup.AndroidUsingExec; import de.measite.minidns.hla.DnssecResolverApi; @@ -150,18 +152,12 @@ public class Resolver { } private static <D extends Data> ResolverResult<D> resolveWithFallback(DNSName dnsName, Class<D> type, boolean validateHostname) throws IOException { + final Question question = new Question(dnsName, Record.TYPE.getType(type)); if (!validateHostname) { - return ResolverApi.INSTANCE.resolve(dnsName, type); + return ResolverApi.INSTANCE.resolve(question); } try { - final ResolverResult<D> r = DnssecResolverApi.INSTANCE.resolveDnssecReliable(dnsName, type); - if (r.wasSuccessful()) { - if (r.getAnswers().isEmpty() && type.equals(SRV.class)) { - Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": resolving SRV records of " + dnsName.toString() + " with DNSSEC yielded empty result"); - } - return r; - } - Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": error resolving " + type.getSimpleName() + " with DNSSEC. Trying DNS instead.", r.getResolutionUnsuccessfulException()); + return DnssecResolverApi.INSTANCE.resolveDnssecReliable(question); } catch (DNSSECResultNotAuthenticException e) { Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": error resolving " + type.getSimpleName() + " with DNSSEC. Trying DNS instead.", e); } catch (IOException e) { @@ -169,7 +165,7 @@ public class Resolver { } catch (Throwable throwable) { Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": error resolving " + type.getSimpleName() + " with DNSSEC. Trying DNS instead.", throwable); } - return ResolverApi.INSTANCE.resolve(dnsName, type); + return ResolverApi.INSTANCE.resolve(question); } private static boolean validateHostname() { |