Skip to content

Commit

Permalink
Replace comments about relevancy of chunk to propagat v1 with variabl…
Browse files Browse the repository at this point in the history
…e name change

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra authored and mgallien committed Aug 31, 2023
1 parent f46d71f commit a0c528a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
13 changes: 4 additions & 9 deletions src/common/syncjournaldb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,7 @@ SyncJournalDb::UploadInfo SyncJournalDb::getUploadInfo(const QString &file)

if (query->next().hasData) {
bool ok = true;
res._chunk = query->intValue(0);
res._chunkUploadV1 = query->intValue(0);
res._transferid = query->int64Value(1);
res._errorCount = query->intValue(2);
res._size = query->int64Value(3);
Expand Down Expand Up @@ -1678,7 +1678,7 @@ void SyncJournalDb::setUploadInfo(const QString &file, const SyncJournalDb::Uplo
}

query->bindValue(1, file);
query->bindValue(2, i._chunk);
query->bindValue(2, i._chunkUploadV1);
query->bindValue(3, i._transferid);
query->bindValue(4, i._errorCount);
query->bindValue(5, i._size);
Expand Down Expand Up @@ -2714,13 +2714,8 @@ bool operator==(const SyncJournalDb::DownloadInfo &lhs,
bool operator==(const SyncJournalDb::UploadInfo &lhs,
const SyncJournalDb::UploadInfo &rhs)
{
return lhs._errorCount == rhs._errorCount
&& lhs._chunk == rhs._chunk
&& lhs._modtime == rhs._modtime
&& lhs._valid == rhs._valid
&& lhs._size == rhs._size
&& lhs._transferid == rhs._transferid
&& lhs._contentChecksum == rhs._contentChecksum;
return lhs._errorCount == rhs._errorCount && lhs._chunkUploadV1 == rhs._chunkUploadV1 && lhs._modtime == rhs._modtime && lhs._valid == rhs._valid
&& lhs._size == rhs._size && lhs._transferid == rhs._transferid && lhs._contentChecksum == rhs._contentChecksum;
}

QDebug& operator<<(QDebug &stream, const SyncJournalFileRecord::EncryptionStatus status)
Expand Down
2 changes: 1 addition & 1 deletion src/common/syncjournaldb.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class OCSYNC_EXPORT SyncJournalDb : public QObject
};
struct UploadInfo
{
int _chunk = 0; // Relevant to PropagateUploadV1 only
int _chunkUploadV1 = 0;
uint _transferid = 0;
qint64 _size = 0;
qint64 _modtime = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/bulkpropagatorjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void BulkPropagatorJob::doStartUpload(SyncFileItemPtr item,
// in reconcile (issue #5106)
SyncJournalDb::UploadInfo pi;
pi._valid = true;
pi._chunk = 0; // Relevant to PropagateUploadV1 only
pi._chunkUploadV1 = 0;
pi._transferid = 0; // We set a null transfer id because it is not chunked.
pi._modtime = item->_modtime;
pi._errorCount = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/libsync/propagateuploadv1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void PropagateUploadFileV1::doStartUpload()
}
if (progressInfo._valid && progressInfo.isChunked() && progressInfo._modtime == _item->_modtime && progressInfo._size == _item->_size
&& (progressInfo._contentChecksum == _item->_checksumHeader || progressInfo._contentChecksum.isEmpty() || _item->_checksumHeader.isEmpty())) {
_startChunk = progressInfo._chunk;
_startChunk = progressInfo._chunkUploadV1;
_transferId = progressInfo._transferid;
qCInfo(lcPropagateUploadV1) << _item->_file << ": Resuming from chunk " << _startChunk;
} else if (_chunkCount <= 1 && !_item->_checksumHeader.isEmpty()) {
Expand All @@ -62,7 +62,7 @@ void PropagateUploadFileV1::doStartUpload()
// in reconcile (issue #5106)
SyncJournalDb::UploadInfo pi;
pi._valid = true;
pi._chunk = 0;
pi._chunkUploadV1 = 0;
pi._transferid = 0; // We set a null transfer id because it is not chunked.
Q_ASSERT(_item->_modtime > 0);
if (_item->_modtime <= 0) {
Expand Down Expand Up @@ -297,7 +297,7 @@ void PropagateUploadFileV1::slotPutFinished()
currentChunk = qMin(currentChunk, putJob->_chunk - 1);
}
}
pi._chunk = (currentChunk + _startChunk + 1) % _chunkCount; // next chunk to start with
pi._chunkUploadV1 = (currentChunk + _startChunk + 1) % _chunkCount; // next chunk to start with
pi._transferid = _transferId;
Q_ASSERT(_item->_modtime > 0);
if (_item->_modtime <= 0) {
Expand Down
2 changes: 1 addition & 1 deletion test/testsyncjournaldb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private slots:
QVERIFY(!record._valid);

record._errorCount = 5;
record._chunk = 12;
record._chunkUploadV1 = 12;
record._transferid = 812974891;
record._size = 12894789147;
record._modtime = dropMsecs(QDateTime::currentDateTime());
Expand Down

0 comments on commit a0c528a

Please sign in to comment.