1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-11-11 20:05:03 -05:00

IMAP: Handle exception during IDLE

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1021 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-04-23 14:59:30 +00:00
parent d1391d9ffe
commit ec6634d043

View File

@ -431,24 +431,29 @@ public class ImapConnection extends AbstractConnection {
// clear cache before going to idle mode
currentFolder.clearCache();
DavGatewayTray.resetIcon();
int count = 0;
while (!in.ready()) {
if (++count >= imapIdleDelay) {
count = 0;
List<Long> previousImapUidList = currentFolder.getImapUidList();
if (session.refreshFolder(currentFolder)) {
handleRefresh(previousImapUidList, currentFolder.getImapUidList());
try {
int count = 0;
while (!in.ready()) {
if (++count >= imapIdleDelay) {
count = 0;
List<Long> previousImapUidList = currentFolder.getImapUidList();
if (session.refreshFolder(currentFolder)) {
handleRefresh(previousImapUidList, currentFolder.getImapUidList());
}
}
// sleep 1 second
Thread.sleep(1000);
}
// sleep 1 second
Thread.sleep(1000);
}
// read DONE line
line = readClient();
if ("DONE".equals(line)) {
sendClient(commandId + " OK " + command + " terminated");
} else {
sendClient(commandId + " BAD command unrecognized");
// read DONE line
line = readClient();
if ("DONE".equals(line)) {
sendClient(commandId + " OK " + command + " terminated");
} else {
sendClient(commandId + " BAD command unrecognized");
}
} catch (IOException e) {
// client connection closed
throw new SocketException(e.getMessage());
}
} else if ("noop".equalsIgnoreCase(command) || "check".equalsIgnoreCase(command)) {
if (currentFolder != null) {