/*
* 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
QString unsyncedfolders;
QString davPath;
int restartTimes;
+ int downlimit;
+ int uplimit;
};
// we can't use csync_set_userdata because the SyncEngine sets it already.
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;
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();
}
options.ignoreHiddenFiles = true;
options.nonShib = false;
options.restartTimes = 3;
+ options.uplimit = 0;
+ options.downlimit = 0;
ClientProxy clientProxy;
parseOptions( app.arguments(), &options );
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); });