aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-08-01 11:37:32 +0200
committerChristian Schneppe <christian@pix-art.de>2017-08-01 11:37:32 +0200
commitf28057dd4a79ef77843706a191c63d1989c23e76 (patch)
treecfa6687453f950799c508ff4cbfd1ec85442f527 /src/main
parent23752c581f79640a38d87aa2a6914deac475447d (diff)
fixed fallback to normal DNS query after DNSSEC failed
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/utils/Resolver.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/Resolver.java b/src/main/java/de/pixart/messenger/utils/Resolver.java
index 89961a3c3..31e0b3dd4 100644
--- a/src/main/java/de/pixart/messenger/utils/Resolver.java
+++ b/src/main/java/de/pixart/messenger/utils/Resolver.java
@@ -92,16 +92,22 @@ public class Resolver {
private static <D extends Data> ResolverResult<D> resolveWithFallback(DNSName dnsName, Class<D> type) throws IOException {
try {
- return DnssecResolverApi.INSTANCE.resolveDnssecReliable(dnsName, type);
+ 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());
} catch (DNSSECResultNotAuthenticException e) {
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": error resolving " + type.getSimpleName() + " with DNSSEC. Trying DNS instead.", e);
- return ResolverApi.INSTANCE.resolve(dnsName, type);
} catch (IOException e) {
throw e;
} 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(dnsName, type);
}
public static class Result implements Comparable<Result> {