From a62a7a4a8455371fde87f7cc785e66791281e223 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 18 Feb 2024 10:20:54 +0100 Subject: [PATCH] resolver results need to be editable if we inject see-other-host --- .../java/eu/siacs/conversations/utils/Resolver.java | 10 +++++----- .../eu/siacs/conversations/xmpp/XmppConnection.java | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/utils/Resolver.java b/src/main/java/eu/siacs/conversations/utils/Resolver.java index 915209413..6746f3ea9 100644 --- a/src/main/java/eu/siacs/conversations/utils/Resolver.java +++ b/src/main/java/eu/siacs/conversations/utils/Resolver.java @@ -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 resolveNoSrvRecords(DNSName dnsName, boolean withCnames) { - List results = new ArrayList<>(); + final List results = new ArrayList<>(); try { for (A a : resolveWithFallback(dnsName, A.class, false).getAnswersOrEmptySet()) { results.add(Result.createDefault(dnsName, a.getInetAddress())); diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 541935712..9141e1c70 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -338,12 +338,13 @@ public class XmppConnection implements Runnable { } } else { final String domain = account.getServer(); - final List results; + final List 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");