diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-03-23 12:00:13 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-03-23 12:00:13 +0900 |
commit | f31cf101872420a14995f2b24d21377a65adc9dd (patch) | |
tree | 791b19204860f5a94a708f6517d9e89db2f11fa6 | |
parent | bac178f488299ec37ebe86aa91053cf1133d1c12 (diff) | |
download | libquotient-f31cf101872420a14995f2b24d21377a65adc9dd.tar.gz libquotient-f31cf101872420a14995f2b24d21377a65adc9dd.zip |
Room::downloadFile(): don't start another job if the transfer is ongoing
-rw-r--r-- | room.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1094,6 +1094,15 @@ void Room::uploadFile(const QString& id, const QUrl& localFilename, void Room::downloadFile(const QString& eventId, const QUrl& localFilename) { + auto ongoingTransfer = d->fileTransfers.find(eventId); + if (ongoingTransfer != d->fileTransfers.end() && + ongoingTransfer->status == FileTransferInfo::Started) + { + qCWarning(MAIN) << "Download for" << eventId + << "already started; to restart, cancel it first"; + return; + } + Q_ASSERT_X(localFilename.isEmpty() || localFilename.isLocalFile(), __FUNCTION__, "localFilename should point at a local file"); auto* event = d->getEventWithFile(eventId); |