~ubuntu-branches/ubuntu/vivid/libsynthesis/vivid-201501071725

« back to all changes in this revision

Viewing changes to src/sysync/stdlogicds.cpp

  • Committer: Bazaar Package Importer
  • Author(s): David Bremner
  • Date: 2010-11-20 19:50:44 UTC
  • mfrom: (3.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20101120195044-8s6wxqb2d0nmqdv3
Tags: 3.4.0.6+ds5-2
* Upload to unstable.
* Add missing commit from upstream 3.4.0.6+ds5

Show diffs side-by-side

added added

removed removed

Lines of Context:
871
871
      fItemsSent++; // overall counter for statistics
872
872
      itemcount++; // per message counter
873
873
      // send event (but no check for abort)
874
 
      OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_itemsent,getDSConfig(),fItemsSent,getNumberOfChanges(),0);
 
874
      DB_PROGRESS_EVENT(this,pev_itemsent,fItemsSent,getNumberOfChanges(),0);
875
875
    }
876
876
  }; // while not aborted and not message full
877
877
  // we are not done until all aNextMessageCommands are also out
1033
1033
      fItemsSent++;
1034
1034
      // send event and check for abort
1035
1035
      #ifdef PROGRESS_EVENTS
1036
 
      if (!fSessionP->getSyncAppBase()->NotifyProgressEvent(pev_itemsent,getDSConfig(),fItemsSent,getNumberOfChanges())) {
 
1036
      if (!DB_PROGRESS_EVENT(this,pev_itemsent,fItemsSent,getNumberOfChanges(),0)) {
1037
1037
        implEndDataRead(); // terminate reading
1038
1038
        fSessionP->AbortSession(500,true,LOCERR_USERABORT);
1039
1039
        return false; // error
1040
1040
      }
1041
1041
      // check for "soft" suspension
1042
 
      if (!fSessionP->getSyncAppBase()->NotifyProgressEvent(pev_suspendcheck)) {
 
1042
      if (!SESSION_PROGRESS_EVENT(fSessionP,pev_suspendcheck,NULL,0,0,0)) {
1043
1043
        fSessionP->SuspendSession(LOCERR_USERSUSPEND);
1044
1044
      }
1045
1045
      #endif
1297
1297
          case sop_add :
1298
1298
            if (sta==418) {
1299
1299
              // 418: item already exists, this is kind of a conflict
1300
 
              // (should not happen normally, but can happen if aborted session was not
1301
 
              // completely rolled back by server, so treat it like
1302
 
              // "conflict resolved by client data winning")
1303
 
              PDEBUGPRINTFX(DBG_DATA,("to-be-added item already exists, and incomplete rollbacks in server possible -> trying replace (=conflict resolved by client winning)"));
1304
 
              // - switch to replace
1305
 
              syncitemP->setSyncOp(sop_replace);
1306
 
              irregular=true;
1307
 
              // - process again
1308
 
              if (implProcessItem(syncitemP,aStatusCommand)) {
1309
 
                aStatusCommand.setStatusCode(208); // client has won
 
1300
              if (isResuming() || fIgnoreUpdate || IS_CLIENT) {
 
1301
                // - in a client, this should not happen (prevented via checking against pending maps before
 
1302
                //   this routine is called) - if it still does just report the status back
 
1303
                // - in a resume, this can happen and the add should be ignored (se we return the status 418)
 
1304
                // - if updates are to be ignored, don't try update instead (and report 418)
 
1305
                // --> just return the status as-is
1310
1306
              }
1311
1307
              else {
1312
 
                sta = aStatusCommand.getStatusCode();
 
1308
                // in normal sync in the server case, this can happen when a previous session
 
1309
                // was aborted (and already applied adds not rolled back)
 
1310
                // --> reprocess it as a replace
 
1311
                PDEBUGPRINTFX(DBG_DATA,("to-be-added item already exists -> trying replace (=conflict resolved by client winning)"));
 
1312
                // - switch to replace
 
1313
                syncitemP->setSyncOp(sop_replace);
 
1314
                irregular=true;
 
1315
                // - process again
 
1316
                if (implProcessItem(syncitemP,aStatusCommand)) {
 
1317
                  aStatusCommand.setStatusCode(208); // client has won
 
1318
                }
 
1319
                else {
 
1320
                  // failed, return status
 
1321
                  sta = aStatusCommand.getStatusCode();
 
1322
                }
1313
1323
              }
1314
1324
            }
1315
1325
            break;