Changeset 3583

Show
Ignore:
Timestamp:
08/22/08 16:42:09 (3 months ago)
Author:
bellmich
Message:

Fixes for OMA DS client support

- fixed the alert type of the second connection
- sent an empty sync command during the first connection
- the second connection is only initialized if there are

any changes to send

Files:
1 modified

Legend:

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

    r3581 r3583  
    6262                        if (!env->abort) 
    6363                        { 
    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 { 
     64                                if (!env->dsObject2 || dsObject == env->dsObject2) { 
    7065                                        /* This is the real end of the sync process and 
    7166                                         * so it is a good idea to commit the changes here 
     
    9287                                if (env->connectCtx) 
    9388                                        report_success_on_context(&(env->connectCtx)); 
     89                                if (env->dsObject2) 
     90                                { 
     91                                        /* If this is the first connection of an 
     92                                         * OMA DS client then we send an empty sync. 
     93                                         */ 
     94                                        if (!smlDataSyncSendChanges(env->dsObject1, &locerror)) 
     95                                                goto error; 
     96                                } 
    9497                        } else { 
    9598                                if (!smlDataSyncSendChanges(env->dsObject2, &locerror)) 
     
    160163 
    161164        SmlPluginEnv *env = userdata; 
    162         SmlDatabase *database = get_database_from_source(env, source, error); 
    163         if (!database) 
    164                 goto error; 
    165  
    166         /* locate alert type of sink */ 
    167         if (osync_objtype_sink_get_slowsync(database->sink)) 
    168                 type = SML_ALERT_SLOW_SYNC; 
    169         else 
     165 
     166        if (env->dsObject2 && env->dsObject2 == dsObject) 
     167        { 
     168                /* If this is the second connection of an OMA DS client 
     169                 * then first connection should be successful and so the 
     170                 * second connection should be no SLOW-SYNC. 
     171                 */ 
    170172                type = SML_ALERT_TWO_WAY; 
     173        } else { 
     174                SmlDatabase *database = get_database_from_source(env, source, error); 
     175                if (!database) 
     176                        goto error; 
     177 
     178                /* locate alert type of sink */ 
     179                if (osync_objtype_sink_get_slowsync(database->sink)) 
     180                        type = SML_ALERT_SLOW_SYNC; 
     181                else 
     182                        type = SML_ALERT_TWO_WAY; 
     183        } 
    171184 
    172185        osync_trace(TRACE_EXIT, "%s - %d", __func__, type);