[Pkg-owncloud-commits] [owncloud-client] 219/484: owncloudcmd: add --max-sync-retries #4037
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:45 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 16c078963b375fac4cb820ff9f3703c80711d3a2
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Fri Oct 30 13:35:00 2015 +0100
owncloudcmd: add --max-sync-retries #4037
And limit by default to 3 retries
---
src/cmd/cmd.cpp | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp
index 0ac5138..85e07a3 100644
--- a/src/cmd/cmd.cpp
+++ b/src/cmd/cmd.cpp
@@ -58,6 +58,7 @@ struct CmdOptions {
bool ignoreHiddenFiles;
QString exclude;
QString unsyncedfolders;
+ int restartTimes;
};
// we can't use csync_set_userdata because the SyncEngine sets it already.
@@ -155,6 +156,7 @@ void help()
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;
@@ -222,6 +224,8 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
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();
}
@@ -268,6 +272,7 @@ int main(int argc, char **argv) {
options.useNetrc = false;
options.interactive = true;
options.ignoreHiddenFiles = true;
+ options.restartTimes = 3;
ClientProxy clientProxy;
parseOptions( app.arguments(), &options );
@@ -356,6 +361,7 @@ int main(int argc, char **argv) {
account->setCredentials(cred);
account->setSslErrorHandler(sslErrorHandler);
+ int restartCount = 0;
restart_sync:
CSYNC *_csync_ctx;
@@ -458,8 +464,12 @@ restart_sync:
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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list