Removed app DNS cache

This commit is contained in:
M66B
2024-06-21 16:19:29 +02:00
parent 6494590aff
commit f2502b181e
3 changed files with 2 additions and 26 deletions

View File

@@ -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) {