[Pkg-owncloud-commits] [owncloud-client] 36/121: SocketAPI: Push new status of dirty files regardless when not synced (#4970)

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Jul 28 15:31:55 UTC 2016


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 3342ebfcc59e996232ccda1eebb3c965f03727b1
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Thu Jun 16 15:27:10 2016 +0200

    SocketAPI: Push new status of dirty files regardless when not synced (#4970)
    
    The FolderWatcher inserts files to be marked as SYNC and we
    currently assume that all file statuses will be updated by the
    following sync. It's however possible that the FolderWatcher
    notify us of a change that csync won't consider necessary to
    propagate, in which case a new status wouldn't be pushed and
    the file manager would continue showing this file as syncing.
    
    Re-push the file status when emptying the dirty files list
    before propagating to avoid this issue, most likely the OK
    status.
---
 src/libsync/syncfilestatustracker.cpp | 17 +++++++++--------
 src/libsync/syncfilestatustracker.h   |  1 -
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/libsync/syncfilestatustracker.cpp b/src/libsync/syncfilestatustracker.cpp
index d63b79d..19224a3 100644
--- a/src/libsync/syncfilestatustracker.cpp
+++ b/src/libsync/syncfilestatustracker.cpp
@@ -76,7 +76,6 @@ SyncFileStatusTracker::SyncFileStatusTracker(SyncEngine *syncEngine)
             SLOT(slotAboutToPropagate(SyncFileItemVector&)));
     connect(syncEngine, SIGNAL(itemCompleted(const SyncFileItem&, const PropagatorJob&)),
             SLOT(slotItemCompleted(const SyncFileItem&)));
-    connect(syncEngine, SIGNAL(started()), SLOT(slotClearDirtyPaths()));
     connect(syncEngine, SIGNAL(started()), SLOT(slotSyncEngineRunningChanged()));
     connect(syncEngine, SIGNAL(finished(bool)), SLOT(slotSyncEngineRunningChanged()));
 }
@@ -156,9 +155,18 @@ void SyncFileStatusTracker::slotAboutToPropagate(SyncFileItemVector& items)
         } else if (showWarningInSocketApi(*item)) {
             _syncProblems[item->_file] = SyncFileStatus::StatusWarning;
         }
+        _dirtyPaths.remove(item->destination());
         emit fileStatusChanged(getSystemDestination(item->destination()), syncFileItemStatus(*item));
     }
 
+    // Some metadata status won't trigger files to be synced, make sure that we
+    // push the OK status for dirty files that don't need to be propagated.
+    // Swap into a copy since fileStatus() reads _dirtyPaths to determine the status
+    QSet<QString> oldDirtyPaths;
+    std::swap(_dirtyPaths, oldDirtyPaths);
+    for (auto it = oldDirtyPaths.cbegin(); it != oldDirtyPaths.cend(); ++it)
+        emit fileStatusChanged(getSystemDestination(*it), fileStatus(*it));
+
     // Make sure to push any status that might have been resolved indirectly since the last sync
     // (like an error file being deleted from disk)
     for (auto it = _syncProblems.begin(); it != _syncProblems.end(); ++it)
@@ -193,13 +201,6 @@ void SyncFileStatusTracker::slotSyncEngineRunningChanged()
     emit fileStatusChanged(_syncEngine->localPath(), syncFileItemStatus(rootSyncFileItem()));
 }
 
-void SyncFileStatusTracker::slotClearDirtyPaths()
-{
-    // We just assume that during a sync all dirty statuses will be resolved
-    // one way or the other.
-    _dirtyPaths.clear();
-}
-
 SyncFileStatus SyncFileStatusTracker::syncFileItemStatus(const SyncFileItem& item)
 {
     // Hack to know if the item was taken from the sync engine (Sync), or from the database (UpToDate)
diff --git a/src/libsync/syncfilestatustracker.h b/src/libsync/syncfilestatustracker.h
index d141b4b..e064f5f 100644
--- a/src/libsync/syncfilestatustracker.h
+++ b/src/libsync/syncfilestatustracker.h
@@ -47,7 +47,6 @@ private slots:
     void slotAboutToPropagate(SyncFileItemVector& items);
     void slotItemCompleted(const SyncFileItem& item);
     void slotSyncEngineRunningChanged();
-    void slotClearDirtyPaths();
 
 private:
     SyncFileStatus syncFileItemStatus(const SyncFileItem& item);

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