Changeset 3581

Show
Ignore:
Timestamp:
08/22/08 15:40:37 (3 months ago)
Author:
bellmich
Message:

- fixed error handling
- fixed disconnect on error

Location:
plugins/syncml/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • plugins/syncml/src/syncml_callbacks.c

    r3571 r3581  
    5050        switch (type) { 
    5151                case SML_DATA_SYNC_EVENT_ERROR: 
    52                         smlErrorDuplicate(&error, &locerror); 
     52                        env->abort =TRUE; 
     53                        smlErrorDuplicate(&locerror, &error); 
    5354                        smlErrorDeref(&error); 
    5455                        goto error; 
     
    5960                        break; 
    6061                case SML_DATA_SYNC_EVENT_FINISHED: 
    61                         if (dsObject == env->dsObject1 && env->dsObject2) { 
    62                                 if (!smlDataSyncInit(env->dsObject2, &locerror)) 
    63                                         goto error; 
    64                                 if (!smlDataSyncRun(env->dsObject2, &locerror)) 
    65                                         goto error; 
    66                         } else { 
    67                                 /* This is the real end of the sync process and 
    68                                  * so it is a good idea to commit the changes here 
    69                                  * and not earlier because now the remote peer 
    70                                  * commits too. 
    71                                  */ 
    72                                 o = env->databases; 
    73                                 for (; o; o = o->next) { 
    74                                         SmlDatabase *database = o->data; 
    75                                         g_assert(database->commitCtx); 
    76                                         report_success_on_context(&(database->commitCtx)); 
     62                        if (!env->abort) 
     63                        { 
     64                                if (dsObject == env->dsObject1 && env->dsObject2) { 
     65                                        if (!smlDataSyncInit(env->dsObject2, &locerror)) 
     66                                                goto error; 
     67                                        if (!smlDataSyncRun(env->dsObject2, &locerror)) 
     68                                                goto error; 
     69                                } else { 
     70                                        /* This is the real end of the sync process and 
     71                                         * so it is a good idea to commit the changes here 
     72                                         * and not earlier because now the remote peer 
     73                                         * commits too. 
     74                                         */ 
     75                                        o = env->databases; 
     76                                        for (; o; o = o->next) { 
     77                                                SmlDatabase *database = o->data; 
     78                                                g_assert(database->commitCtx); 
     79                                                report_success_on_context(&(database->commitCtx)); 
     80                                        } 
    7781                                } 
    78  
    79                                 /* a real disconnet happens */ 
    80                                 if (env->disconnectCtx) 
    81                                         report_success_on_context(&(env->disconnectCtx)); 
    8282                        } 
     83 
     84                        /* a real disconnet happens */ 
     85                        if (env->disconnectCtx) 
     86                                report_success_on_context(&(env->disconnectCtx)); 
    8387                        break; 
    8488                case SML_DATA_SYNC_EVENT_GOT_ALL_ALERTS: 
     
    116120        osync_trace(TRACE_INTERNAL, "%s: Cleaning up because of an error ...", __func__); 
    117121        OSyncError *oserror = NULL; 
    118         osync_error_set(&oserror, OSYNC_ERROR_GENERIC, smlErrorPrint(&error)); 
     122        osync_error_set(&oserror, OSYNC_ERROR_GENERIC, smlErrorPrint(&locerror)); 
    119123 
    120124        if (env->connectCtx) 
  • plugins/syncml/src/syncml_common.h

    r3579 r3581  
    9595        /* libsyncml state management */ 
    9696 
     97        SmlBool abort; 
    9798        SmlDataSyncEventType state1; 
    9899        SmlDataSyncEventType state2;