[Pkg-owncloud-commits] [owncloud-client] 139/218: Propagator: Simplify sub job finished counting #3844

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 17 14:30:59 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 ef0ab93e05e41baba0ee24d27aacf7bd445def17
Author: Christian Kamm <mail at ckamm.de>
Date:   Thu Sep 17 10:12:23 2015 +0200

    Propagator: Simplify sub job finished counting #3844
---
 src/libsync/owncloudpropagator.cpp | 11 +++++------
 src/libsync/owncloudpropagator.h   |  6 +++---
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index 0ba8f4b..9b5a4d4 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -619,17 +619,16 @@ void PropagateDirectory::slotSubJobFinished(SyncFileItem::Status status)
         _hasError = status;
     }
     _runningNow--;
+    _jobsFinished++;
 
-    int total = _subJobs.count();
-    if (!_firstJob) {
-        total--;
+    int totalJobs = _subJobs.count();
+    if (_firstJob) {
+        totalJobs++;
     }
 
-    _current++;
-
     // We finished to processing all the jobs
     // check if we finished
-    if (_current >= total) {
+    if (_jobsFinished >= totalJobs) {
         Q_ASSERT(!_runningNow); // how can we finished if there are still jobs running now
         finalize();
     } else {
diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h
index 564e7a5..08a8617 100644
--- a/src/libsync/owncloudpropagator.h
+++ b/src/libsync/owncloudpropagator.h
@@ -171,13 +171,13 @@ public:
 
     SyncFileItemPtr _item;
 
-    int _current; // index of the current running job
-    int _runningNow; // number of subJob running now
+    int _jobsFinished; // number of jobs that have completed
+    int _runningNow; // number of subJobs running right now
     SyncFileItem::Status _hasError;  // NoStatus,  or NormalError / SoftError if there was an error
 
     explicit PropagateDirectory(OwncloudPropagator *propagator, const SyncFileItemPtr &item = SyncFileItemPtr(new SyncFileItem))
         : PropagatorJob(propagator)
-        , _firstJob(0), _item(item),  _current(-1), _runningNow(0), _hasError(SyncFileItem::NoStatus)
+        , _firstJob(0), _item(item),  _jobsFinished(0), _runningNow(0), _hasError(SyncFileItem::NoStatus)
     { }
 
     virtual ~PropagateDirectory() {

-- 
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