mirror of https://github.com/M66B/FairEmail.git
Use IPv6 address if resolving fails
This commit is contained in:
parent
4b0155ac08
commit
0dad701210
|
@ -462,13 +462,17 @@ public class EmailService implements AutoCloseable {
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
boolean prefer_ip4 = prefs.getBoolean("prefer_ip4", true);
|
boolean prefer_ip4 = prefs.getBoolean("prefer_ip4", true);
|
||||||
if (prefer_ip4 && main instanceof Inet6Address) {
|
if (prefer_ip4 &&
|
||||||
|
main instanceof Inet6Address)
|
||||||
|
try {
|
||||||
for (InetAddress iaddr : InetAddress.getAllByName(host))
|
for (InetAddress iaddr : InetAddress.getAllByName(host))
|
||||||
if (iaddr instanceof Inet4Address) {
|
if (iaddr instanceof Inet4Address) {
|
||||||
main = iaddr;
|
main = iaddr;
|
||||||
EntityLog.log(context, "Preferring=" + main);
|
EntityLog.log(context, "Preferring=" + main);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} catch (UnknownHostException ex) {
|
||||||
|
Log.w(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityLog.log(context, "Connecting to " + main);
|
EntityLog.log(context, "Connecting to " + main);
|
||||||
|
|
Loading…
Reference in New Issue