ActiveSync: adapted slow sync handling

The error message for "Invalid synchronization key" changed in
activesyncd, now it contains the D-Bus error type as prefix. Fixed by
doing a substring search.

Also, not freeing the GError before trying again is a bug. Apparently
that was ignored earlier, now it triggers an assert.
This commit is contained in:
Patrick Ohly 2012-07-17 09:24:55 +02:00
parent b083d343c2
commit e9796468bb
2 changed files with 4 additions and 4 deletions

View file

@ -94,7 +94,6 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
}
}
GErrorCXX gerror;
gboolean moreAvailable = TRUE;
setCurrentSyncKey(getStartSyncKey());
@ -106,6 +105,7 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
moreAvailable;
firstIteration = false) {
gchar *buffer = NULL;
GErrorCXX gerror;
EASItemsCXX created, updated;
EASIdsCXX deleted;
bool wasSlowSync = getCurrentSyncKey().empty();
@ -123,7 +123,7 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
gerror.m_gerror->domain == EAS_TYPE_CONECTION_ERROR &&
gerror.m_gerror->code == EAS_CONNECTION_SYNC_ERROR_INVALIDSYNCKEY && */
gerror.m_gerror->message &&
!strcmp(gerror.m_gerror->message, "Sync error: Invalid synchronization key") &&
!strstr(gerror.m_gerror->message, "Sync error: Invalid synchronization key") &&
firstIteration) {
// fall back to slow sync
// slowSync = true;

View file

@ -95,7 +95,6 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
SE_LOG_DEBUG(this, NULL, "sync key %s, starting incremental sync", lastToken.c_str());
}
GErrorCXX gerror;
gboolean moreAvailable = TRUE;
m_currentSyncKey = m_startSyncKey;
@ -107,6 +106,7 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
moreAvailable;
firstIteration = false) {
gchar *buffer = NULL;
GErrorCXX gerror;
EASItemsCXX created, updated;
EASIdsCXX deleted;
bool wasSlowSync = m_currentSyncKey.empty();
@ -124,7 +124,7 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
gerror.m_gerror->domain == EAS_TYPE_CONNECTION_ERROR &&
gerror.m_gerror->code == EAS_CONNECTION_SYNC_ERROR_INVALIDSYNCKEY && */
gerror.m_gerror->message &&
!strcmp(gerror.m_gerror->message, "Sync error: Invalid synchronization key") &&
strstr(gerror.m_gerror->message, "Sync error: Invalid synchronization key") &&
firstIteration) {
// fall back to slow sync
slowSync = true;