Changeset 3185

Show
Ignore:
Timestamp:
02/22/08 12:01:40 (9 months ago)
Author:
bellmich
Message:

If I want to commit some write actions then I should check
the answer to the write actions and not a secondary map.

So I replaced the weak commit code which relies on maps
by code which relies on COMMITEDCHANGES (this required a
fix to libsyncml - API neutral).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/syncml/src/syncml_callbacks.c

    r3183 r3185  
    192192 
    193193                                if (database->commitCtx) { 
    194                                         /* If this is a server which received a map 
    195                                          * then libsyncml does not disconnect 
    196                                          * automatically. So the commit must be 
    197                                          * managed similar to the change context. 
    198                                          * 
    199                                          * NOTE: this function only perform an action 
    200                                          *       if a map was received. 
     194                                        /* If a sync command was sent then it is 
     195                                         * good idea to commit manually and not 
     196                                         * to rely on the disconnect which does 
     197                                         * not work properly for example if a 
     198                                         * client sends a map. 
    201199                                         */ 
    202200                                        _init_commit_ctx_cleanup(database, &error); 
     
    287285                        break; 
    288286                case SML_DS_EVENT_COMMITEDCHANGES: 
    289                         /* This event only happens if a map was received 
    290                          * and completely handled. So this is an OMA DS 
    291                          * server and it is necessary to commit the 
    292                          * stuff here manually 
    293                          * because the automatic disconnect of libsyncml 
    294                          * only works if the last message does not 
    295                          * contain any commands (a map is a command). 
     287                        /* This event only happens if a sync reply was 
     288                         * received and completely handled. 
    296289                         */ 
    297                         database->gotMap = TRUE; 
     290                        database->commitWrite = TRUE; 
    298291                        _init_commit_ctx_cleanup(database, &error); 
    299292                        break; 
     
    346339        SmlDatabase *database = (SmlDatabase*) userdata; 
    347340 
    348         osync_trace(TRACE_INTERNAL, "Received an reply to our Alert - %s\n", database->objtype); 
     341        osync_trace(TRACE_INTERNAL, "Received a reply to our Alert - %s\n", database->objtype); 
    349342 
    350343        /* If we talk as an OMA DS client with server like an OCS 
  • plugins/syncml/src/syncml_common.c

    r3183 r3185  
    233233void _init_commit_ctx_cleanup(SmlDatabase *database, SmlError **error) 
    234234{ 
    235         osync_trace(TRACE_ENTRY, "%s(gotMap: %i, gotFinal %i)", __func__, 
    236                  database->gotMap, database->env->gotFinal); 
     235        osync_trace(TRACE_ENTRY, "%s(commitWrite: %i, gotFinal %i)", __func__, 
     236                 database->commitWrite, database->env->gotFinal); 
    237237 
    238238        g_assert(database->commitCtx); 
     
    244244        // gotFinal must be resetted at every new message 
    245245        // until we received a sync command (not alert) 
    246         if (database->env->gotFinal && database->gotMap) { 
    247                 osync_trace(TRACE_INTERNAL, "%s: reported success on server change context.", __func__); 
     246        if (database->env->gotFinal && database->commitWrite) { 
     247                osync_trace(TRACE_INTERNAL, "%s: reported success on server commit context.", __func__); 
    248248                report_success_on_context(&(database->commitCtx)); 
    249249        } 
  • plugins/syncml/src/syncml_common.h

    r3183 r3185  
    156156        osync_bool gotChanges; 
    157157        unsigned int pendingChanges; 
    158         osync_bool gotMap
     158        osync_bool commitWrite
    159159 
    160160        OSyncContext *syncModeCtx; 
  • plugins/syncml/src/syncml_ds_server.c

    r3183 r3185  
    136136    if (!send_sync_message(database, _recv_sync_reply, &oserror)) 
    137137        goto oserror; 
    138  
    139     /* If there are no changes then commit here because there will be no events. */ 
    140     if (num == 0) 
    141         report_success_on_context(&(database->commitCtx)); 
    142138 
    143139    osync_trace(TRACE_EXIT, "%s", __func__);