New Disco algortihm: Fix TestChunkingNG::connectionDroppedBeforeEtagRecieved
authorOlivier Goffart <ogoffart@woboq.com>
Wed, 18 Jul 2018 10:40:22 +0000 (12:40 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:57:59 +0000 (10:57 +0100)
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/discovery.cpp
src/libsync/propagateupload.cpp

index d2cba8c968621cdf9acebd7b4494b694d0727d6b..20aa18000a8e109155a89d11b48515f2c80d7652 100644 (file)
@@ -669,6 +669,7 @@ void ProcessDirectoryJob::processFile(PathTuple path,
                     if (up._valid && up._contentChecksum == remoteChecksumHeader) {
                         // Solve the conflict into an upload, or nothing
                         item->_instruction = up._modtime == localEntry.modtime ? CSYNC_INSTRUCTION_UPDATE_METADATA : CSYNC_INSTRUCTION_SYNC;
+                        item->_direction = SyncFileItem::Up;
 
                         // Update the etag and other server metadata in the journal already
                         // (We can't use a typical CSYNC_INSTRUCTION_UPDATE_METADATA because
@@ -687,6 +688,7 @@ void ProcessDirectoryJob::processFile(PathTuple path,
                         }
                     } else {
                         item->_instruction = CSYNC_INSTRUCTION_CONFLICT;
+                        item->_direction = SyncFileItem::None;
                     }
                 } else {
                     // If the size or mtime is different, it's definitely a conflict.
@@ -701,9 +703,9 @@ void ProcessDirectoryJob::processFile(PathTuple path,
                     // sizes and mtimes pops up when the local database is lost for
                     // whatever reason.
                     item->_instruction = isConflict ? CSYNC_INSTRUCTION_CONFLICT : CSYNC_INSTRUCTION_UPDATE_METADATA;
+                    item->_direction = isConflict ? SyncFileItem::None : SyncFileItem::Down;
                 }
             }
-            item->_direction = item->_instruction == CSYNC_INSTRUCTION_CONFLICT ? SyncFileItem::None : SyncFileItem::Down;
             if (dbEntry._type == ItemTypeVirtualFile)
                 item->_type = ItemTypeVirtualFileDownload;
             if (item->_file.endsWith(_discoveryData->_syncOptions._virtualFileSuffix)) {
index 60bcef43c9a067c2e601b1941583819d6e20ff59..dfe19dac578f6e6e606a91d5e9428ac092334d26 100644 (file)
@@ -418,6 +418,7 @@ void PropagateUploadFileCommon::slotStartUpload(const QByteArray &transmissionCh
     }
 
     quint64 fileSize = FileSystem::getSize(fullFilePath);
+    _item->_size = fileSize;
     _fileToUpload._size = fileSize;
 
     // But skip the file if the mtime is too close to 'now'!