Move the e2e information fetch even earlier
authorKevin Ottens <kevin.ottens@nextcloud.com>
Thu, 2 Jul 2020 14:22:48 +0000 (16:22 +0200)
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>
Mon, 6 Jul 2020 05:27:14 +0000 (05:27 +0000)
We used to do it when the propagation starts, let's do it even before
the discovery starts. This way we'll have a chance to exploit the
information during the discovery phase.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/owncloudpropagator.cpp
src/libsync/owncloudpropagator.h
src/libsync/syncengine.cpp
src/libsync/syncengine.h

index 6ba0086e28729a740ee4d998eaf0fc63ea5a2d82..7a1274bd73e5dccb01c09930071a81dfaa7ec35c 100644 (file)
@@ -510,15 +510,7 @@ void OwncloudPropagator::start(const SyncFileItemVector &items,
 
     connect(_rootJob.data(), &PropagatorJob::finished, this, &OwncloudPropagator::emitFinished);
 
-    // If needed, make sure we have up to date E2E information before scheduling the first job
-    // otherwise we start right away
-    if (_account->capabilities().clientSideEncryptionAvailable()) {
-        connect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone,
-                this, &OwncloudPropagator::onFolderEncryptedStatusFetchDone);
-        _account->e2e()->fetchFolderEncryptedStatus();
-    } else {
-        scheduleNextJob();
-    }
+    scheduleNextJob();
 }
 
 const SyncOptions &OwncloudPropagator::syncOptions() const
@@ -616,13 +608,6 @@ QString OwncloudPropagator::getFilePath(const QString &tmp_file_name) const
     return _localDir + tmp_file_name;
 }
 
-void OwncloudPropagator::onFolderEncryptedStatusFetchDone()
-{
-    disconnect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone,
-               this, &OwncloudPropagator::onFolderEncryptedStatusFetchDone);
-    scheduleNextJob();
-}
-
 void OwncloudPropagator::scheduleNextJob()
 {
     QTimer::singleShot(0, this, &OwncloudPropagator::scheduleNextJobImpl);
index d0cd59e5351c95b43a1f41c0927d6dda702b3ed5..af944e8e9455730e650de833c86fb2988c7f8fe2 100644 (file)
@@ -527,8 +527,6 @@ private slots:
         _finishedEmited = true;
     }
 
-    void onFolderEncryptedStatusFetchDone();
-
     void scheduleNextJobImpl();
 
 signals:
index 19d90479bc13827a6bdd7f32d400d22340da4a1c..1875100ef467bf14c80c55ffc5e88dc4c4a4dc56 100644 (file)
@@ -858,6 +858,21 @@ void SyncEngine::startSync()
         return shouldDiscoverLocally(path);
     };
 
+    // If needed, make sure we have up to date E2E information before the
+    // discovery phase, otherwise we start right away
+    if (_account->capabilities().clientSideEncryptionAvailable()) {
+        connect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone,
+                this, &SyncEngine::onFolderEncryptedStatusFetchDone);
+        _account->e2e()->fetchFolderEncryptedStatus();
+    } else {
+        slotStartDiscovery();
+    }
+}
+
+void SyncEngine::onFolderEncryptedStatusFetchDone()
+{
+    disconnect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone,
+               this, &SyncEngine::onFolderEncryptedStatusFetchDone);
     slotStartDiscovery();
 }
 
index b3adbba2ff5b567fa0e71bc6662389de718a14bb..7f21eee3e948e7565c0d745ef3d5ebdbc5d5264c 100644 (file)
@@ -168,6 +168,7 @@ signals:
     void seenLockedFile(const QString &fileName);
 
 private slots:
+    void onFolderEncryptedStatusFetchDone();
     void slotStartDiscovery();
 
     void slotFolderDiscovered(bool local, const QString &folder);