From 762e4ee6ecd83f6898981634af45d4151a37a580 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 27 Feb 2020 12:35:12 +0100 Subject: [PATCH] Consider mac connections as I/O error --- app/src/main/java/eu/faircode/email/Core.java | 10 ---------- .../java/eu/faircode/email/ServiceSynchronize.java | 10 ++-------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index b6f1e81f2d..8dcab4ce25 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -3401,7 +3401,6 @@ class Core { private Semaphore semaphore = new Semaphore(0); private boolean running = true; private boolean recoverable = true; - private boolean maxConnections = false; private Long lastActivity = null; private Map sequence = new HashMap<>(); @@ -3471,17 +3470,8 @@ class Core { yield(); } - void setMaxConnections() { - maxConnections = true; - } - - boolean getMaxConnections() { - return maxConnections; - } - void reset() { recoverable = true; - maxConnections = false; lastActivity = null; synchronized (this) { for (FolderPriority key : sequence.keySet()) { diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index f0a475f093..3e3c4a77b5 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -873,10 +873,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences EntityLog.log(ServiceSynchronize.this, account.name + " alert: " + message); - boolean max = isMaxConnections(message); - if (max) - state.setMaxConnections(); - if (!max || state.getBackoff() > CONNECT_BACKOFF_MAX) + if (!isMaxConnections(message)) try { NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.notify("alert:" + account.id, 1, @@ -906,10 +903,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences boolean ioError = false; Throwable c = ex; while (c != null) { - boolean max = isMaxConnections(c.getMessage()); - if (max) - state.setMaxConnections(); - if (max || + if (isMaxConnections(c.getMessage()) || c instanceof IOException || c instanceof ConnectionException || c instanceof AccountsException ||