Skip to content

Commit

Permalink
imap: Fixed expunge handling when un-hiberanting
Browse files Browse the repository at this point in the history
Fixes these errors:

Failed to import client state: Message count mismatch after handling expunges
Message UIDs CRC32 mismatch
  • Loading branch information
sirainen committed Aug 23, 2016
1 parent 97e5119 commit 18efe79
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/imap/imap-state.c
Expand Up @@ -385,7 +385,7 @@ import_send_expunges(struct client *client,
t_array_init(&expunged_seqs, array_count(&expunged_uids)+1); seq = 0;
while (mailbox_search_next(search_ctx, &mail)) {
while (seq_range_array_iter_nth(&iter, n, &expunged_uid) &&
expunged_uid < mail->uid) {
expunged_uid < mail->uid && seq < state->messages) {
seq++; n++;
array_append(&expunged_seqs, &seq, 1);
crc = crc32_data_more(crc, &expunged_uid,
Expand All @@ -397,7 +397,8 @@ import_send_expunges(struct client *client,
if (++seq == state->messages)
break;
}
while (seq_range_array_iter_nth(&iter, n, &expunged_uid)) {
while (seq_range_array_iter_nth(&iter, n, &expunged_uid) &&
seq < state->messages) {
seq++; n++;
array_append(&expunged_seqs, &seq, 1);
crc = crc32_data_more(crc, &expunged_uid,
Expand Down

0 comments on commit 18efe79

Please sign in to comment.