commit b37f28daecd6269935d43c744c016662a19779a3
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Sun Jul 29 23:15:12 2012 +0200

    make callbacks return early when canceling
    
    even after driver->cancel() the store may complete commands successfully.
    return early in this case, so we don't attempt to continue syncing.

 src/sync.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index b356013..f56c551 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -246,6 +246,11 @@ msg_fetched( int sts, void *aux )
        switch (sts) {
        case DRV_OK:
                INIT_SVARS(vars->aux);
+               if (check_cancel( svars )) {
+                       free( vars->data.data );
+                       vars->cb( SYNC_CANCELED, 0, vars );
+                       return;
+               }
 
                vars->msg->flags = vars->data.flags;
 
@@ -482,16 +487,15 @@ check_ret( int sts, void *aux )
 {
        DECL_SVARS;
 
-       switch (sts) {
-       case DRV_CANCELED:
+       if (sts == DRV_CANCELED)
                return 1;
-       case DRV_BOX_BAD:
-               INIT_SVARS(aux);
+       INIT_SVARS(aux);
+       if (sts == DRV_BOX_BAD) {
                svars->ret |= SYNC_FAIL;
                cancel_sync( svars );
                return 1;
        }
-       return 0;
+       return check_cancel( svars );
 }
 
 #define SVARS_CHECK_RET \

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to