mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
added owncloudcmd bandwidth limit parameter (#5707)
This commit is contained in:
parent
8cb3a77022
commit
ada2be94f2
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) by Olivier Goffart <ogoffart@owncloud.com>
|
||||
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
|
||||
* Copyright (C) by Daniel Heule <daniel.heule@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -67,6 +68,8 @@ struct CmdOptions {
|
||||
QString unsyncedfolders;
|
||||
QString davPath;
|
||||
int restartTimes;
|
||||
int downlimit;
|
||||
int uplimit;
|
||||
};
|
||||
|
||||
// we can't use csync_set_userdata because the SyncEngine sets it already.
|
||||
@ -169,6 +172,8 @@ void help()
|
||||
std::cout << " --nonshib Use Non Shibboleth WebDAV authentication" << std::endl;
|
||||
std::cout << " --davpath [path] Custom themed dav path, overrides --nonshib" << std::endl;
|
||||
std::cout << " --max-sync-retries [n] Retries maximum n times (default to 3)" << std::endl;
|
||||
std::cout << " --uplimit [n] Limit the upload speed of files to n KB/s" << std::endl;
|
||||
std::cout << " --downlimit [n] Limit the download speed of files to n KB/s" << 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;
|
||||
@ -244,6 +249,10 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
|
||||
options->davPath = it.next();
|
||||
} else if( option == "--max-sync-retries" && !it.peekNext().startsWith("-") ) {
|
||||
options->restartTimes = it.next().toInt();
|
||||
} else if( option == "--uplimit" && !it.peekNext().startsWith("-") ) {
|
||||
options->uplimit = it.next().toInt() * 1000;
|
||||
} else if( option == "--downlimit" && !it.peekNext().startsWith("-") ) {
|
||||
options->downlimit = it.next().toInt() * 1000;
|
||||
} else {
|
||||
help();
|
||||
}
|
||||
@ -297,6 +306,8 @@ int main(int argc, char **argv) {
|
||||
options.ignoreHiddenFiles = true;
|
||||
options.nonShib = false;
|
||||
options.restartTimes = 3;
|
||||
options.uplimit = 0;
|
||||
options.downlimit = 0;
|
||||
ClientProxy clientProxy;
|
||||
|
||||
parseOptions( app.arguments(), &options );
|
||||
@ -478,6 +489,7 @@ restart_sync:
|
||||
|
||||
SyncEngine engine(account, options.source_dir, folder, &db);
|
||||
engine.setIgnoreHiddenFiles(options.ignoreHiddenFiles);
|
||||
engine.setNetworkLimits(options.uplimit, options.downlimit);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
QObject::connect(&engine, &SyncEngine::finished,
|
||||
[&app](bool result) { app.exit(result ? EXIT_SUCCESS : EXIT_FAILURE); });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user