mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-26 01:28:50 -05:00
Fixes Issue 1643
Fixes Issue 1664 Issue 1643: Some servers respond with an untagged EXISTS to every NOOP. This change parses through all untagged responses in a loop until no more are being generated, avoiding calling internalOpen each time. Issue 1664: I have never personally seen this error, and the log looks like a thread safety problem. mMessageCount is being set in one thread (the IDLE thread) but not properly visible in another thread (the check mail thread). mMessageCount and other ImapFolder private variables are now volatile in hopes of correcting this problem.
This commit is contained in:
parent
0d649da82f
commit
291f6d18a2
@ -446,11 +446,11 @@ public class ImapStore extends Store
|
|||||||
class ImapFolder extends Folder
|
class ImapFolder extends Folder
|
||||||
{
|
{
|
||||||
private String mName;
|
private String mName;
|
||||||
protected int mMessageCount = -1;
|
protected volatile int mMessageCount = -1;
|
||||||
protected int uidNext = -1;
|
protected volatile int uidNext = -1;
|
||||||
protected ImapConnection mConnection;
|
protected volatile ImapConnection mConnection;
|
||||||
private OpenMode mMode;
|
private OpenMode mMode;
|
||||||
private boolean mExists;
|
private volatile boolean mExists;
|
||||||
private ImapStore store = null;
|
private ImapStore store = null;
|
||||||
Map<Integer, String> msgSeqUidMap = new ConcurrentHashMap<Integer, String>();
|
Map<Integer, String> msgSeqUidMap = new ConcurrentHashMap<Integer, String>();
|
||||||
|
|
||||||
@ -2850,6 +2850,10 @@ public class ImapStore extends Store
|
|||||||
processUntaggedResponses(untaggedResponses);
|
processUntaggedResponses(untaggedResponses);
|
||||||
receiver.syncFolder(ImapFolderPusher.this);
|
receiver.syncFolder(ImapFolderPusher.this);
|
||||||
}
|
}
|
||||||
|
if (stop.get() == true)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int startUid = oldUidNext;
|
int startUid = oldUidNext;
|
||||||
|
|
||||||
int newUidNext = uidNext;
|
int newUidNext = uidNext;
|
||||||
@ -2898,18 +2902,17 @@ public class ImapStore extends Store
|
|||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (stop.get() == false)
|
|
||||||
{
|
{
|
||||||
List<ImapResponse> untaggedResponses = null;
|
List<ImapResponse> untaggedResponses = null;
|
||||||
if (storedUntaggedResponses.size() > 0)
|
while (storedUntaggedResponses.size() > 0)
|
||||||
{
|
{
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
Log.i(K9.LOG_TAG, "Processing " + storedUntaggedResponses.size() + " from previous commands for " + getLogId());
|
Log.i(K9.LOG_TAG, "Processing " + storedUntaggedResponses.size() + " untagged responses from previous commands for " + getLogId());
|
||||||
untaggedResponses = new ArrayList<ImapResponse>(storedUntaggedResponses);
|
untaggedResponses = new ArrayList<ImapResponse>(storedUntaggedResponses);
|
||||||
|
storedUntaggedResponses.clear();
|
||||||
|
processUntaggedResponses(untaggedResponses);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
Log.i(K9.LOG_TAG, "About to IDLE for " + getLogId());
|
Log.i(K9.LOG_TAG, "About to IDLE for " + getLogId());
|
||||||
|
|
||||||
@ -2920,17 +2923,11 @@ public class ImapStore extends Store
|
|||||||
untaggedResponses = executeSimpleCommand(COMMAND_IDLE, false, ImapFolderPusher.this);
|
untaggedResponses = executeSimpleCommand(COMMAND_IDLE, false, ImapFolderPusher.this);
|
||||||
idling.set(false);
|
idling.set(false);
|
||||||
|
|
||||||
}
|
|
||||||
if (stop.get() == false)
|
|
||||||
{
|
|
||||||
storedUntaggedResponses.clear();
|
|
||||||
processUntaggedResponses(untaggedResponses);
|
|
||||||
}
|
|
||||||
delayTime.set(NORMAL_DELAY_TIME);
|
delayTime.set(NORMAL_DELAY_TIME);
|
||||||
idleFailureCount.set(0);
|
idleFailureCount.set(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
wakeLock.acquire(K9.PUSH_WAKE_LOCK_TIMEOUT);
|
wakeLock.acquire(K9.PUSH_WAKE_LOCK_TIMEOUT);
|
||||||
|
Loading…
Reference in New Issue
Block a user