Fix warning about serverJob not being used
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 7 Oct 2019 08:49:23 +0000 (10:49 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:00 +0000 (10:59 +0100)
And fix a FIXME in the same time

src/libsync/discovery.cpp

index 275a7703617af808566d186e327025a3f16ef213..d2d562d5a1d29f1f46c994d11d54b72c8705943f 100644 (file)
@@ -36,9 +36,8 @@ void ProcessDirectoryJob::start()
 {
     qCInfo(lcDisco) << "STARTING" << _currentFolder._server << _queryServer << _currentFolder._local << _queryLocal;
 
-    DiscoverySingleDirectoryJob *serverJob = nullptr;
     if (_queryServer == NormalQuery) {
-        serverJob = startAsyncServerQuery();
+        _serverJob = startAsyncServerQuery();
     } else {
         _serverQueryDone = true;
     }
@@ -57,8 +56,6 @@ void ProcessDirectoryJob::start()
         _localQueryDone = true;
     }
 
-    // FIXME: serverJob->abort() if local failed..? This used to be in code before
-
     if (_localQueryDone && _serverQueryDone) {
         process();
     }
@@ -1448,6 +1445,8 @@ void ProcessDirectoryJob::startAsyncLocalQuery()
     connect(localJob, &DiscoverySingleLocalDirectoryJob::finishedFatalError, this, [this](const QString &msg) {
         _discoveryData->_currentlyActiveJobs--;
         _pendingAsyncJobs--;
+        if (_serverJob)
+            _serverJob->abort();
 
         emit _discoveryData->fatalError(msg);
     });