1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-12 06:08:25 -05:00

Eliminate race condition which causes multiple connections to IDLE

simultaneously
This commit is contained in:
Daniel Applebaum 2009-11-23 03:16:44 +00:00
parent ee463b32ff
commit 694ba471d4

View File

@ -33,6 +33,7 @@ import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@ -2012,15 +2013,18 @@ public class ImapStore extends Store {
}
else
{
Log.i(Email.LOG_TAG, "About to IDLE for " + getLogId());
receiver.setPushActive(getName(), true);
idling.set(true);
doneSent.set(false);
executeSimpleCommand("IDLE", false, ImapFolderPusher.this);
idling.set(false);
receiver.setPushActive(getName(), false);
delayTime.set(NORMAL_DELAY_TIME);
if (stop.get() != true)
{
Log.i(Email.LOG_TAG, "About to IDLE for " + getLogId());
receiver.setPushActive(getName(), true);
idling.set(true);
doneSent.set(false);
executeSimpleCommand("IDLE", false, ImapFolderPusher.this);
idling.set(false);
receiver.setPushActive(getName(), false);
delayTime.set(NORMAL_DELAY_TIME);
}
}
}
catch (Exception e)