Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
94942671
Commit
94942671
authored
14 years ago
by
Andrew A. de Laix
Browse files
Options
Downloads
Patches
Plain Diff
fix resume crash.
parent
dcf4ddac
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/viewer_components/updater/llupdatedownloader.cpp
+14
-6
14 additions, 6 deletions
indra/viewer_components/updater/llupdatedownloader.cpp
with
14 additions
and
6 deletions
indra/viewer_components/updater/llupdatedownloader.cpp
+
14
−
6
View file @
94942671
...
@@ -57,6 +57,7 @@ class LLUpdateDownloader::Implementation:
...
@@ -57,6 +57,7 @@ class LLUpdateDownloader::Implementation:
LLSD
mDownloadData
;
LLSD
mDownloadData
;
llofstream
mDownloadStream
;
llofstream
mDownloadStream
;
std
::
string
mDownloadRecordPath
;
std
::
string
mDownloadRecordPath
;
curl_slist
*
mHeaderList
;
void
initializeCurlGet
(
std
::
string
const
&
url
,
bool
processHeader
);
void
initializeCurlGet
(
std
::
string
const
&
url
,
bool
processHeader
);
void
resumeDownloading
(
size_t
startByte
);
void
resumeDownloading
(
size_t
startByte
);
...
@@ -154,7 +155,8 @@ LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client &
...
@@ -154,7 +155,8 @@ LLUpdateDownloader::Implementation::Implementation(LLUpdateDownloader::Client &
LLThread
(
"LLUpdateDownloader"
),
LLThread
(
"LLUpdateDownloader"
),
mCancelled
(
false
),
mCancelled
(
false
),
mClient
(
client
),
mClient
(
client
),
mCurl
(
0
)
mCurl
(
0
),
mHeaderList
(
0
)
{
{
CURLcode
code
=
curl_global_init
(
CURL_GLOBAL_ALL
);
// Just in case.
CURLcode
code
=
curl_global_init
(
CURL_GLOBAL_ALL
);
// Just in case.
llverify
(
code
==
CURLE_OK
);
// TODO: real error handling here.
llverify
(
code
==
CURLE_OK
);
// TODO: real error handling here.
...
@@ -302,6 +304,11 @@ void LLUpdateDownloader::Implementation::run(void)
...
@@ -302,6 +304,11 @@ void LLUpdateDownloader::Implementation::run(void)
LLFile
::
remove
(
mDownloadRecordPath
);
LLFile
::
remove
(
mDownloadRecordPath
);
mClient
.
downloadError
(
"curl error"
);
mClient
.
downloadError
(
"curl error"
);
}
}
if
(
mHeaderList
)
{
curl_slist_free_all
(
mHeaderList
);
mHeaderList
=
0
;
}
}
}
...
@@ -330,17 +337,18 @@ void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & u
...
@@ -330,17 +337,18 @@ void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & u
void
LLUpdateDownloader
::
Implementation
::
resumeDownloading
(
size_t
startByte
)
void
LLUpdateDownloader
::
Implementation
::
resumeDownloading
(
size_t
startByte
)
{
{
LL_INFOS
(
"UpdateDownload"
)
<<
"resuming download from "
<<
mDownloadData
[
"url"
].
asString
()
<<
" at byte "
<<
startByte
<<
LL_ENDL
;
initializeCurlGet
(
mDownloadData
[
"url"
].
asString
(),
false
);
initializeCurlGet
(
mDownloadData
[
"url"
].
asString
(),
false
);
// The header 'Range: bytes n-' will request the bytes remaining in the
// The header 'Range: bytes n-' will request the bytes remaining in the
// source begining with byte n and ending with the last byte.
// source begining with byte n and ending with the last byte.
boost
::
format
rangeHeaderFormat
(
"Range: bytes=%u-"
);
boost
::
format
rangeHeaderFormat
(
"Range: bytes=%u-"
);
rangeHeaderFormat
%
startByte
;
rangeHeaderFormat
%
startByte
;
curl_slist
*
headerList
=
0
;
mHeaderList
=
curl_slist_append
(
mHeaderList
,
rangeHeaderFormat
.
str
().
c_str
());
headerList
=
curl_slist_append
(
headerList
,
rangeHeaderFormat
.
str
().
c_str
());
if
(
mHeaderList
==
0
)
throw
DownloadError
(
"cannot add Range header"
);
if
(
headerList
==
0
)
throw
DownloadError
(
"cannot add Range header"
);
throwOnCurlError
(
curl_easy_setopt
(
mCurl
,
CURLOPT_HTTPHEADER
,
mHeaderList
));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
,
CURLOPT_HTTPHEADER
,
headerList
));
curl_slist_free_all
(
headerList
);
mDownloadStream
.
open
(
mDownloadData
[
"path"
].
asString
(),
mDownloadStream
.
open
(
mDownloadData
[
"path"
].
asString
(),
std
::
ios_base
::
out
|
std
::
ios_base
::
binary
|
std
::
ios_base
::
app
);
std
::
ios_base
::
out
|
std
::
ios_base
::
binary
|
std
::
ios_base
::
app
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment