From 6b7b2b11063ef32a3d40624d212c30d5f9ac995f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 23 Nov 2013 12:22:31 +0100 Subject: [PATCH] always get slave flags when we are expiring even if we are not propagating new messages, the appearance of new messages on the slave can lead to expiring older messages. for that, we need to know their importance, and thus flags. the alternative would be not doing an expiration run when not fetching new messages, but that would mean more conditionals all over the place. as the decision is somewhat arbitrary, just do the simpler thing. --- src/sync.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sync.c b/src/sync.c index 46cf9cd..e7ce2d1 100644 --- a/src/sync.c +++ b/src/sync.c @@ -992,14 +992,12 @@ box_selected( int sts, void *aux ) opts[t] |= OPEN_NEW|OPEN_FLAGS; } } - if ((chan->ops[S] & (OP_NEW|OP_RENEW)) && chan->max_messages) + if ((chan->ops[S] & (OP_NEW|OP_RENEW|OP_FLAGS)) && chan->max_messages) opts[S] |= OPEN_OLD|OPEN_NEW|OPEN_FLAGS; if (line) for (srec = svars->srecs; srec; srec = srec->next) { if (srec->status & S_DEAD) continue; - if ((mvBit(srec->status, S_EXPIRE, S_EXPIRED) ^ srec->status) & S_EXPIRED) - opts[S] |= OPEN_OLD|OPEN_FLAGS; if (srec->tuid[0]) { if (srec->uid[M] == -2) opts[M] |= OPEN_NEW|OPEN_FIND, svars->state[M] |= ST_FIND_OLD; @@ -1355,6 +1353,7 @@ box_loaded( int sts, void *aux ) } if ((svars->chan->ops[S] & (OP_NEW|OP_RENEW|OP_FLAGS)) && svars->chan->max_messages) { + /* Note: When this branch is entered, we have loaded all slave messages. */ /* Expire excess messages. Flagged messages and not yet synced messages older * than the first not expired message are not counted towards the total. */ todel = svars->ctx[S]->count + svars->new_total[S] - svars->chan->max_messages;