mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 05:25:50 +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;
|
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)
|
void PropagateUploadFileCommon::setDeleteExisting(bool enabled)
|
||||||
{
|
{
|
||||||
_deleteExisting = enabled;
|
_deleteExisting = enabled;
|
||||||
|
|
|
@ -226,16 +226,12 @@ protected:
|
||||||
};
|
};
|
||||||
UploadFileInfo _fileToUpload;
|
UploadFileInfo _fileToUpload;
|
||||||
QByteArray _transmissionChecksumHeader;
|
QByteArray _transmissionChecksumHeader;
|
||||||
|
JobParallelism _parallelism;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PropagateUploadFileCommon(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
|
PropagateUploadFileCommon(OwncloudPropagator *propagator, const SyncFileItemPtr &item);
|
||||||
: PropagateItemJob(propagator, item)
|
|
||||||
, _finished(false)
|
JobParallelism parallelism() override;
|
||||||
, _deleteExisting(false)
|
|
||||||
, _uploadEncryptedHelper(nullptr)
|
|
||||||
, _uploadingEncrypted(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether an existing entity with the same name may be deleted before
|
* Whether an existing entity with the same name may be deleted before
|
||||||
|
|
Loading…
Reference in a new issue