1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Increase DNS timeout

This commit is contained in:
M66B 2020-07-21 09:19:23 +02:00
parent 790530dde8
commit 4e1b170ebe

View file

@ -47,6 +47,7 @@ import javax.mail.internet.InternetAddress;
public class DnsHelper {
// https://dns.watch/
private static final String DEFAULT_DNS = "84.200.69.80";
private static final int DEFAULT_TIMEOUT = 15; // seconds
static void checkMx(Context context, Address[] addresses) throws UnknownHostException {
if (addresses == null)
@ -66,6 +67,7 @@ public class DnsHelper {
boolean found = true;
try {
SimpleResolver resolver = new SimpleResolver(getDnsServer(context));
resolver.setTimeout(DEFAULT_TIMEOUT);
Lookup lookup = new Lookup(domain, Type.MX);
lookup.setResolver(resolver);
lookup.run();
@ -113,6 +115,7 @@ public class DnsHelper {
try {
SimpleResolver resolver = new SimpleResolver(getDnsServer(context));
resolver.setTimeout(DEFAULT_TIMEOUT);
Lookup lookup = new Lookup(name, rtype);
lookup.setResolver(resolver);
Log.i("Lookup name=" + name + " @" + resolver.getAddress() + " type=" + rtype);