isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 35375df63f013abff786ff612d13c1c7961fdff7
parent ae3a61b668b7a7b88a39471b84edcddab978cc58
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Fri, 20 May 2022 12:42:22 +0200

don't put IMAP stores in SST_BAD state into the unowned list

nothing would ever recycle them, so they'd just waste space. so cancel
them right away.

amends 9d22641.

Diffstat:
Msrc/drv_imap.c | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c @@ -1839,6 +1839,11 @@ imap_free_store( store_t *gctx ) assert( !ctx->pending && !ctx->in_progress && !ctx->wait_check ); + if (ctx->state == SST_BAD) { + imap_cancel_store( gctx ); + return; + } + free_generic_messages( &ctx->msgs->gen ); ctx->msgs = NULL; imap_set_bad_callback( gctx, imap_cancel_unowned, gctx ); @@ -1858,12 +1863,8 @@ imap_cleanup( void ) for (ctx = unowned; ctx; ctx = nctx) { nctx = ctx->next; imap_set_bad_callback( &ctx->gen, (void (*)(void *))imap_cancel_store, ctx ); - if (ctx->state != SST_BAD) { - ctx->expectBYE = 1; - imap_exec( ctx, NULL, imap_cleanup_p2, "LOGOUT" ); - } else { - imap_cancel_store( &ctx->gen ); - } + ctx->expectBYE = 1; + imap_exec( ctx, NULL, imap_cleanup_p2, "LOGOUT" ); } } @@ -1924,7 +1925,7 @@ imap_alloc_store( store_conf_t *conf, const char *label ) /* Then try to recycle a server connection. */ for (ctxp = &unowned; (ctx = *ctxp); ctxp = &ctx->next) - if (ctx->state != SST_BAD && ctx->conf->server == srvc) { + if (ctx->conf->server == srvc) { *ctxp = ctx->next; free_string_list( ctx->boxes ); ctx->boxes = NULL;