detecting slow sync: use LOCERR_DATASTORE_ABORT (MB #2416)

The ABORTDATASTORE() handling in the Synthesis engine was fixed
so that it aborts the whole session, without looking at further
datastores.

In order to get our desired behavior (continue checking other sources),
a special LOCERR_DATASTORE_ABORT error code was introduced. We use
that in our ABORTDATASTORE(), then translate it back to the SyncEvolution
specific STATUS_UNEXPECTED_SLOW_SYNC = 22000.

The reasons for keeping that code are:
- the sync-UI checks it
- encoding in the sync-UI that LOCERR_DATASTORE_ABORT == slow sync
  would expose an implementation detail that we might want to change
  in the future
This commit is contained in:
Patrick Ohly 2010-02-04 21:30:54 +01:00
parent 0033aeae25
commit 00975cf556

View file

@ -1282,6 +1282,10 @@ void SyncContext::displaySourceProgress(sysync::TProgressEventEnum type,
break;
case 0:
break;
case sysync::LOCERR_DATASTORE_ABORT:
// this can mean only one thing in SyncEvolution: unexpected slow sync
extra1 = STATUS_UNEXPECTED_SLOW_SYNC;
// no break!
default:
// Printing unknown status codes here is of somewhat questionable value,
// because even "good" sources will get a bad status when the overall
@ -1931,7 +1935,7 @@ void SyncContext::getConfigXML(string &xml, string &configname)
" <datastoreinitscript><![CDATA[\n"
" if (SLOWSYNC() && ALERTCODE() != 203) {\n" // SLOWSYNC() is true for acceptable refresh-from-client, check for that
" DEBUGMESSAGE(\"slow sync not expected by SyncEvolution, disabling datastore\");\n"
" ABORTDATASTORE(" << STATUS_UNEXPECTED_SLOW_SYNC << ");\n"
" ABORTDATASTORE(" << sysync::LOCERR_DATASTORE_ABORT << ");\n"
" // tell UI to abort instead of sending the next message\n"
" SETSESSIONVAR(\"delayedabort\", 1);\n"
" }\n"