Skip to content

Commit

Permalink
[buteo-syncml] Use slow sync if preferred by sync agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Bea Lam committed Feb 5, 2014
1 parent a028b08 commit 135a4c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rpm/buteo-syncml-qt5.spec
Expand Up @@ -15,7 +15,7 @@ BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(libwbxml2)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(openobex)
BuildRequires: pkgconfig(buteosyncfw5)
BuildRequires: pkgconfig(buteosyncfw5) >= 0.6.24

%description
%{summary}.
Expand Down
10 changes: 5 additions & 5 deletions src/client/ClientSessionHandler.cpp
Expand Up @@ -222,9 +222,9 @@ void ClientSessionHandler::handleNotificationPackage( const SANDS& aData )

target->setTargetDatabase( serverURI );

// Check that we have a last anchor. If not, force slow sync
if( target->getRemoteLastAnchor().isEmpty() ) {
LOG_DEBUG( "Did not find last remote anchor, forcing slow sync" );
// Use slow sync if this is the preferred mode or if we don't have a last anchor
if( iConfig->getSyncMode().syncType() == TYPE_SLOW || target->getRemoteLastAnchor().isEmpty() ) {
LOG_DEBUG( "Did not find last remote anchor or slow sync is forced, using slow sync" );
SyncMode* mode = target->getSyncMode();
mode->toSlowSync();
target->setSyncMode( *mode );
Expand Down Expand Up @@ -686,8 +686,8 @@ void ClientSessionHandler::setupSyncTargets()
if (target != NULL) {
QString targetDb = iConfig->getTarget( sourceDb );
target->setTargetDatabase( targetDb );
// Check that we have a last anchor. If not, force slow sync
if( target->getRemoteLastAnchor().isEmpty() ) {
// Use slow sync if this is the preferred mode or if we don't have a last anchor
if (iConfig->getSyncMode().syncType() == TYPE_SLOW || target->getRemoteLastAnchor().isEmpty()) {
LOG_DEBUG( "Did not find last remote anchor, forcing slow sync" );
SyncMode* mode = target->getSyncMode();
mode->toSlowSync();
Expand Down
4 changes: 3 additions & 1 deletion src/server/ServerSessionHandler.cpp
Expand Up @@ -469,7 +469,9 @@ ResponseStatusCode ServerSessionHandler::setupTargetByClient( const SyncMode& aS
target->setRemoteNextAnchor( anchors.next );
target->setTargetDatabase( item.source );

if( anchorMismatch( aSyncMode, *target, anchors.last ) )
if( aSyncMode.syncType() == TYPE_SLOW
|| iConfig->getSyncMode().syncType() == TYPE_SLOW
|| anchorMismatch( aSyncMode, *target, anchors.last ) )
{

LOG_DEBUG("Anchor mismatch, refresh required");
Expand Down

0 comments on commit 135a4c6

Please sign in to comment.