summaryrefslogtreecommitdiff
path: root/indra/viewer_components/updater
diff options
context:
space:
mode:
authorAndrew A. de Laix <alain@lindenlab.com>2010-12-14 09:54:28 -0800
committerAndrew A. de Laix <alain@lindenlab.com>2010-12-14 09:54:28 -0800
commit5b5d2c428c90b5172d53e1fbc3eb6e27daffddcb (patch)
tree95656b2aed2d90aa620e59566c11af60f86123f5 /indra/viewer_components/updater
parent5b7a3d3a36b4bd01da80a0093bbc3e533f116f71 (diff)
Record update version in download marker so it can be recalled if resumed in another viewer session.
Diffstat (limited to 'indra/viewer_components/updater')
-rw-r--r--indra/viewer_components/updater/llupdatedownloader.cpp28
-rw-r--r--indra/viewer_components/updater/llupdatedownloader.h5
-rw-r--r--indra/viewer_components/updater/llupdaterservice.cpp5
-rw-r--r--indra/viewer_components/updater/tests/llupdaterservice_test.cpp2
4 files changed, 30 insertions, 10 deletions
diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp
index 2dd0084fdc..f259e06476 100644
--- a/indra/viewer_components/updater/llupdatedownloader.cpp
+++ b/indra/viewer_components/updater/llupdatedownloader.cpp
@@ -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());
diff --git a/indra/viewer_components/updater/llupdatedownloader.h b/indra/viewer_components/updater/llupdatedownloader.h
index 4e20b307b8..0d635640cf 100644
--- a/indra/viewer_components/updater/llupdatedownloader.h
+++ b/indra/viewer_components/updater/llupdatedownloader.h
@@ -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);
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index 78f768facf..df1a963f81 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -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);
}
diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
index fbdf9a4993..be5a5da50d 100644
--- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
+++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
@@ -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
{