commit 35375df63f013abff786ff612d13c1c7961fdff7
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Fri May 20 12:42:22 2022 +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.

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

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 3428bc2b..0f0f17e3 100644
--- 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;


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to