mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Merge pull request #2144 from nextcloud/fix_e2ee_upload_lock_starvation
Fix e2ee upload lock starvation
This commit is contained in:
commit
be4ba031ec
2 changed files with 46 additions and 8 deletions
|
@ -164,6 +164,48 @@ bool PollJob::finished()
|
|||
return true;
|
||||
}
|
||||
|
||||
PropagateUploadFileCommon::PropagateUploadFileCommon(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
|
||||
: PropagateItemJob(propagator, item)
|
||||
, _finished(false)
|
||||
, _deleteExisting(false)
|
||||
, _parallelism(FullParallelism)
|
||||
, _uploadEncryptedHelper(nullptr)
|
||||
, _uploadingEncrypted(false)
|
||||
{
|
||||
const auto rootPath = [=]() {
|
||||
const auto result = propagator->_remoteFolder;
|
||||
if (result.startsWith('/')) {
|
||||
return result.mid(1);
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}();
|
||||
const auto path = _item->_file;
|
||||
const auto slashPosition = path.lastIndexOf('/');
|
||||
const auto parentPath = slashPosition >= 0 ? path.left(slashPosition) : QString();
|
||||
|
||||
SyncJournalFileRecord parentRec;
|
||||
bool ok = propagator->_journal->getFileRecord(parentPath, &parentRec);
|
||||
if (!ok) {
|
||||
done(SyncFileItem::NormalError);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto remoteParentPath = parentRec._e2eMangledName.isEmpty() ? parentPath : parentRec._e2eMangledName;
|
||||
const auto absoluteRemoteParentPath = remoteParentPath.isEmpty() ? rootPath : rootPath + remoteParentPath + '/';
|
||||
const auto account = propagator->account();
|
||||
|
||||
if (account->capabilities().clientSideEncryptionAvailable() &&
|
||||
account->e2e()->isFolderEncrypted(absoluteRemoteParentPath)) {
|
||||
_parallelism = WaitForFinished;
|
||||
}
|
||||
}
|
||||
|
||||
PropagatorJob::JobParallelism PropagateUploadFileCommon::parallelism()
|
||||
{
|
||||
return _parallelism;
|
||||
}
|
||||
|
||||
void PropagateUploadFileCommon::setDeleteExisting(bool enabled)
|
||||
{
|
||||
_deleteExisting = enabled;
|
||||
|
|
|
@ -226,16 +226,12 @@ protected:
|
|||
};
|
||||
UploadFileInfo _fileToUpload;
|
||||
QByteArray _transmissionChecksumHeader;
|
||||
JobParallelism _parallelism;
|
||||
|
||||
public:
|
||||
PropagateUploadFileCommon(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
|
||||
: PropagateItemJob(propagator, item)
|
||||
, _finished(false)
|
||||
, _deleteExisting(false)
|
||||
, _uploadEncryptedHelper(nullptr)
|
||||
, _uploadingEncrypted(false)
|
||||
{
|
||||
}
|
||||
PropagateUploadFileCommon(OwncloudPropagator *propagator, const SyncFileItemPtr &item);
|
||||
|
||||
JobParallelism parallelism() override;
|
||||
|
||||
/**
|
||||
* Whether an existing entity with the same name may be deleted before
|
||||
|
|
Loading…
Reference in a new issue