summaryrefslogtreecommitdiff
path: root/indra/viewer_components
diff options
context:
space:
mode:
authorAndrew A. de Laix <alain@lindenlab.com>2010-11-09 11:16:28 -0800
committerAndrew A. de Laix <alain@lindenlab.com>2010-11-09 11:16:28 -0800
commit5da253fdde8737361333161517c1173358bd17ff (patch)
tree903f289060f1d947eba65f518016a9ee62110916 /indra/viewer_components
parent73b6d4d058107137425cd202e79fb0a2d9c22896 (diff)
Shut down thread if viewer closed while downloading; fix problem of download marker path failing to expand correctly because it was happening too early in start up.
Diffstat (limited to 'indra/viewer_components')
-rw-r--r--indra/viewer_components/updater/llupdatedownloader.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp
index 2794f80c47..208cc48c12 100644
--- a/indra/viewer_components/updater/llupdatedownloader.cpp
+++ b/indra/viewer_components/updater/llupdatedownloader.cpp
@@ -154,8 +154,7 @@ LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client &
LLThread("LLUpdateDownloader"),
mCancelled(false),
mClient(client),
- mCurl(0),
- mDownloadRecordPath(LLUpdateDownloader::downloadMarkerPath())
+ mCurl(0)
{
CURLcode code = curl_global_init(CURL_GLOBAL_ALL); // Just in case.
llverify(code == CURLE_OK); // TODO: real error handling here.
@@ -164,6 +163,12 @@ LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client &
LLUpdateDownloader::Implementation::~Implementation()
{
+ if(isDownloading()) {
+ cancel();
+ shutdown();
+ } else {
+ ; // No op.
+ }
if(mCurl) curl_easy_cleanup(mCurl);
}
@@ -177,7 +182,8 @@ void LLUpdateDownloader::Implementation::cancel(void)
void LLUpdateDownloader::Implementation::download(LLURI const & uri, std::string const & hash)
{
if(isDownloading()) mClient.downloadError("download in progress");
-
+
+ mDownloadRecordPath = downloadMarkerPath();
mDownloadData = LLSD();
try {
startDownloading(uri, hash);
@@ -195,6 +201,9 @@ bool LLUpdateDownloader::Implementation::isDownloading(void)
void LLUpdateDownloader::Implementation::resume(void)
{
+ if(isDownloading()) mClient.downloadError("download in progress");
+
+ mDownloadRecordPath = downloadMarkerPath();
llifstream dataStream(mDownloadRecordPath);
if(!dataStream) {
mClient.downloadError("no download marker");