sync: refresh-from-server implementation configurable

Google does not implement refresh-from-server, therefore using it has
to be made configurable. It is enabled by default for Funambol and
disabled for everything else.

Existing user configs must be updated to use refresh-from-server with
Funambol:
   syncevolution --configure enableRefreshSync=1 funambol
This commit is contained in:
Patrick Ohly 2012-06-11 14:48:02 +02:00
parent 844fc10694
commit b32b506837
6 changed files with 39 additions and 2 deletions

View File

@ -3744,6 +3744,8 @@ protected:
"\n"
"enableWBXML (TRUE, unshared)\n"
"\n"
"enableRefreshSync (FALSE, unshared)\n"
"\n"
"maxMsgSize (150000, unshared), maxObjSize (4000000, unshared)\n"
"\n"
"SSLServerCertificates (" SYNCEVOLUTION_SSL_SERVER_CERTIFICATES ", unshared)\n"
@ -5080,6 +5082,7 @@ private:
"config.ini:deviceId = fixed-devid\n" /* this is not the default! */
"peers/scheduleworld/config.ini:# remoteDeviceId = \n"
"peers/scheduleworld/config.ini:# enableWBXML = 1\n"
"peers/scheduleworld/config.ini:# enableRefreshSync = 0\n"
"peers/scheduleworld/config.ini:# maxMsgSize = 150000\n"
"peers/scheduleworld/config.ini:# maxObjSize = 4000000\n"
"peers/scheduleworld/config.ini:# SSLServerCertificates = \n"
@ -5195,6 +5198,7 @@ private:
"spds/syncml/config.txt:deviceId = fixed-devid\n" /* this is not the default! */
"spds/syncml/config.txt:# remoteDeviceId = \n"
"spds/syncml/config.txt:# enableWBXML = 1\n"
"spds/syncml/config.txt:# enableRefreshSync = 0\n"
"spds/syncml/config.txt:# maxMsgSize = 150000\n"
"spds/syncml/config.txt:# maxObjSize = 4000000\n"
#ifdef ENABLE_LIBSOUP
@ -5261,6 +5265,10 @@ private:
"# enableWBXML = 1",
"enableWBXML = 0");
boost::replace_first(config,
"# enableRefreshSync = 0",
"enableRefreshSync = 1");
boost::replace_first(config,
"# RetryInterval = 2M",
"RetryInterval = 0");

View File

@ -1245,6 +1245,16 @@ static BoolConfigProperty syncPropWBXML("enableWBXML",
"not applicable when the peer is a SyncML client, because then the client\n"
"chooses the encoding",
"TRUE");
static BoolConfigProperty syncPropRefreshSync("enableRefreshSync",
"Use the more advanced refresh-from-server sync mode to\n"
"implement the refresh-from-remote operation. Some SyncML\n"
"servers do not support this. Therefore the default is to\n"
"delete local data before doing a slow sync, which has the\n"
"same effect. However, some servers work better when they\n"
"are told explicitly that the sync is a refresh sync. For\n"
"example, Funambol's One Media server rejects too many slow\n"
"syncs in a row with a 417 'retry later' error.\n",
"FALSE");
static ConfigProperty syncPropLogDir("logdir",
"full path to directory where automatic backups and logs\n"
"are stored for all synchronizations; if unset, then\n"
@ -1604,6 +1614,7 @@ public:
registry.push_back(&syncPropDevID);
registry.push_back(&syncPropRemoteDevID);
registry.push_back(&syncPropWBXML);
registry.push_back(&syncPropRefreshSync);
registry.push_back(&syncPropMaxMsgSize);
registry.push_back(&syncPropMaxObjSize);
registry.push_back(&syncPropSSLServerCertificates);
@ -1896,6 +1907,8 @@ InitStateString SyncConfig::getDevID() const { return syncPropDevID.getProperty(
void SyncConfig::setDevID(const string &value, bool temporarily) { syncPropDevID.setProperty(*getNode(syncPropDevID), value, temporarily); }
InitState<bool> SyncConfig::getWBXML() const { return syncPropWBXML.getPropertyValue(*getNode(syncPropWBXML)); }
void SyncConfig::setWBXML(bool value, bool temporarily) { syncPropWBXML.setProperty(*getNode(syncPropWBXML), value, temporarily); }
InitState<bool> SyncConfig::getRefreshSync() const { return syncPropRefreshSync.getPropertyValue(*getNode(syncPropRefreshSync)); }
void SyncConfig::setRefreshSync(bool value, bool temporarily) { syncPropRefreshSync.setProperty(*getNode(syncPropRefreshSync), value, temporarily); }
InitStateString SyncConfig::getLogDir() const { return syncPropLogDir.getProperty(*getNode(syncPropLogDir)); }
void SyncConfig::setLogDir(const string &value, bool temporarily) { syncPropLogDir.setProperty(*getNode(syncPropLogDir), value, temporarily); }
InitState<unsigned int> SyncConfig::getMaxLogDirs() const { return syncPropMaxLogDirs.getPropertyValue(*getNode(syncPropMaxLogDirs)); }

View File

@ -1542,6 +1542,9 @@ class SyncConfig {
virtual InitState<bool> getWBXML() const;
virtual void setWBXML(bool isWBXML, bool temporarily = false);
virtual InitState<bool> getRefreshSync() const;
virtual void setRefreshSync(bool enableRefreshSync, bool temporarily = false);
virtual InitStateString getUserAgent() const { return "SyncEvolution"; }
virtual InitStateString getMan() const { return "Patrick Ohly"; }
virtual InitStateString getMod() const { return "SyncEvolution"; }

View File

@ -2386,9 +2386,14 @@ void SyncContext::getConfigXML(string &xml, string &configname)
clientorserver <<
" <client type='plugin'>\n"
" <binfilespath>$(binfilepath)</binfilespath>\n"
" <defaultauth/>\n"
" <preferslowsync>no</preferslowsync>\n"
" <defaultauth/>\n";
if (getRefreshSync()) {
clientorserver <<
" <preferslowsync>no</preferslowsync>\n";
}
clientorserver <<
"\n" ;
string syncMLVersion (getSyncMLVersion());
if (!syncMLVersion.empty()) {
clientorserver << "<defaultsyncmlversion>"

View File

@ -7,6 +7,7 @@ syncURL = http://my.funambol.com/sync
WebURL = http://my.funambol.com
PeerName = Funambol
enableWBXML = FALSE
enableRefreshSync = TRUE
ConsumerReady = TRUE
RetryInterval = 0
IconURI = image://themedimage/icons/services/funambol

View File

@ -4448,6 +4448,7 @@ peers/scheduleworld/config.ini:PeerName = ScheduleWorld
config.ini:deviceId = fixed-devid
peers/scheduleworld/config.ini:# remoteDeviceId =
peers/scheduleworld/config.ini:# enableWBXML = 1
peers/scheduleworld/config.ini:# enableRefreshSync = 0
peers/scheduleworld/config.ini:# maxMsgSize = 150000
peers/scheduleworld/config.ini:# maxObjSize = 4000000
peers/scheduleworld/config.ini:# SSLServerCertificates = {4}
@ -4561,6 +4562,9 @@ sources/todo/config.ini:# databasePassword = '''.format(
config = config.replace("# enableWBXML = 1",
"enableWBXML = 0",
1)
config = config.replace("# enableRefreshSync = 0",
"enableRefreshSync = 1",
1)
config = config.replace("# RetryInterval = 2M",
"RetryInterval = 0",
1)
@ -4650,6 +4654,7 @@ spds/syncml/config.txt:PeerName = ScheduleWorld
spds/syncml/config.txt:deviceId = fixed-devid
spds/syncml/config.txt:# remoteDeviceId =
spds/syncml/config.txt:# enableWBXML = 1
spds/syncml/config.txt:# enableRefreshSync = 0
spds/syncml/config.txt:# maxMsgSize = 150000
spds/syncml/config.txt:# maxObjSize = 4000000
spds/syncml/config.txt:# SSLServerCertificates = {0}
@ -5645,6 +5650,8 @@ remoteDeviceId (no default, unshared)
enableWBXML (TRUE, unshared)
enableRefreshSync (FALSE, unshared)
maxMsgSize (150000, unshared), maxObjSize (4000000, unshared)
SSLServerCertificates ({0}, unshared)