From 77575ff716f12d9924449f0120a52e3e107c807e Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 24 Nov 2021 10:39:28 +0100 Subject: [PATCH] Added option to disable emptying connection pool --- .../eu/faircode/email/FragmentOptionsMisc.java | 12 +++++++++++- .../java/eu/faircode/email/ServiceSynchronize.java | 5 +++-- app/src/main/res/layout/fragment_options_misc.xml | 14 +++++++++++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index d3dc8fe5f4..4d0723ae6d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -147,6 +147,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swAuthLogin; private SwitchCompat swAuthNtlm; private SwitchCompat swAuthSasl; + private SwitchCompat swEmptyPool; private SwitchCompat swIdleDone; private SwitchCompat swExactAlarms; private SwitchCompat swInfra; @@ -182,7 +183,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "protocol", "debug", "log_level", "query_threads", "wal", "checkpoints", "sqlite_cache", "chunk_size", "use_modseq", "perform_expunge", "uid_expunge", - "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "idle_done", + "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "empty_pool", "idle_done", "exact_alarms", "infra", "dup_msgids", "test_iab" }; @@ -281,6 +282,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swAuthLogin = view.findViewById(R.id.swAuthLogin); swAuthNtlm = view.findViewById(R.id.swAuthNtlm); swAuthSasl = view.findViewById(R.id.swAuthSasl); + swEmptyPool = view.findViewById(R.id.swEmptyPool); swIdleDone = view.findViewById(R.id.swIdleDone); swExactAlarms = view.findViewById(R.id.swExactAlarms); swInfra = view.findViewById(R.id.swInfra); @@ -882,6 +884,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swEmptyPool.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("empty_pool", checked).apply(); + } + }); + swIdleDone.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -1370,6 +1379,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swAuthLogin.setChecked(prefs.getBoolean("auth_login", true)); swAuthNtlm.setChecked(prefs.getBoolean("auth_ntlm", true)); swAuthSasl.setChecked(prefs.getBoolean("auth_sasl", true)); + swEmptyPool.setChecked(prefs.getBoolean("empty_pool", true)); swIdleDone.setChecked(prefs.getBoolean("idle_done", true)); swExactAlarms.setChecked(prefs.getBoolean("exact_alarms", true)); swInfra.setChecked(prefs.getBoolean("infra", false)); diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 6e6e9968ec..4d5e55a3a4 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -151,7 +151,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences "download_headers", "download_eml", "prefer_ip4", "bind_socket", "standalone_vpn", "tcp_keep_alive", "ssl_harden", // force reconnect "experiments", "debug", "protocol", // force reconnect - "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "idle_done", // force reconnect + "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "empty_pool", "idle_done", // force reconnect "exact_alarms" // force schedule )); @@ -1339,6 +1339,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences // Debug SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean subscriptions = prefs.getBoolean("subscriptions", false); + boolean empty_pool = prefs.getBoolean("empty_pool", true); boolean debug = (prefs.getBoolean("debug", false) || BuildConfig.DEBUG); final EmailService iservice = new EmailService( @@ -1785,7 +1786,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } handling = all; - if (istore instanceof IMAPStore) { + if (empty_pool && istore instanceof IMAPStore) { getMainHandler().removeCallbacks(purge); if (handling.size() == 0) getMainHandler().postDelayed(purge, PURGE_DELAY); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index cd0a5804c2..32b673ada7 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -865,6 +865,18 @@ app:layout_constraintTop_toBottomOf="@id/swAuthNtlm" app:switchPadding="12dp" /> + + NTLM SASL IDLE/DONE + Empty connection pool Use exact timers Show infrastructure Duplicates by message ID