summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Zeller <luz@plan44.ch>2010-12-16 18:32:02 +0100
committerPatrick Ohly <patrick.ohly@intel.com>2010-12-19 22:52:23 +0100
commit31f90cff28d24a5f31579039597ccfc5a534288a (patch)
tree01d36cb3e60b44edecd7c1ce745f714212a67794
parentd68c46d02710c19e4db2c854966aec972542a2a9 (diff)
engine: server case: fixed bad bug that could mess up tempGUIDs. These must be cleared when first <Sync> is received.libsynthesis_3.4.0.6+syncevolution-1-1-1libsynthesis_3.4.0.6+syncevolution-1-1-0-99-1
Until now, the tempGUIDs were cleared only once when <Alert> was received. This is ok to create a clean starting point for loading previous session's tempGUIDs, which might be needed to resolve "early maps" also related to the previous session. However, as soon as the current session starts <Sync>ing, that is, exchanging new items, these temporary IDs become invalid and fTempGUIDMap must be cleared once again. The missing cleanup has led to collisions in the tempGUID name space, because the tempGUIDs are created based on the fact that the list is empty at the beginning of <Sync>. As it could have entries from (possibly much!) earlier sessions, all sort of weird things could and did happen. Thanks Patrick for the extensive investigation of this!
-rw-r--r--src/sysync/localengineds.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/sysync/localengineds.cpp b/src/sysync/localengineds.cpp
index 3eec6b7..6d5f90f 100644
--- a/src/sysync/localengineds.cpp
+++ b/src/sysync/localengineds.cpp
@@ -2455,10 +2455,11 @@ TAlertCommand *TLocalEngineDS::engProcessSyncAlert(
#ifdef SYSYNC_SERVER
if (IS_SERVER) {
// server case: forget Temp GUID mapping
- PDEBUGPRINTFX(DBG_DATA,(
- "fTempGUIDMap: removing %ld items", (long)fTempGUIDMap.size()
- ));
- fTempGUIDMap.clear(); // forget all previous temp GUID mappings
+ // make sure we are not carrying forward any left-overs. Last sessions's tempGUID mappings that are
+ // needed for "early map" resolution might be loaded by the call to engInitSyncAnchors below.
+ // IMPORTANT NOTE: the tempGUIDs that might get loaded will become invalid as soon as <Sync>
+ // starts - so fTempGUIDMap needs to be cleared again as soon as the first <Sync> command arrives from the client.
+ fTempGUIDMap.clear();
}
#endif
// save remote's next anchor for saving at end of session
@@ -3931,7 +3932,9 @@ bool TLocalEngineDS::engProcessSyncCmd(
startingNow = true; // initiating start now
#ifdef SYSYNC_SERVER
if (IS_SERVER) {
- // - let local datastore (derived DB-specific class) prepare for sync
+ // at this point, all temporary GUIDs become invalid (no "early map" possible any more which might refer to last session's tempGUIDs)
+ fTempGUIDMap.clear(); // forget all previous session's temp GUID mappings
+ // let local datastore (derived DB-specific class) prepare for sync
localstatus sta = changeState(dssta_dataaccessstarted);
if (sta!=LOCERR_OK) {
// abort session (old comment: %%% aborting datastore only does not work, will loop, why? %%%)