resolver results need to be editable if we inject see-other-host

This commit is contained in:
Daniel Gultsch 2024-02-18 10:20:54 +01:00
parent d175843cbd
commit a62a7a4a84
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
2 changed files with 9 additions and 8 deletions

View file

@ -166,15 +166,15 @@ public class Resolver {
threads[2].interrupt();
synchronized (results) {
Collections.sort(results);
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + results.toString());
return new ArrayList<>(results);
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + results);
return results;
}
} else {
threads[2].join();
synchronized (fallbackResults) {
Collections.sort(fallbackResults);
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + fallbackResults.toString());
return new ArrayList<>(fallbackResults);
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + fallbackResults);
return fallbackResults;
}
}
} catch (InterruptedException e) {
@ -257,7 +257,7 @@ public class Resolver {
}
private static List<Result> resolveNoSrvRecords(DNSName dnsName, boolean withCnames) {
List<Result> results = new ArrayList<>();
final List<Result> results = new ArrayList<>();
try {
for (A a : resolveWithFallback(dnsName, A.class, false).getAnswersOrEmptySet()) {
results.add(Result.createDefault(dnsName, a.getInetAddress()));

View file

@ -338,12 +338,13 @@ public class XmppConnection implements Runnable {
}
} else {
final String domain = account.getServer();
final List<Resolver.Result> results;
final List<Resolver.Result> results = new ArrayList<>();
final boolean hardcoded = extended && !account.getHostname().isEmpty();
if (hardcoded) {
results = Resolver.fromHardCoded(account.getHostname(), account.getPort());
results.addAll(
Resolver.fromHardCoded(account.getHostname(), account.getPort()));
} else {
results = Resolver.resolve(domain);
results.addAll(Resolver.resolve(domain));
}
if (Thread.currentThread().isInterrupted()) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": Thread was interrupted");