[Pkg-owncloud-commits] [owncloud-client] 46/333: Use the legacy jobs when using bandwidth limiting
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:32 UTC 2014
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 432f377750f188ccb02c36ea11982ef74685755a
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Tue Feb 18 12:24:35 2014 +0100
Use the legacy jobs when using bandwidth limiting
Or if a environement variable is set
---
src/mirall/owncloudpropagator.cpp | 33 +++++++++++++++++++++++++++++++--
src/mirall/owncloudpropagator.h | 1 +
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp
index 22b837b..8360d64 100644
--- a/src/mirall/owncloudpropagator.cpp
+++ b/src/mirall/owncloudpropagator.cpp
@@ -90,8 +90,19 @@ PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItem& item) {
// Should we set the mtime?
return 0;
}
- if (item._dir != SyncFileItem::Up) return new PropagateDownloadFileQNAM(this, item);
- else return new PropagateUploadFileQNAM(this, item);
+ if (useLegacyJobs()) {
+ if (item._dir != SyncFileItem::Up) {
+ return new PropagateDownloadFileLegacy(this, item);
+ } else {
+ return new PropagateUploadFileLegacy(this, item);
+ }
+ } else {
+ if (item._dir != SyncFileItem::Up) {
+ return new PropagateDownloadFileQNAM(this, item);
+ } else {
+ return new PropagateUploadFileQNAM(this, item);
+ }
+ }
case CSYNC_INSTRUCTION_RENAME:
if (item._dir == SyncFileItem::Up) {
return new PropagateRemoteRename(this, item);
@@ -178,6 +189,24 @@ bool OwncloudPropagator::isInSharedDirectory(const QString& file)
return re;
}
+/**
+ * Return true if we should use the legacy jobs.
+ * Some feature are not supported by QNAM and therefore we still use the legacy jobs
+ * for this case.
+ */
+bool OwncloudPropagator::useLegacyJobs()
+{
+ if (_downloadLimit.fetchAndAddAcquire(0) != 0 || _uploadLimit.fetchAndAddAcquire(0) != 0) {
+ // QNAM does not support bandwith limiting
+ return true;
+ }
+
+ // Allow an environement variable for debugging
+ QByteArray env = qgetenv("OWNCLOUD_USE_LEGACY_JOBS");
+ return env=="true" || env =="1";
+}
+
+
void PropagateDirectory::start()
{
_current = -1;
diff --git a/src/mirall/owncloudpropagator.h b/src/mirall/owncloudpropagator.h
index a66a0a1..b61200d 100644
--- a/src/mirall/owncloudpropagator.h
+++ b/src/mirall/owncloudpropagator.h
@@ -163,6 +163,7 @@ class OwncloudPropagator : public QObject {
PropagateItemJob *createJob(const SyncFileItem& item);
QScopedPointer<PropagateDirectory> _rootJob;
+ bool useLegacyJobs();
public:
/* 'const' because they are accessed by the thread */
--
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