From 8b76412b0d16bac8ba9696ddd4563968cc9eab0f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 17 Nov 2013 17:36:08 +0100 Subject: [PATCH] document message expiration transactions --- src/sync.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sync.c b/src/sync.c index 574a47c..d80c5da 100644 --- a/src/sync.c +++ b/src/sync.c @@ -1383,12 +1383,19 @@ box_loaded( int sts, void *aux ) continue; nex = (srec->status / S_NEXPIRE) & 1; if (nex != ((srec->status / S_EXPIRED) & 1)) { + /* The record needs a state change ... */ if (nex != ((srec->status / S_EXPIRE) & 1)) { + /* ... and we need to start a transaction. */ Fprintf( svars->jfp, "~ %d %d %d\n", srec->uid[M], srec->uid[S], nex ); debug( " pair(%d,%d): %d (pre)\n", srec->uid[M], srec->uid[S], nex ); srec->status = (srec->status & ~S_EXPIRE) | (nex * S_EXPIRE); - } else + } else { + /* ... but the "right" transaction is already pending. */ debug( " pair(%d,%d): %d (pending)\n", srec->uid[M], srec->uid[S], nex ); + } + } else { + /* Note: the "wrong" transaction may be pending here, + * e.g.: S_NEXPIRE = 0, S_EXPIRE = 1, S_EXPIRED = 0. */ } } } @@ -1408,8 +1415,9 @@ box_loaded( int sts, void *aux ) continue; } } else { + /* The trigger is an expiration transaction being ongoing ... */ if ((t == S) && ((mvBit(srec->status, S_EXPIRE, S_EXPIRED) ^ srec->status) & S_EXPIRED)) { - /* Derive deletion action from expiration state. */ + /* ... but the actual action derives from the wanted state. */ if (srec->status & S_NEXPIRE) aflags |= F_DELETED; else