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
.
This commit is contained in:
parent
887b2205ff
commit
34993fbca6
12
src/sync.c
12
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)) :
|
(t3 = 0, (sscanf( buf + 2, "%d %d %n", &t1, &t2, &t3 ) < 2) || !t3 || (t - t3 != TUIDL + 2)) :
|
||||||
c == 'S' || c == '!' ?
|
c == 'S' || c == '!' ?
|
||||||
(sscanf( buf + 2, "%d", &t1 ) != 1) :
|
(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", &t1, &t2 ) != 2) :
|
||||||
(sscanf( buf + 2, "%d %d %d", &t1, &t2, &t3 ) != 3))
|
(sscanf( buf + 2, "%d %d %d", &t1, &t2, &t3 ) != 3))
|
||||||
{
|
{
|
||||||
|
@ -879,6 +879,11 @@ load_state( sync_vars_t *svars )
|
||||||
debug( "killed\n" );
|
debug( "killed\n" );
|
||||||
srec->status = S_DEAD;
|
srec->status = S_DEAD;
|
||||||
break;
|
break;
|
||||||
|
case '=':
|
||||||
|
debug( "aborted\n" );
|
||||||
|
svars->mmaxxuid = srec->uid[M];
|
||||||
|
srec->status = S_DEAD;
|
||||||
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
memcpy( srec->tuid, buf + t3 + 2, TUIDL );
|
memcpy( srec->tuid, buf + t3 + 2, TUIDL );
|
||||||
debug( "TUID now %." stringify(TUIDL) "s\n", srec->tuid );
|
debug( "TUID now %." stringify(TUIDL) "s\n", srec->tuid );
|
||||||
|
@ -1698,8 +1703,6 @@ box_loaded( int sts, void *aux )
|
||||||
} else if (todel > 0) {
|
} else if (todel > 0) {
|
||||||
/* The message is excess. */
|
/* The message is excess. */
|
||||||
srec->status |= S_NEXPIRE;
|
srec->status |= S_NEXPIRE;
|
||||||
debug( " new pair(%d,%d) expired\n", srec->uid[M], srec->uid[S] );
|
|
||||||
svars->mmaxxuid = srec->uid[M];
|
|
||||||
todel--;
|
todel--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1738,8 +1741,9 @@ box_loaded( int sts, void *aux )
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (srec->status & S_NEXPIRE) {
|
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] );
|
debug( " pair(%d,%d): 1 (abort)\n", srec->uid[M], srec->uid[S] );
|
||||||
|
svars->mmaxxuid = srec->uid[M];
|
||||||
srec->msg[M]->srec = 0;
|
srec->msg[M]->srec = 0;
|
||||||
srec->status = S_DEAD;
|
srec->status = S_DEAD;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user