lock .uidvalidity on demand
a maildir re-scan doesn't need to lock it if it doesn't need to allocate any new uids.
This commit is contained in:
parent
4aad8c9e04
commit
2eece82276
|
@ -590,6 +590,10 @@ lcktmr_timeout( void *aux )
|
||||||
static int
|
static int
|
||||||
maildir_obtain_uid( maildir_store_t *ctx, int *uid )
|
maildir_obtain_uid( maildir_store_t *ctx, int *uid )
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if ((ret = maildir_uidval_lock( ctx )) != DRV_OK)
|
||||||
|
return ret;
|
||||||
*uid = ++ctx->nuid;
|
*uid = ++ctx->nuid;
|
||||||
return maildir_store_uid( ctx );
|
return maildir_store_uid( ctx );
|
||||||
}
|
}
|
||||||
|
@ -674,12 +678,6 @@ maildir_scan( maildir_store_t *ctx, msglist_t *msglist )
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char buf[_POSIX_PATH_MAX], nbuf[_POSIX_PATH_MAX];
|
char buf[_POSIX_PATH_MAX], nbuf[_POSIX_PATH_MAX];
|
||||||
|
|
||||||
#ifdef USE_DB
|
|
||||||
if (!ctx->db)
|
|
||||||
#endif /* USE_DB */
|
|
||||||
if ((ret = maildir_uidval_lock( ctx )) != DRV_OK)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
again:
|
again:
|
||||||
msglist->ents = 0;
|
msglist->ents = 0;
|
||||||
msglist->nents = msglist->nalloc = 0;
|
msglist->nents = msglist->nalloc = 0;
|
||||||
|
@ -1329,8 +1327,7 @@ maildir_store_msg( store_t *gctx, msg_data_t *data, int to_trash,
|
||||||
} else
|
} else
|
||||||
#endif /* USE_DB */
|
#endif /* USE_DB */
|
||||||
{
|
{
|
||||||
if ((ret = maildir_uidval_lock( ctx )) != DRV_OK ||
|
if ((ret = maildir_obtain_uid( ctx, &uid )) != DRV_OK) {
|
||||||
(ret = maildir_obtain_uid( ctx, &uid )) != DRV_OK) {
|
|
||||||
free( data->data );
|
free( data->data );
|
||||||
cb( ret, 0, aux );
|
cb( ret, 0, aux );
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user