Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9094:60204e3f7c4d HEAD
imap: Don't cancel sync if client disconnects in the middle.
Fixes "Message count decreased" errors.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 26 May 2009 14:20:23 -0400 |
parents | a4bdf6d119f6 |
children | 9a0aa39a3a14 |
files | src/imap/imap-sync.c |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-sync.c Tue May 26 13:48:39 2009 -0400 +++ b/src/imap/imap-sync.c Tue May 26 14:20:23 2009 -0400 @@ -372,6 +372,10 @@ string_t *str; int ret = 1; + /* finish syncing even when client has disconnected. otherwise our + internal state (ctx->messages_count) can get messed up and unless + we immediately stop handling all commands and syncs we could end up + assert-crashing. */ str = t_str_new(256); for (;;) { if (ctx->seq == 0) { @@ -404,7 +408,7 @@ ret = 1; for (; ctx->seq <= ctx->sync_rec.seq2; ctx->seq++) { - if (ret <= 0) + if (ret == 0) break; ret = imap_sync_send_flags(ctx, str); @@ -426,7 +430,7 @@ ctx->seq = ctx->sync_rec.seq2; ret = 1; for (; ctx->seq >= ctx->sync_rec.seq1; ctx->seq--) { - if (ret <= 0) + if (ret == 0) break; str_truncate(str, 0); @@ -452,15 +456,15 @@ ret = 1; for (; ctx->seq <= ctx->sync_rec.seq2; ctx->seq++) { - if (ret <= 0) + if (ret == 0) break; ret = imap_sync_send_modseq(ctx, str); } break; } - if (ret <= 0) { - /* failure / buffer full */ + if (ret == 0) { + /* buffer full */ break; }