commit 424e0e72210787b7fff1eee044478f59df7428e6
parent ea951a697f467bfe97fc244278e72c44aac88e60
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date: Sun, 29 Jul 2012 23:15:12 +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.
Diffstat:
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git 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 \