commit eb14ff37f1f811b5866a4d9584153a52d53bf31e
Author: Oswald Buddenhagen <[email protected]>
Date:   Sat Mar 19 22:12:55 2011 +0100

    cancel submitted commands when canceling store
    
    we already have some minimal asynchronicity, so there might be commands
    in flight when a fatal error comes in.

 src/drv_imap.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index e899366..e81a7b3 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -278,6 +278,21 @@ submit_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd, 
const char *fmt, ... )
        return ret;
 }
 
+static void
+cancel_submitted_imap_cmds( imap_store_t *ctx )
+{
+       struct imap_cmd *cmd;
+
+       while ((cmd = ctx->in_progress)) {
+               ctx->in_progress = cmd->next;
+               /* don't update num_in_progress and in_progress_append - store 
is dead */
+               cmd->param.done( ctx, cmd, RESP_CANCEL );
+               free( cmd->param.data );
+               free( cmd->cmd );
+               free( cmd );
+       }
+}
+
 static int
 imap_exec( imap_store_t *ctx, struct imap_cmd *cmdp,
            int (*done)( imap_store_t *ctx, struct imap_cmd *cmd, int response 
),
@@ -919,6 +934,7 @@ imap_cancel_store( store_t *gctx )
        imap_store_t *ctx = (imap_store_t *)gctx;
 
        socket_close( &ctx->conn );
+       cancel_submitted_imap_cmds( ctx );
        free_generic_messages( gctx->msgs );
        free_string_list( ctx->gen.boxes );
        free_list( ctx->ns_personal );

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to