mirror of https://github.com/M66B/FairEmail.git
Increase DNS timeout
This commit is contained in:
parent
790530dde8
commit
4e1b170ebe
|
@ -47,6 +47,7 @@ import javax.mail.internet.InternetAddress;
|
||||||
public class DnsHelper {
|
public class DnsHelper {
|
||||||
// https://dns.watch/
|
// https://dns.watch/
|
||||||
private static final String DEFAULT_DNS = "84.200.69.80";
|
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 {
|
static void checkMx(Context context, Address[] addresses) throws UnknownHostException {
|
||||||
if (addresses == null)
|
if (addresses == null)
|
||||||
|
@ -66,6 +67,7 @@ public class DnsHelper {
|
||||||
boolean found = true;
|
boolean found = true;
|
||||||
try {
|
try {
|
||||||
SimpleResolver resolver = new SimpleResolver(getDnsServer(context));
|
SimpleResolver resolver = new SimpleResolver(getDnsServer(context));
|
||||||
|
resolver.setTimeout(DEFAULT_TIMEOUT);
|
||||||
Lookup lookup = new Lookup(domain, Type.MX);
|
Lookup lookup = new Lookup(domain, Type.MX);
|
||||||
lookup.setResolver(resolver);
|
lookup.setResolver(resolver);
|
||||||
lookup.run();
|
lookup.run();
|
||||||
|
@ -113,6 +115,7 @@ public class DnsHelper {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SimpleResolver resolver = new SimpleResolver(getDnsServer(context));
|
SimpleResolver resolver = new SimpleResolver(getDnsServer(context));
|
||||||
|
resolver.setTimeout(DEFAULT_TIMEOUT);
|
||||||
Lookup lookup = new Lookup(name, rtype);
|
Lookup lookup = new Lookup(name, rtype);
|
||||||
lookup.setResolver(resolver);
|
lookup.setResolver(resolver);
|
||||||
Log.i("Lookup name=" + name + " @" + resolver.getAddress() + " type=" + rtype);
|
Log.i("Lookup name=" + name + " @" + resolver.getAddress() + " type=" + rtype);
|
||||||
|
|
Loading…
Reference in New Issue