Propagator: properly send the success flag (#5189)

In case of the root directory, it may happen that the _item
is empty and the _item->_status is NoStatus.  But we still need to report
the proper success or error of the whole propagation. We should really
use _hasError for that. However, _hasError is also defined to NoStatus
if there was no error, so in that case we need to set Success.

This fixes the problem in which the data-fingerprint is not saved on the
database because the SyncEngine think that the sync failed. (Issue #5185)
This commit is contained in:
Olivier Goffart 2016-09-21 16:35:42 +02:00 committed by GitHub
parent ff701bd473
commit 98bfa8d5de

View file

@ -686,14 +686,14 @@ void PropagateDirectory::finalize()
SyncJournalFileRecord record(*_item, _propagator->_localDir + _item->_file);
ok = _propagator->_journal->setFileRecordMetadata(record);
if (!ok) {
_item->_status = SyncFileItem::FatalError;
_hasError = _item->_status = SyncFileItem::FatalError;
_item->_errorString = tr("Error writing metadata to the database");
qWarning() << "Error writing to the database for file" << _item->_file;
}
}
}
_state = Finished;
emit finished(_item->_status);
emit finished(_hasError == SyncFileItem::NoStatus ? SyncFileItem::Success : _hasError);
}
qint64 PropagateDirectory::committedDiskSpace() const