mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-28 16:55:56 +00:00
Experiment: prefer ip6 for main address
This commit is contained in:
parent
dc845de237
commit
8acebc728f
1 changed files with 9 additions and 1 deletions
|
@ -637,9 +637,18 @@ public class EmailService implements AutoCloseable {
|
|||
// throw new MailConnectException(
|
||||
// new SocketConnectException("Debug", new IOException("Test"), host, port, 0));
|
||||
|
||||
boolean prefer_ip4 = prefs.getBoolean("prefer_ip4", true);
|
||||
|
||||
String key = "dns." + host;
|
||||
try {
|
||||
main = DnsHelper.getByName(context, host, dnssec);
|
||||
if (!prefer_ip4 && false)
|
||||
for (InetAddress iaddr : DnsHelper.getAllByName(context, host, dnssec))
|
||||
if (iaddr instanceof Inet6Address) {
|
||||
main = iaddr;
|
||||
break;
|
||||
}
|
||||
|
||||
EntityLog.log(context, EntityLog.Type.Network, "Main address=" + main);
|
||||
prefs.edit().putString(key, main.getHostAddress()).apply();
|
||||
} catch (UnknownHostException ex) {
|
||||
|
@ -652,7 +661,6 @@ public class EmailService implements AutoCloseable {
|
|||
}
|
||||
}
|
||||
|
||||
boolean prefer_ip4 = prefs.getBoolean("prefer_ip4", true);
|
||||
if (prefer_ip4 && main instanceof Inet6Address) {
|
||||
boolean[] has46 = ConnectionHelper.has46(context);
|
||||
if (has46[0])
|
||||
|
|
Loading…
Reference in a new issue