1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

Fixed loop on too many connections

This commit is contained in:
M66B 2018-08-14 12:07:57 +00:00
parent c4b1963f80
commit b6873052b9

View file

@ -397,6 +397,7 @@ public class ServiceSynchronize extends LifecycleService {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
boolean connected = false;
IMAPFolder ifolder = null;
try {
Log.i(Helper.TAG, folder.name + " start");
@ -406,6 +407,7 @@ public class ServiceSynchronize extends LifecycleService {
ifolder = (IMAPFolder) fstore.getFolder(folder.name);
ifolder.open(Folder.READ_WRITE);
connected = true;
db.folder().setFolderState(folder.id, "connected");
db.folder().setFolderError(folder.id, null);
@ -423,14 +425,18 @@ public class ServiceSynchronize extends LifecycleService {
// Happens when syncing message
// This operation is not allowed on a closed folder
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
} catch (Throwable ex) {
// MessagingException
// - message: connection failure
// - event: Too many simultaneous connections. (Failure)
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
reportError(account.name, folder.name, ex);
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
// Cascade up
if (connected)
try {
fstore.close();
} catch (MessagingException e1) {