From d321ede8ac47e0fac70947deb717cd67ffb07c88 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 27 Nov 2021 09:31:31 +0100 Subject: [PATCH] Added debug option to poll on keep-alive --- .../java/eu/faircode/email/FragmentOptionsMisc.java | 13 ++++++++++++- .../java/eu/faircode/email/ServiceSynchronize.java | 6 +++++- app/src/main/res/layout/fragment_options_misc.xml | 13 ++++++++++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 4d0723ae6d..f79810acc2 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 swKeepAlivePoll; private SwitchCompat swEmptyPool; private SwitchCompat swIdleDone; private SwitchCompat swExactAlarms; @@ -183,7 +184,8 @@ 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", "empty_pool", "idle_done", + "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", + "keep_alive_poll", "empty_pool", "idle_done", "exact_alarms", "infra", "dup_msgids", "test_iab" }; @@ -282,6 +284,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); + swKeepAlivePoll = view.findViewById(R.id.swKeepAlivePoll); swEmptyPool = view.findViewById(R.id.swEmptyPool); swIdleDone = view.findViewById(R.id.swIdleDone); swExactAlarms = view.findViewById(R.id.swExactAlarms); @@ -884,6 +887,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swKeepAlivePoll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("keep_alive_poll", checked).apply(); + } + }); + swEmptyPool.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -1379,6 +1389,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)); + swKeepAlivePoll.setChecked(prefs.getBoolean("keep_alive_poll", false)); swEmptyPool.setChecked(prefs.getBoolean("empty_pool", true)); swIdleDone.setChecked(prefs.getBoolean("idle_done", true)); swExactAlarms.setChecked(prefs.getBoolean("exact_alarms", true)); diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 4d5e55a3a4..f724f5b617 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -151,7 +151,8 @@ 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", "empty_pool", "idle_done", // force reconnect + "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", // force reconnect + "keep_alive_poll", "empty_pool", "idle_done", // force reconnect "exact_alarms" // force schedule )); @@ -1339,6 +1340,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences // Debug SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean subscriptions = prefs.getBoolean("subscriptions", false); + boolean keep_alive_poll = prefs.getBoolean("keep_alive_poll", false); boolean empty_pool = prefs.getBoolean("empty_pool", true); boolean debug = (prefs.getBoolean("debug", false) || BuildConfig.DEBUG); @@ -2021,6 +2023,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences // Sends folder NOOP if (!mapFolders.get(folder).isOpen()) throw new StoreClosedException(iservice.getStore(), "NOOP " + folder.name); + if (keep_alive_poll) + EntityOperation.poll(this, folder.id); } else { if (folder.poll_count == 0) { EntityLog.log(this, folder.name + " queue sync poll"); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 32b673ada7..50dd6611d3 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -865,6 +865,17 @@ app:layout_constraintTop_toBottomOf="@id/swAuthNtlm" app:switchPadding="12dp" /> + + NTLM SASL IDLE/DONE + Poll on keep-alive Empty connection pool Use exact timers Show infrastructure