push required flag into download data for later use.

meow-7.2.2
Andrew A. de Laix 2010-12-07 14:32:37 -08:00
parent 6faefa6440
commit 4d861ef022
4 changed files with 12 additions and 10 deletions

View File

@ -48,7 +48,7 @@ public:
Implementation(LLUpdateDownloader::Client & client);
~Implementation();
void cancel(void);
void download(LLURI const & uri, std::string const & hash);
void download(LLURI const & uri, std::string const & hash, bool required);
bool isDownloading(void);
size_t onHeader(void * header, size_t size);
size_t onBody(void * header, size_t size);
@ -118,9 +118,9 @@ void LLUpdateDownloader::cancel(void)
}
void LLUpdateDownloader::download(LLURI const & uri, std::string const & hash)
void LLUpdateDownloader::download(LLURI const & uri, std::string const & hash, bool required)
{
mImplementation->download(uri, hash);
mImplementation->download(uri, hash, required);
}
@ -199,12 +199,13 @@ void LLUpdateDownloader::Implementation::cancel(void)
}
void LLUpdateDownloader::Implementation::download(LLURI const & uri, std::string const & hash)
void LLUpdateDownloader::Implementation::download(LLURI const & uri, std::string const & hash, bool required)
{
if(isDownloading()) mClient.downloadError("download in progress");
mDownloadRecordPath = downloadMarkerPath();
mDownloadData = LLSD();
mDownloadData["required"] = required;
try {
startDownloading(uri, hash);
} catch(DownloadError const & e) {
@ -250,12 +251,12 @@ void LLUpdateDownloader::Implementation::resume(void)
resumeDownloading(fileStatus.st_size);
} else if(!validateDownload()) {
LLFile::remove(filePath);
download(LLURI(mDownloadData["url"].asString()), mDownloadData["hash"].asString());
download(LLURI(mDownloadData["url"].asString()), mDownloadData["hash"].asString(), mDownloadData["required"].asBoolean());
} else {
mClient.downloadComplete(mDownloadData);
}
} else {
download(LLURI(mDownloadData["url"].asString()), mDownloadData["hash"].asString());
download(LLURI(mDownloadData["url"].asString()), mDownloadData["hash"].asString(), mDownloadData["required"].asBoolean());
}
} catch(DownloadError & e) {
mClient.downloadError(e.what());

View File

@ -52,7 +52,7 @@ public:
void cancel(void);
// Start a new download.
void download(LLURI const & uri, std::string const & hash);
void download(LLURI const & uri, std::string const & hash, bool required=false);
// Returns true if a download is in progress.
bool isDownloading(void);
@ -76,6 +76,7 @@ public:
// url - source (remote) location
// hash - the md5 sum that should match the installer file.
// path - destination (local) location
// required - boolean indicating if this is a required update.
// size - the size of the installer in bytes
virtual void downloadComplete(LLSD const & data) = 0;

View File

@ -355,7 +355,7 @@ void LLUpdaterServiceImpl::optionalUpdate(std::string const & newVersion,
{
stopTimer();
mIsDownloading = true;
mUpdateDownloader.download(uri, hash);
mUpdateDownloader.download(uri, hash, false);
setState(LLUpdaterService::DOWNLOADING);
}
@ -366,7 +366,7 @@ void LLUpdaterServiceImpl::requiredUpdate(std::string const & newVersion,
{
stopTimer();
mIsDownloading = true;
mUpdateDownloader.download(uri, hash);
mUpdateDownloader.download(uri, hash, true);
setState(LLUpdaterService::DOWNLOADING);
}

View File

@ -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 &){}
void LLUpdateDownloader::download(LLURI const & , std::string const &, bool){}
class LLDir_Mock : public LLDir
{