commit 56c5a4d2467428c22e35bf447f05570a42caa3c0
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Sun Mar 13 15:51:09 2011 +0100

    make drv->cancel callback have no status code
    
    this function is not going to actually execute any commands, so it
    makes no sense for it to return a status code.

 src/drv_imap.c    |    4 ++--
 src/drv_maildir.c |    4 ++--
 src/isync.h       |    2 +-
 src/sync.c        |   17 ++++++++---------
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index be083a5..9602260 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -2177,10 +2177,10 @@ imap_list_p2( imap_store_t *ctx, struct imap_cmd *cmd, 
int response )
 
 static void
 imap_cancel( store_t *gctx,
-             void (*cb)( int sts, void *aux ), void *aux )
+             void (*cb)( void *aux ), void *aux )
 {
        (void)gctx;
-       cb( DRV_OK, aux );
+       cb( aux );
 }
 
 static void
diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 1533890..d157be7 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -1241,10 +1241,10 @@ maildir_close( store_t *gctx,
 
 static void
 maildir_cancel( store_t *gctx,
-                void (*cb)( int sts, void *aux ), void *aux )
+                void (*cb)( void *aux ), void *aux )
 {
        (void)gctx;
-       cb( DRV_OK, aux );
+       cb( aux );
 }
 
 static void
diff --git a/src/isync.h b/src/isync.h
index c8f2f00..8dc60d1 100644
--- a/src/isync.h
+++ b/src/isync.h
@@ -210,7 +210,7 @@ struct driver {
        void (*close)( store_t *ctx, /* IMAP-style: expunge inclusive */
                       void (*cb)( int sts, void *aux ), void *aux );
        void (*cancel)( store_t *ctx, /* only not yet sent commands */
-                       void (*cb)( int sts, void *aux ), void *aux );
+                       void (*cb)( void *aux ), void *aux );
        void (*commit)( store_t *ctx );
 };
 
diff --git a/src/sync.c b/src/sync.c
index 65dfe7e..b3f57cd 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -395,7 +395,7 @@ stats( sync_vars_t *svars )
 static void sync_bail( sync_vars_t *svars );
 static void sync_bail1( sync_vars_t *svars );
 static void sync_bail2( sync_vars_t *svars );
-static void cancel_done( int sts, void *aux );
+static void cancel_done( void *aux );
 
 static void
 cancel_sync( sync_vars_t *svars )
@@ -405,7 +405,12 @@ cancel_sync( sync_vars_t *svars )
        svars->cancel = 1;
        for (t = 0; t < 2; t++)
                if (svars->ret & SYNC_BAD(t)) {
-                       cancel_done( DRV_STORE_BAD, AUX );
+                       if (svars->ctx[t]) {
+                               /* this should never recurse into cancel_sync() 
*/
+                               svars->drv[t]->cancel_store( svars->ctx[t] );
+                               svars->ctx[t] = 0;
+                       }
+                       cancel_done( AUX );
                } else if (!(svars->state[t] & ST_SENT_CANCEL)) {
                        /* ignore subsequent failures from in-flight commands */
                        svars->state[t] |= ST_SENT_CANCEL;
@@ -414,16 +419,10 @@ cancel_sync( sync_vars_t *svars )
 }
 
 static void
-cancel_done( int sts, void *aux )
+cancel_done( void *aux )
 {
        SVARS(aux)
 
-       if (sts != DRV_OK && svars->ctx[t]) {
-               svars->ret |= SYNC_BAD(t);
-               /* this should never recurse into cancel_sync() */
-               svars->drv[t]->cancel_store( svars->ctx[t] );
-               svars->ctx[t] = 0;
-       }
        svars->state[t] |= ST_CANCELED;
        if (svars->state[1-t] & ST_CANCELED) {
                Fclose( svars->nfp );

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to