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.
This commit is contained in:
Oswald Buddenhagen 2022-05-20 12:42:22 +02:00
parent ae3a61b668
commit 35375df63f

View File

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