concentrate calculation of minimal loaded UID in load_box()
so it's in one place with the maximal one, sans the one-sided preparation of the bulk range + exception list.
This commit is contained in:
parent
e98aed87f0
commit
d77d67c948
12
src/sync.c
12
src/sync.c
|
@ -808,8 +808,7 @@ box_opened2( sync_vars_t *svars, int t )
|
||||||
svars->opts[N] = svars->drv[N]->prepare_load_box( ctx[N], opts[N] );
|
svars->opts[N] = svars->drv[N]->prepare_load_box( ctx[N], opts[N] );
|
||||||
|
|
||||||
ARRAY_INIT( &mexcs );
|
ARRAY_INIT( &mexcs );
|
||||||
if (svars->opts[F] & OPEN_OLD) {
|
if ((svars->opts[F] & OPEN_OLD) && chan->max_messages) {
|
||||||
if (chan->max_messages) {
|
|
||||||
/* When messages have been expired on the near side, the far side fetch is split into
|
/* When messages have been expired on the near side, the far side fetch is split into
|
||||||
* two ranges: The bulk fetch which corresponds with the most recent messages, and an
|
* two ranges: The bulk fetch which corresponds with the most recent messages, and an
|
||||||
* exception list of messages which would have been expired if they weren't important. */
|
* exception list of messages which would have been expired if they weren't important. */
|
||||||
|
@ -835,13 +834,10 @@ box_opened2( sync_vars_t *svars, int t )
|
||||||
} else {
|
} else {
|
||||||
minwuid = 1;
|
minwuid = 1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
minwuid = UINT_MAX;
|
|
||||||
}
|
|
||||||
sync_ref( svars );
|
sync_ref( svars );
|
||||||
load_box( svars, F, minwuid, mexcs.array );
|
load_box( svars, F, minwuid, mexcs.array );
|
||||||
if (!check_cancel( svars ))
|
if (!check_cancel( svars ))
|
||||||
load_box( svars, N, (svars->opts[N] & OPEN_OLD) ? 1 : UINT_MAX, (uint_array_t){ NULL, 0 } );
|
load_box( svars, N, 1, (uint_array_t){ NULL, 0 } );
|
||||||
sync_deref( svars );
|
sync_deref( svars );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,13 +859,15 @@ load_box( sync_vars_t *svars, int t, uint minwuid, uint_array_t mexcs )
|
||||||
uint maxwuid = 0, pairuid = UINT_MAX;
|
uint maxwuid = 0, pairuid = UINT_MAX;
|
||||||
|
|
||||||
if (svars->opts[t] & OPEN_NEW) {
|
if (svars->opts[t] & OPEN_NEW) {
|
||||||
if (minwuid > svars->maxuid[t] + 1)
|
if (!(svars->opts[t] & OPEN_OLD) || (minwuid > svars->maxuid[t] + 1))
|
||||||
minwuid = svars->maxuid[t] + 1;
|
minwuid = svars->maxuid[t] + 1;
|
||||||
maxwuid = UINT_MAX;
|
maxwuid = UINT_MAX;
|
||||||
if (svars->opts[t] & OPEN_OLD_IDS) // Implies OPEN_OLD
|
if (svars->opts[t] & OPEN_OLD_IDS) // Implies OPEN_OLD
|
||||||
pairuid = get_seenuid( svars, t );
|
pairuid = get_seenuid( svars, t );
|
||||||
} else if (svars->opts[t] & OPEN_OLD) {
|
} else if (svars->opts[t] & OPEN_OLD) {
|
||||||
maxwuid = get_seenuid( svars, t );
|
maxwuid = get_seenuid( svars, t );
|
||||||
|
} else {
|
||||||
|
minwuid = UINT_MAX;
|
||||||
}
|
}
|
||||||
info( "Loading %s box...\n", str_fn[t] );
|
info( "Loading %s box...\n", str_fn[t] );
|
||||||
svars->drv[t]->load_box( svars->ctx[t], minwuid, maxwuid, svars->finduid[t], pairuid, svars->maxuid[t], mexcs, box_loaded, AUX );
|
svars->drv[t]->load_box( svars->ctx[t], minwuid, maxwuid, svars->finduid[t], pairuid, svars->maxuid[t], mexcs, box_loaded, AUX );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user