Browse Source

improve some debug messages

- print on which side we're upgrading a placeholder. as a side effect,
  this moves some magic out of upgrade_srec().
- don't use past tense for something that is only about to happen
- don't print status of every sync entry affected by journal replay -
  the entry load already prints it, and relevant operations print the
  new status. also, it was inconsistent with not printing the entry's
  old flags.
wip/maildir-path-under-inbox
Oswald Buddenhagen 3 years ago
parent
commit
6e7b3d24c1
  1. 8
      src/sync.c
  2. 2
      src/sync_p.h
  3. 12
      src/sync_state.c

8
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--;
}
}

2
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 );

12
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.

Loading…
Cancel
Save