isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 34993fbca6856667d78857ebaa60beacffa73a15
parent 887b2205ffc8c1c38346a30ec7e98c424064e273
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Thu, 30 Mar 2017 20:04:02 +0200

fix sync resumption with aborted entries

we need a separate log entry type which does proper mmaxxuid tracking.

while moving code around, this also removes a redundant debug statement.

amends b1842617.

Diffstat:
Msrc/sync.c | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/sync.c b/src/sync.c @@ -828,7 +828,7 @@ load_state( sync_vars_t *svars ) (t3 = 0, (sscanf( buf + 2, "%d %d %n", &t1, &t2, &t3 ) < 2) || !t3 || (t - t3 != TUIDL + 2)) : c == 'S' || c == '!' ? (sscanf( buf + 2, "%d", &t1 ) != 1) : - c == 'F' || c == 'T' || c == '+' || c == '&' || c == '-' || c == '|' || c == '/' || c == '\\' ? + c == 'F' || c == 'T' || c == '+' || c == '&' || c == '-' || c == '=' || c == '|' || c == '/' || c == '\\' ? (sscanf( buf + 2, "%d %d", &t1, &t2 ) != 2) : (sscanf( buf + 2, "%d %d %d", &t1, &t2, &t3 ) != 3)) { @@ -879,6 +879,11 @@ load_state( sync_vars_t *svars ) debug( "killed\n" ); srec->status = S_DEAD; break; + case '=': + debug( "aborted\n" ); + svars->mmaxxuid = srec->uid[M]; + srec->status = S_DEAD; + break; case '#': memcpy( srec->tuid, buf + t3 + 2, TUIDL ); debug( "TUID now %." stringify(TUIDL) "s\n", srec->tuid ); @@ -1698,8 +1703,6 @@ box_loaded( int sts, void *aux ) } else if (todel > 0) { /* The message is excess. */ srec->status |= S_NEXPIRE; - debug( " new pair(%d,%d) expired\n", srec->uid[M], srec->uid[S] ); - svars->mmaxxuid = srec->uid[M]; todel--; } } @@ -1738,8 +1741,9 @@ box_loaded( int sts, void *aux ) } } else { if (srec->status & S_NEXPIRE) { - jFprintf( svars, "- %d %d\n", srec->uid[M], srec->uid[S] ); + jFprintf( svars, "= %d %d\n", srec->uid[M], srec->uid[S] ); debug( " pair(%d,%d): 1 (abort)\n", srec->uid[M], srec->uid[S] ); + svars->mmaxxuid = srec->uid[M]; srec->msg[M]->srec = 0; srec->status = S_DEAD; }