|
|
|
@ -425,8 +425,6 @@ public class EmailService implements AutoCloseable {
|
|
|
|
|
String certificate, String fingerprint) throws MessagingException {
|
|
|
|
|
properties.put("fairemail.server", host);
|
|
|
|
|
|
|
|
|
|
DnsHelper.clear(context);
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
boolean bind_socket = prefs.getBoolean("bind_socket", false);
|
|
|
|
|
if (bind_socket &&
|
|
|
|
@ -639,20 +637,8 @@ public class EmailService implements AutoCloseable {
|
|
|
|
|
// throw new MailConnectException(
|
|
|
|
|
// new SocketConnectException("Debug", new IOException("Test"), host, port, 0));
|
|
|
|
|
|
|
|
|
|
String key = "dns." + host;
|
|
|
|
|
try {
|
|
|
|
|
main = DnsHelper.getByName(context, host, dnssec);
|
|
|
|
|
EntityLog.log(context, EntityLog.Type.Network, "Main address=" + main);
|
|
|
|
|
prefs.edit().putString(key, main.getHostAddress()).apply();
|
|
|
|
|
} catch (UnknownHostException ex) {
|
|
|
|
|
String last = prefs.getString(key, null);
|
|
|
|
|
if (TextUtils.isEmpty(last))
|
|
|
|
|
throw ex;
|
|
|
|
|
else {
|
|
|
|
|
EntityLog.log(context, EntityLog.Type.Network, "Using " + key + "=" + last);
|
|
|
|
|
main = DnsHelper.getByName(context, last, dnssec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
main = DnsHelper.getByName(context, host, dnssec);
|
|
|
|
|
EntityLog.log(context, EntityLog.Type.Network, "Main address=" + main);
|
|
|
|
|
|
|
|
|
|
boolean prefer_ip4 = prefs.getBoolean("prefer_ip4", true);
|
|
|
|
|
if (prefer_ip4 && main instanceof Inet6Address) {
|
|
|
|
|