bool ignoreHiddenFiles;
QString exclude;
QString unsyncedfolders;
+ int restartTimes;
};
// we can't use csync_set_userdata because the SyncEngine sets it already.
std::cout << " --password, -p [pass] Use [pass] as password" << std::endl;
std::cout << " -n Use netrc (5) for login" << std::endl;
std::cout << " --non-interactive Do not block execution with interaction" << std::endl;
+ std::cout << " --max-sync-retries [n] Retries maximum n times (default to 3)" << std::endl;
std::cout << " -h Sync hidden files,do not ignore them" << std::endl;
std::cout << " --version, -v Display version and exit" << std::endl;
std::cout << "" << std::endl;
options->exclude = it.next();
} else if( option == "--unsyncedfolders" && !it.peekNext().startsWith("-") ) {
options->unsyncedfolders = it.next();
+ } else if( option == "--max-sync-retries" && !it.peekNext().startsWith("-") ) {
+ options->restartTimes = it.next().toInt();
} else {
help();
}
options.useNetrc = false;
options.interactive = true;
options.ignoreHiddenFiles = true;
+ options.restartTimes = 3;
ClientProxy clientProxy;
parseOptions( app.arguments(), &options );
account->setCredentials(cred);
account->setSslErrorHandler(sslErrorHandler);
+ int restartCount = 0;
restart_sync:
CSYNC *_csync_ctx;
csync_destroy(_csync_ctx);
if (engine.isAnotherSyncNeeded()) {
- qDebug() << "Restarting Sync, because another sync is needed";
- goto restart_sync;
+ if (restartCount < options.restartTimes) {
+ restartCount++;
+ qDebug() << "Restarting Sync, because another sync is needed" << restartCount;
+ goto restart_sync;
+ }
+ qWarning() << "Another sync is needed, but not done because restart count is exceeded" << restartCount;
}
return 0;