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
e307a46b
Commit
e307a46b
authored
9 years ago
by
Drake Arconis
Browse files
Options
Downloads
Patches
Plain Diff
Update to modern curl progress reporting functionality in the update downloader
parent
5093fe3d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/viewer_components/updater/llupdatedownloader.cpp
+13
-13
13 additions, 13 deletions
indra/viewer_components/updater/llupdatedownloader.cpp
with
13 additions
and
13 deletions
indra/viewer_components/updater/llupdatedownloader.cpp
+
13
−
13
View file @
e307a46b
...
@@ -56,7 +56,7 @@ class LLUpdateDownloader::Implementation:
...
@@ -56,7 +56,7 @@ class LLUpdateDownloader::Implementation:
bool
isDownloading
(
void
);
bool
isDownloading
(
void
);
size_t
onHeader
(
void
*
header
,
size_t
size
);
size_t
onHeader
(
void
*
header
,
size_t
size
);
size_t
onBody
(
void
*
header
,
size_t
size
);
size_t
onBody
(
void
*
header
,
size_t
size
);
int
onProgress
(
double
downloadSize
,
double
bytesDownloaded
);
int
onProgress
(
curl_off_t
downloadSize
,
curl_off_t
bytesDownloaded
);
void
resume
(
void
);
void
resume
(
void
);
void
setBandwidthLimit
(
U64
bytesPerSecond
);
void
setBandwidthLimit
(
U64
bytesPerSecond
);
...
@@ -174,11 +174,11 @@ namespace {
...
@@ -174,11 +174,11 @@ namespace {
}
}
int
progress
_callback
(
void
*
downloader
,
int
xferinfo
_callback
(
void
*
downloader
,
double
dowloadTotal
,
curl_off_t
dowloadTotal
,
double
downloadNow
,
curl_off_t
downloadNow
,
double
uploadTotal
,
curl_off_t
uploadTotal
,
double
uploadNow
)
curl_off_t
uploadNow
)
{
{
return
reinterpret_cast
<
LLUpdateDownloader
::
Implementation
*>
(
downloader
)
->
return
reinterpret_cast
<
LLUpdateDownloader
::
Implementation
*>
(
downloader
)
->
onProgress
(
dowloadTotal
,
downloadNow
);
onProgress
(
dowloadTotal
,
downloadNow
);
...
@@ -386,9 +386,9 @@ size_t LLUpdateDownloader::Implementation::onBody(void * buffer, size_t size)
...
@@ -386,9 +386,9 @@ size_t LLUpdateDownloader::Implementation::onBody(void * buffer, size_t size)
}
}
int
LLUpdateDownloader
::
Implementation
::
onProgress
(
double
downloadSize
,
double
bytesDownloaded
)
int
LLUpdateDownloader
::
Implementation
::
onProgress
(
curl_off_t
downloadSize
,
curl_off_t
bytesDownloaded
)
{
{
int
downloadPercent
=
static_cast
<
int
>
(
100.
*
(
bytesDownloaded
/
downloadSize
));
int
downloadPercent
=
static_cast
<
int
>
(
100.
0
*
(
(
double
)
bytesDownloaded
/
(
double
)
downloadSize
));
if
(
downloadPercent
>
mDownloadPercent
)
{
if
(
downloadPercent
>
mDownloadPercent
)
{
mDownloadPercent
=
downloadPercent
;
mDownloadPercent
=
downloadPercent
;
...
@@ -396,8 +396,8 @@ int LLUpdateDownloader::Implementation::onProgress(double downloadSize, double b
...
@@ -396,8 +396,8 @@ int LLUpdateDownloader::Implementation::onProgress(double downloadSize, double b
event
[
"pump"
]
=
LLUpdaterService
::
pumpName
();
event
[
"pump"
]
=
LLUpdaterService
::
pumpName
();
LLSD
payload
;
LLSD
payload
;
payload
[
"type"
]
=
LLSD
(
LLUpdaterService
::
PROGRESS
);
payload
[
"type"
]
=
LLSD
(
LLUpdaterService
::
PROGRESS
);
payload
[
"download_size"
]
=
downloadSize
;
payload
[
"download_size"
]
=
(
LLSD
::
Integer
)
downloadSize
;
payload
[
"bytes_downloaded"
]
=
bytesDownloaded
;
payload
[
"bytes_downloaded"
]
=
(
LLSD
::
Integer
)
bytesDownloaded
;
event
[
"payload"
]
=
payload
;
event
[
"payload"
]
=
payload
;
LLEventPumps
::
instance
().
obtain
(
"mainlooprepeater"
).
post
(
event
);
LLEventPumps
::
instance
().
obtain
(
"mainlooprepeater"
).
post
(
event
);
...
@@ -480,9 +480,9 @@ void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & u
...
@@ -480,9 +480,9 @@ void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & u
}
}
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_HTTPGET
,
true
));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_HTTPGET
,
true
));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_URL
,
url
.
c_str
()));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_URL
,
url
.
c_str
()));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_
PROGRESS
FUNCTION
,
&
progress
_callback
));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_
XFERINFO
FUNCTION
,
&
xferinfo
_callback
));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_
PROGRESS
DATA
,
this
));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_
XFERINFO
DATA
,
this
));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_NOPROGRESS
,
false
));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_NOPROGRESS
,
0
));
// if it's a required update set the bandwidth limit to 0 (unlimited)
// if it's a required update set the bandwidth limit to 0 (unlimited)
curl_off_t
limit
=
mDownloadData
[
"required"
].
asBoolean
()
?
0
:
mBandwidthLimit
;
curl_off_t
limit
=
mDownloadData
[
"required"
].
asBoolean
()
?
0
:
mBandwidthLimit
;
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_MAX_RECV_SPEED_LARGE
,
limit
));
throwOnCurlError
(
curl_easy_setopt
(
mCurl
.
get
(),
CURLOPT_MAX_RECV_SPEED_LARGE
,
limit
));
...
...
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