Record update version in download marker so it can be recalled if resumed in another viewer session.
parent
5b7a3d3a36
commit
5b5d2c428c
|
|
@ -48,7 +48,10 @@ public:
|
|||
Implementation(LLUpdateDownloader::Client & client);
|
||||
~Implementation();
|
||||
void cancel(void);
|
||||
void download(LLURI const & uri, std::string const & hash, bool required);
|
||||
void download(LLURI const & uri,
|
||||
std::string const & hash,
|
||||
std::string const & updateVersion,
|
||||
bool required);
|
||||
bool isDownloading(void);
|
||||
size_t onHeader(void * header, size_t size);
|
||||
size_t onBody(void * header, size_t size);
|
||||
|
|
@ -120,9 +123,12 @@ void LLUpdateDownloader::cancel(void)
|
|||
}
|
||||
|
||||
|
||||
void LLUpdateDownloader::download(LLURI const & uri, std::string const & hash, bool required)
|
||||
void LLUpdateDownloader::download(LLURI const & uri,
|
||||
std::string const & hash,
|
||||
std::string const & updateVersion,
|
||||
bool required)
|
||||
{
|
||||
mImplementation->download(uri, hash, required);
|
||||
mImplementation->download(uri, hash, updateVersion, required);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -208,13 +214,17 @@ void LLUpdateDownloader::Implementation::cancel(void)
|
|||
}
|
||||
|
||||
|
||||
void LLUpdateDownloader::Implementation::download(LLURI const & uri, std::string const & hash, bool required)
|
||||
void LLUpdateDownloader::Implementation::download(LLURI const & uri,
|
||||
std::string const & hash,
|
||||
std::string const & updateVersion,
|
||||
bool required)
|
||||
{
|
||||
if(isDownloading()) mClient.downloadError("download in progress");
|
||||
|
||||
mDownloadRecordPath = downloadMarkerPath();
|
||||
mDownloadData = LLSD();
|
||||
mDownloadData["required"] = required;
|
||||
mDownloadData["update_version"] = updateVersion;
|
||||
try {
|
||||
startDownloading(uri, hash);
|
||||
} catch(DownloadError const & e) {
|
||||
|
|
@ -260,12 +270,18 @@ void LLUpdateDownloader::Implementation::resume(void)
|
|||
resumeDownloading(fileStatus.st_size);
|
||||
} else if(!validateDownload()) {
|
||||
LLFile::remove(filePath);
|
||||
download(LLURI(mDownloadData["url"].asString()), mDownloadData["hash"].asString(), mDownloadData["required"].asBoolean());
|
||||
download(LLURI(mDownloadData["url"].asString()),
|
||||
mDownloadData["hash"].asString(),
|
||||
mDownloadData["update_version"].asString(),
|
||||
mDownloadData["required"].asBoolean());
|
||||
} else {
|
||||
mClient.downloadComplete(mDownloadData);
|
||||
}
|
||||
} else {
|
||||
download(LLURI(mDownloadData["url"].asString()), mDownloadData["hash"].asString(), mDownloadData["required"].asBoolean());
|
||||
download(LLURI(mDownloadData["url"].asString()),
|
||||
mDownloadData["hash"].asString(),
|
||||
mDownloadData["update_version"].asString(),
|
||||
mDownloadData["required"].asBoolean());
|
||||
}
|
||||
} catch(DownloadError & e) {
|
||||
mClient.downloadError(e.what());
|
||||
|
|
|
|||
|
|
@ -52,7 +52,10 @@ public:
|
|||
void cancel(void);
|
||||
|
||||
// Start a new download.
|
||||
void download(LLURI const & uri, std::string const & hash, bool required=false);
|
||||
void download(LLURI const & uri,
|
||||
std::string const & hash,
|
||||
std::string const & updateVersion,
|
||||
bool required=false);
|
||||
|
||||
// Returns true if a download is in progress.
|
||||
bool isDownloading(void);
|
||||
|
|
|
|||
|
|
@ -339,6 +339,7 @@ bool LLUpdaterServiceImpl::checkForResume()
|
|||
if(download_info["current_version"].asString() == ll_get_version())
|
||||
{
|
||||
mIsDownloading = true;
|
||||
mNewVersion = download_info["update_version"].asString();
|
||||
mUpdateDownloader.resume();
|
||||
result = true;
|
||||
}
|
||||
|
|
@ -370,7 +371,7 @@ void LLUpdaterServiceImpl::optionalUpdate(std::string const & newVersion,
|
|||
stopTimer();
|
||||
mNewVersion = newVersion;
|
||||
mIsDownloading = true;
|
||||
mUpdateDownloader.download(uri, hash, false);
|
||||
mUpdateDownloader.download(uri, hash, newVersion, false);
|
||||
|
||||
setState(LLUpdaterService::DOWNLOADING);
|
||||
}
|
||||
|
|
@ -382,7 +383,7 @@ void LLUpdaterServiceImpl::requiredUpdate(std::string const & newVersion,
|
|||
stopTimer();
|
||||
mNewVersion = newVersion;
|
||||
mIsDownloading = true;
|
||||
mUpdateDownloader.download(uri, hash, true);
|
||||
mUpdateDownloader.download(uri, hash, newVersion, true);
|
||||
|
||||
setState(LLUpdaterService::DOWNLOADING);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void LLUpdateChecker::check(std::string const & protocolVersion, std::string con
|
|||
std::string const & servicePath, std::string channel, std::string version)
|
||||
{}
|
||||
LLUpdateDownloader::LLUpdateDownloader(Client & ) {}
|
||||
void LLUpdateDownloader::download(LLURI const & , std::string const &, bool){}
|
||||
void LLUpdateDownloader::download(LLURI const & , std::string const &, std::string const &, bool){}
|
||||
|
||||
class LLDir_Mock : public LLDir
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue