[Pkg-owncloud-commits] [owncloud-client] 04/211: blacklist: Fix stale blacklist removal. #2247

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:20 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 9bd7ffe9527a8ee07459a91ab5a3fe64d01feabb
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Wed Oct 8 09:07:05 2014 +0200

    blacklist: Fix stale blacklist removal. #2247
    
    Use the right check to determine whether a file has a blacklist entry,
    SyncFileItem::FileIgnored was incorrect because that denotes files from
    the ignore list or blacklisted files with no retries left.
    
    The blacklistedInDb flag does the right thing. Rename it to
    hasBlacklistEntry to be more explicit.
---
 src/mirall/owncloudpropagator.cpp | 2 +-
 src/mirall/syncengine.cpp         | 8 ++++----
 src/mirall/syncfileitem.h         | 8 ++++++--
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp
index 03a5031..2d4e012 100644
--- a/src/mirall/owncloudpropagator.cpp
+++ b/src/mirall/owncloudpropagator.cpp
@@ -98,7 +98,7 @@ void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorStr
         break;
     case SyncFileItem::Success:
     case SyncFileItem::Restoration:
-        if( _item._blacklistedInDb ) {
+        if( _item._hasBlacklistEntry ) {
             // wipe blacklist entry.
             _propagator->_journal->wipeBlacklistEntry(_item._file);
             // remove a blacklist entry in case the file was moved.
diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index f2af8c0..15e354f 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -196,12 +196,12 @@ bool SyncEngine::checkBlacklisting( SyncFileItem *item )
     }
 
     SyncJournalBlacklistRecord entry = _journal->blacklistEntry(item->_file);
-    item->_blacklistedInDb = false;
+    item->_hasBlacklistEntry = false;
 
     // if there is a valid entry in the blacklist table and the retry count is
     // already null or smaller than 0, the file is blacklisted.
     if( entry.isValid() ) {
-        item->_blacklistedInDb = true;
+        item->_hasBlacklistEntry = true;
 
         if( entry._retryCount <= 0 ) {
             re = true;
@@ -288,7 +288,7 @@ void SyncEngine::deleteStaleBlacklistEntries()
     // Find all blacklisted paths that we want to preserve.
     QSet<QString> blacklist_file_paths;
     foreach(const SyncFileItem& it, _syncedItems) {
-        if (it._status == SyncFileItem::FileIgnored)
+        if (it._hasBlacklistEntry)
             blacklist_file_paths.insert(it._file);
     }
 
@@ -706,7 +706,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
 
     deleteStaleDownloadInfos();
     deleteStaleUploadInfos();
-    // deleteStaleBlacklistEntries();
+    deleteStaleBlacklistEntries();
     _journal->commit("post stale entry removal");
 
     _propagator->start(_syncedItems);
diff --git a/src/mirall/syncfileitem.h b/src/mirall/syncfileitem.h
index 4ce515f..c216688 100644
--- a/src/mirall/syncfileitem.h
+++ b/src/mirall/syncfileitem.h
@@ -46,7 +46,7 @@ public:
 
         Success, ///< The file was properly synced
         Conflict, ///< The file was properly synced, but a conflict was created
-        FileIgnored, ///< The file is in the ignored list
+        FileIgnored, ///< The file is in the ignored list (or blacklisted with no retries left)
         Restoration ///< The file was restored because what should have been done was not allowed
     };
 
@@ -91,7 +91,11 @@ public:
     QByteArray           _remotePerm;
     QString              _directDownloadUrl;
     QString              _directDownloadCookies;
-    bool                 _blacklistedInDb;
+
+    /// Whether there's an entry in the blacklist table.
+    /// Note: that entry may have retries left, so this can be true
+    /// without the status being FileIgnored.
+    bool                 _hasBlacklistEntry;
 
     // Variables usefull to report to the user
     Status               _status;

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