happy eyeball: fix connection without dns
This commit is contained in:
parent
e3b5be777c
commit
b465011045
|
@ -80,7 +80,12 @@ public class Resolver {
|
||||||
public static Result fromHardCoded(String hostname, int port) {
|
public static Result fromHardCoded(String hostname, int port) {
|
||||||
final Result ipResult = fromIpAddress(hostname, port);
|
final Result ipResult = fromIpAddress(hostname, port);
|
||||||
if (ipResult != null) {
|
if (ipResult != null) {
|
||||||
|
try {
|
||||||
ipResult.connect();
|
ipResult.connect();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.i(Config.LOGTAG, Resolver.class.getSimpleName() + ": from hardcoded unable to connect: "+ e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ipResult;
|
return ipResult;
|
||||||
}
|
}
|
||||||
return happyEyeball(resolveNoSrvRecords(DNSName.from(hostname), port, true));
|
return happyEyeball(resolveNoSrvRecords(DNSName.from(hostname), port, true));
|
||||||
|
@ -94,7 +99,12 @@ public class Resolver {
|
||||||
public static Result resolve(String domain) {
|
public static Result resolve(String domain) {
|
||||||
final Result ipResult = fromIpAddress(domain, DEFAULT_PORT_XMPP);
|
final Result ipResult = fromIpAddress(domain, DEFAULT_PORT_XMPP);
|
||||||
if (ipResult != null) {
|
if (ipResult != null) {
|
||||||
|
try {
|
||||||
ipResult.connect();
|
ipResult.connect();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.i(Config.LOGTAG, Resolver.class.getSimpleName() + ": from hardcoded unable to connect: "+ e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ipResult;
|
return ipResult;
|
||||||
}
|
}
|
||||||
final List<Result> results = new ArrayList<>();
|
final List<Result> results = new ArrayList<>();
|
||||||
|
@ -304,7 +314,12 @@ public class Resolver {
|
||||||
if (r.size() == 1) {
|
if (r.size() == 1) {
|
||||||
result = r.get(0);
|
result = r.get(0);
|
||||||
result.setLogID(logID);
|
result.setLogID(logID);
|
||||||
|
try {
|
||||||
result.connect();
|
result.connect();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.i(Config.LOGTAG, Resolver.class.getSimpleName() + ": from hardcoded unable to connect: "+ e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +376,7 @@ public class Resolver {
|
||||||
private int priority;
|
private int priority;
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
|
|
||||||
private String logID;
|
private String logID = "";
|
||||||
|
|
||||||
static Result fromRecord(SRV srv, boolean directTls) {
|
static Result fromRecord(SRV srv, boolean directTls) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
|
Loading…
Reference in New Issue