dovecot-1.1: imap: Don't cancel sync if client disconnects in th...
dovecot at dovecot.org
dovecot at dovecot.org
Tue May 26 21:19:29 EEST 2009
details: http://hg.dovecot.org/dovecot-1.1/rev/9896942451ce
changeset: 8292:9896942451ce
user: Timo Sirainen <tss at iki.fi>
date: Tue May 26 14:17:23 2009 -0400
description:
imap: Don't cancel sync if client disconnects in the middle.
Fixes "Message count decreased" errors.
diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
src/imap/imap-sync.c | 12 ++++++++----
diffs (43 lines):
diff -r 3c37d55abc6e -r 9896942451ce src/imap/imap-sync.c
--- a/src/imap/imap-sync.c Tue May 26 13:48:18 2009 -0400
+++ b/src/imap/imap-sync.c Tue May 26 14:17:23 2009 -0400
@@ -133,6 +133,10 @@ int imap_sync_more(struct imap_sync_cont
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) {
@@ -161,7 +165,7 @@ int imap_sync_more(struct imap_sync_cont
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);
@@ -172,7 +176,7 @@ int imap_sync_more(struct imap_sync_cont
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);
@@ -189,8 +193,8 @@ int imap_sync_more(struct imap_sync_cont
}
break;
}
- if (ret <= 0) {
- /* failure / buffer full */
+ if (ret == 0) {
+ /* buffer full */
break;
}
More information about the dovecot-cvs
mailing list