diff options
author | kh1 <karsten.heimrich@digia.com> | 2014-04-03 13:17:59 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2014-04-24 20:08:13 +0200 |
commit | 580c95ecb77e075dfa91f2e9bb390d5795fae27b (patch) | |
tree | 5934809f1f2c4f87b82d29f346548841c9f56e94 /src/libs/installer/downloadarchivesjob.cpp | |
parent | c9d5b84a9487b6a2a944d224ceab3ddf0c5814d8 (diff) |
Fix and update how the sha files and packages are downloaded.
Fixes a possible messed up download chain once the archive download
failed. We need in turn call fetchNextArchiveHash as we will remove
both the hash and the package, though this does not reset the last
checksum and therefore the next proper archive download will compare
to the wrong SHA.
Change-Id: Ib4e569de4f5482123da7357a09b7bd087b5d6cbb
Reviewed-by: Niels Weber <niels.weber@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/libs/installer/downloadarchivesjob.cpp')
-rw-r--r-- | src/libs/installer/downloadarchivesjob.cpp | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/src/libs/installer/downloadarchivesjob.cpp b/src/libs/installer/downloadarchivesjob.cpp index 7e1196bcf..332c62f2a 100644 --- a/src/libs/installer/downloadarchivesjob.cpp +++ b/src/libs/installer/downloadarchivesjob.cpp @@ -145,14 +145,13 @@ void DownloadArchivesJob::finishedHashDownload() { Q_ASSERT(m_downloader != 0); - const QString tempFile = m_downloader->downloadedFileName(); - QFile sha1HashFile(tempFile); - if (sha1HashFile.open(QFile::ReadOnly)) + QFile sha1HashFile(m_downloader->downloadedFileName()); + if (sha1HashFile.open(QFile::ReadOnly)) { m_currentHash = sha1HashFile.readAll(); - else + fetchNextArchive(); + } else { finishWithError(tr("Downloading hash signature failed.")); - - fetchNextArchive(); + } } /*! @@ -176,7 +175,7 @@ void DownloadArchivesJob::fetchNextArchive() m_downloader = setupDownloader(QString(), m_core->value(QLatin1String("UrlQueryString"))); if (!m_downloader) { m_archivesToDownload.removeFirst(); - QMetaObject::invokeMethod(this, "fetchNextArchive", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "fetchNextArchiveHash", Qt::QueuedConnection); return; } @@ -232,22 +231,18 @@ void DownloadArchivesJob::registerFile() finishWithError(tr("Could not verify Hash")); return; } + } else { + ++m_archivesDownloaded; + if (m_progressChangedTimerId) { + killTimer(m_progressChangedTimerId); + m_progressChangedTimerId = 0; + emit progressChanged(double(m_archivesDownloaded) / m_archivesToDownloadCount); + } - fetchNextArchiveHash(); - return; - } - - ++m_archivesDownloaded; - if (m_progressChangedTimerId) { - killTimer(m_progressChangedTimerId); - m_progressChangedTimerId = 0; - emit progressChanged(double(m_archivesDownloaded) / m_archivesToDownloadCount); + const QPair<QString, QString> pair = m_archivesToDownload.takeFirst(); + QInstallerCreator::BinaryFormatEngineHandler::instance()->registerArchive(pair.first, + m_downloader->downloadedFileName()); } - - const QPair<QString, QString> pair = m_archivesToDownload.takeFirst(); - QInstallerCreator::BinaryFormatEngineHandler::instance()->registerArchive(pair.first, - m_downloader->downloadedFileName()); - fetchNextArchiveHash(); } |