diff --git a/src/sync.c b/src/sync.c index 1efa960..4ebc438 100644 --- a/src/sync.c +++ b/src/sync.c @@ -1036,9 +1036,9 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux // Consequently, the srec's flags are committed right away as well. srec->flags = (srec->flags | srec->aflags[t]) & ~srec->dflags[t]; JLOG( "^ %u %u %u %u", (srec->uid[F], srec->uid[N], srec->pflags, srec->flags), - "upgrading placeholder, dummy's flags %s, srec flags %s", - (fmt_lone_flags( srec->pflags ).str, fmt_lone_flags( srec->flags ).str) ); - nsrec = upgrade_srec( svars, srec ); + "upgrading %s placeholder, dummy's flags %s, srec flags %s", + (str_fn[t], fmt_lone_flags( srec->pflags ).str, fmt_lone_flags( srec->flags ).str) ); + nsrec = upgrade_srec( svars, srec, t ); } } // This is separated, because the upgrade can come from the journal. @@ -1199,7 +1199,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux ((srec->status & (S_EXPIRE|S_EXPIRED)) && (srec->msg[N]->flags & F_DELETED))) { /* The message is excess or was already (being) expired. */ srec->status |= S_NEXPIRE; - debug( " pair(%u,%u) expired\n", srec->uid[F], srec->uid[N] ); + debug( " expiring pair(%u,%u)\n", srec->uid[F], srec->uid[N] ); todel--; } } diff --git a/src/sync_p.h b/src/sync_p.h index fe43b00..9fc48ee 100644 --- a/src/sync_p.h +++ b/src/sync_p.h @@ -95,4 +95,4 @@ void assign_uid( sync_vars_t *svars, sync_rec_t *srec, int t, uint uid ); void assign_tuid( sync_vars_t *svars, sync_rec_t *srec ); int match_tuids( sync_vars_t *svars, int t, message_t *msgs ); -sync_rec_t *upgrade_srec( sync_vars_t *svars, sync_rec_t *srec ); +sync_rec_t *upgrade_srec( sync_vars_t *svars, sync_rec_t *srec, int t ); diff --git a/src/sync_state.c b/src/sync_state.c index 1fb8402..0f7553d 100644 --- a/src/sync_state.c +++ b/src/sync_state.c @@ -344,7 +344,7 @@ load_state( sync_vars_t *svars ) error( "Error: journal entry at %s:%d refers to non-existing sync state entry\n", svars->jname, line ); goto jbail; syncfnd: - debugn( " entry(%u,%u,%u) ", srec->uid[F], srec->uid[N], srec->flags ); + debugn( " entry(%u,%u) ", srec->uid[F], srec->uid[N] ); switch (c) { case '-': debug( "killed\n" ); @@ -392,11 +392,12 @@ load_state( sync_vars_t *svars ) srec->status = S_PENDING | (!srec->uid[F] ? S_DUMMY(F) : S_DUMMY(N)); break; case '^': + tn = (srec->status & S_DUMMY(F)) ? F : N; srec->pflags = (uchar)t3; srec->flags = (uchar)t4; - debug( "is being upgraded, dummy's flags %s, srec flags %s\n", - fmt_lone_flags( t3 ).str, fmt_lone_flags( t4 ).str ); - srec = upgrade_srec( svars, srec ); + debug( "upgrading %s placeholder, dummy's flags %s, srec flags %s\n", + str_fn[tn], fmt_lone_flags( t3 ).str, fmt_lone_flags( t4 ).str ); + srec = upgrade_srec( svars, srec, tn ); break; default: assert( !"Unhandled journal entry" ); @@ -564,7 +565,7 @@ match_tuids( sync_vars_t *svars, int t, message_t *msgs ) } sync_rec_t * -upgrade_srec( sync_vars_t *svars, sync_rec_t *srec ) +upgrade_srec( sync_vars_t *svars, sync_rec_t *srec, int t ) { // Create an entry and append it to the current one. sync_rec_t *nsrec = nfzalloc( sizeof(*nsrec) ); @@ -574,7 +575,6 @@ upgrade_srec( sync_vars_t *svars, sync_rec_t *srec ) svars->srecadd = &nsrec->next; svars->nsrecs++; // Move the placeholder to the new entry. - int t = (srec->status & S_DUMMY(F)) ? F : N; nsrec->uid[t] = srec->uid[t]; srec->uid[t] = 0; if (srec->msg[t]) { // NULL during journal replay; is assigned later.