Fix deadlock when using putmultifilejob with rate limits enabled

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-05-15 19:30:27 +08:00
parent f28a1a368e
commit a547f55f2f

View file

@ -44,6 +44,13 @@ void PutMultiFileJob::start()
QNetworkRequest req;
for(const auto &oneDevice : _devices) {
// Our rate limits in UploadDevice::readData will cause an application freeze if used here.
// QHttpMultiPart's internal QHttpMultiPartIODevice::readData will loop over and over trying
// to read data from our UploadDevice while there is data left to be read; this will cause
// a deadlock as we will never have a chance to progress the data read
oneDevice._device->setChoked(false);
oneDevice._device->setBandwidthLimited(false);
auto onePart = QHttpPart{};
onePart.setBodyDevice(oneDevice._device.get());