[BUGFIX] happy eyeball: concurrents resolve connect
This commit is contained in:
parent
5e0856ee69
commit
3df33228a8
|
@ -64,7 +64,9 @@ public class Resolver {
|
||||||
final Field dnsClientField = ReliableDNSClient.class.getDeclaredField("dnsClient");
|
final Field dnsClientField = ReliableDNSClient.class.getDeclaredField("dnsClient");
|
||||||
dnsClientField.setAccessible(true);
|
dnsClientField.setAccessible(true);
|
||||||
final DNSClient dnsClient = (DNSClient) dnsClientField.get(reliableDNSClient);
|
final DNSClient dnsClient = (DNSClient) dnsClientField.get(reliableDNSClient);
|
||||||
|
if (dnsClient != null) {
|
||||||
dnsClient.getDataSource().setTimeout(3000);
|
dnsClient.getDataSource().setTimeout(3000);
|
||||||
|
}
|
||||||
final Field useHardcodedDnsServers = DNSClient.class.getDeclaredField("useHardcodedDnsServers");
|
final Field useHardcodedDnsServers = DNSClient.class.getDeclaredField("useHardcodedDnsServers");
|
||||||
useHardcodedDnsServers.setAccessible(true);
|
useHardcodedDnsServers.setAccessible(true);
|
||||||
useHardcodedDnsServers.setBoolean(dnsClient, false);
|
useHardcodedDnsServers.setBoolean(dnsClient, false);
|
||||||
|
@ -293,7 +295,7 @@ public class Resolver {
|
||||||
Log.e(Config.LOGTAG, Resolver.class.getSimpleName() + ": happy eyeball failed: ", e);
|
Log.e(Config.LOGTAG, Resolver.class.getSimpleName() + ": happy eyeball failed: ", e);
|
||||||
return null;
|
return null;
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
Log.e(Config.LOGTAG, Resolver.class.getSimpleName() + ": happy eyeball failed: ", e);
|
Log.i(Config.LOGTAG, Resolver.class.getSimpleName() + ": happy eyeball unable to connect to one address");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,7 +430,10 @@ public class Resolver {
|
||||||
@Override
|
@Override
|
||||||
public Result call() throws Exception {
|
public Result call() throws Exception {
|
||||||
this.connect();
|
this.connect();
|
||||||
return this.socket.isConnected() ? this : null;
|
if (this.socket != null && this.socket.isConnected()) {
|
||||||
|
return this ;
|
||||||
|
}
|
||||||
|
throw new Exception("Resolver.Result was not possible to connect - should be catched by executor");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentValues toContentValues() {
|
public ContentValues toContentValues() {
|
||||||
|
|
Loading…
Reference in New Issue