DNS check timeout

pull/184/head
M66B 4 years ago
parent d2b349a7b3
commit cc40ab769b

@ -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 CHECK_TIMEOUT = 5; // seconds
private static final int LOOKUP_TIMEOUT = 15; // seconds private static final int LOOKUP_TIMEOUT = 15; // seconds
static void checkMx(Context context, Address[] addresses) throws UnknownHostException { static void checkMx(Context context, Address[] addresses) throws UnknownHostException {
@ -67,7 +68,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(LOOKUP_TIMEOUT); resolver.setTimeout(CHECK_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();

Loading…
Cancel
Save