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);
876
876
}; // while not aborted and not message full
877
877
// we are not done until all aNextMessageCommands are also out
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
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);
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);
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
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);
1316
if (implProcessItem(syncitemP,aStatusCommand)) {
1317
aStatusCommand.setStatusCode(208); // client has won
1320
// failed, return status
1321
sta = aStatusCommand.getStatusCode();