[dovecot-cvs] dovecot/src/imap imap-sync.c,1.19,1.20

cras at dovecot.org cras at dovecot.org
Mon Feb 20 19:34:05 EET 2006


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv20740

Modified Files:
	imap-sync.c 
Log Message:
Update message_count only after expunge sends are finished or we'll get to
infinite loop (broken in last commit).



Index: imap-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-sync.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- imap-sync.c	13 Feb 2006 18:35:39 -0000	1.19
+++ imap-sync.c	20 Feb 2006 17:34:02 -0000	1.20
@@ -154,12 +154,8 @@
 			}
 			break;
 		case MAILBOX_SYNC_TYPE_EXPUNGE:
-			if (ctx->seq == 0) {
+			if (ctx->seq == 0)
 				ctx->seq = ctx->sync_rec.seq2;
-				ctx->messages_count -=
-					ctx->sync_rec.seq2 -
-					ctx->sync_rec.seq1 + 1;
-			}
 			ret = 1;
 			for (; ctx->seq >= ctx->sync_rec.seq1; ctx->seq--) {
 				if (ret <= 0)
@@ -169,6 +165,14 @@
 				str_printfa(str, "* %u EXPUNGE", ctx->seq);
 				ret = client_send_line(ctx->client, str_c(str));
 			}
+			if (ctx->seq < ctx->sync_rec.seq1) {
+				/* update only after we're finished, so that
+				   the seq2 > messages_count check above
+				   doesn't break */
+				ctx->messages_count -=
+					ctx->sync_rec.seq2 -
+					ctx->sync_rec.seq1 + 1;
+			}
 			break;
 		}
 		if (ret <= 0) {



More information about the dovecot-cvs mailing list