From 2587fe93829c7df3a3249f202fd45ca7b74d554c Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 20 Apr 2011 15:17:40 +0200 Subject: [PATCH] server sync session: detect final sync mode, part II (BMC #2786) testOneWayFromClient was still failing in server mode because of a similar issue as with slow sync as fallback for refresh-from-server: the client can ask for a two-way sync and then withhold all of its own changes to achieve the same effect. Detect this based on the requested sync mode. --- src/syncevo/SyncContext.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/syncevo/SyncContext.cpp b/src/syncevo/SyncContext.cpp index ba3cf0fc..5a03e097 100644 --- a/src/syncevo/SyncContext.cpp +++ b/src/syncevo/SyncContext.cpp @@ -1595,6 +1595,17 @@ void SyncContext::displaySourceProgress(sysync::TProgressEventEnum type, switch (extra3) { case 0: mode = SYNC_TWO_WAY; + if (m_serverMode && + m_serverAlerted && + source.getSync() == "one-way-from-server") { + // As in the slow/refresh-from-server case below, + // pretending to do a two-way incremental sync + // is a correct way of executing the requested + // one-way sync, as long as the client doesn't + // send any of its own changes. The Synthesis + // engine does that. + mode = SYNC_ONE_WAY_FROM_SERVER; + } break; case 1: mode = SYNC_ONE_WAY_FROM_SERVER;