From 370923791d40eab80ca2db8c316bdd56b5e9969f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 18 Jul 2018 12:40:22 +0200 Subject: [PATCH] New Disco algortihm: Fix TestChunkingNG::connectionDroppedBeforeEtagRecieved Signed-off-by: Kevin Ottens --- src/libsync/discovery.cpp | 4 +++- src/libsync/propagateupload.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index d2cba8c96..20aa18000 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -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)) { diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index 60bcef43c..dfe19dac5 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -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'!