Bryan Henderson fixed the progress function so that it can get called
more frequently allowing same calling frecuency for the client progress callback, while keeping the once a second frecuency for speed calculations and internal display of the transfer progress.
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -6,6 +6,10 @@
|
||||
|
||||
Changelog
|
||||
|
||||
Yang Tse (19 March 2007)
|
||||
- Bryan Henderson fixed the progress function so that it can get called more
|
||||
frequently allowing same calling frecuency for the client progress callback.
|
||||
|
||||
Dan F (15 March 2007)
|
||||
- Various memory leaks plugged and NULL pointer fixes made in the ssh code.
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ This release includes the following bugfixes:
|
||||
o CURLOPT_PORT, HTTP proxy, re-using connections and non-HTTP protocols
|
||||
o CURLOPT_INTERFACE for ipv6
|
||||
o use-after-free issue with HTTP transfers with the multi interface
|
||||
o the progress callback can get called more frequently
|
||||
|
||||
This release includes the following known bugs:
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -246,24 +246,6 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
||||
long dlestimate=0;
|
||||
long total_estimate;
|
||||
|
||||
if(data->progress.flags & PGRS_HIDE)
|
||||
; /* We do enter this function even if we don't wanna see anything, since
|
||||
this is were lots of the calculations are being made that will be used
|
||||
even when not displayed! */
|
||||
else if(!(data->progress.flags & PGRS_HEADERS_OUT)) {
|
||||
if (!data->progress.callback) {
|
||||
if(data->reqdata.resume_from)
|
||||
fprintf(data->set.err,
|
||||
"** Resuming transfer from byte position %" FORMAT_OFF_T
|
||||
"\n",
|
||||
data->reqdata.resume_from);
|
||||
fprintf(data->set.err,
|
||||
" %% Total %% Received %% Xferd Average Speed Time Time Time Current\n"
|
||||
" Dload Upload Total Spent Left Speed\n");
|
||||
}
|
||||
data->progress.flags |= PGRS_HEADERS_OUT; /* headers are shown */
|
||||
}
|
||||
|
||||
now = Curl_tvnow(); /* what time is it */
|
||||
|
||||
/* The time spent so far (from the start) */
|
||||
@@ -280,9 +262,9 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
||||
((double)data->progress.uploaded/
|
||||
(data->progress.timespent>0?data->progress.timespent:1));
|
||||
|
||||
if(data->progress.lastshow == Curl_tvlong(now))
|
||||
return 0; /* never update this more than once a second if the end isn't
|
||||
reached */
|
||||
/* Calculations done at most once a second, unless end is reached */
|
||||
if(data->progress.lastshow != Curl_tvlong(now)) {
|
||||
|
||||
data->progress.lastshow = now.tv_sec;
|
||||
|
||||
/* Let's do the "current speed" thing, which should use the fastest
|
||||
@@ -343,10 +325,13 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
||||
(data->progress.ulspeed>data->progress.dlspeed)?
|
||||
data->progress.ulspeed:data->progress.dlspeed;
|
||||
|
||||
if(data->progress.flags & PGRS_HIDE)
|
||||
return 0;
|
||||
} /* Calculations end */
|
||||
|
||||
else if(data->set.fprogress) {
|
||||
if(!(data->progress.flags & PGRS_HIDE)) {
|
||||
|
||||
/* progress meter has not been shut off */
|
||||
|
||||
if(data->set.fprogress) {
|
||||
/* There's a callback set, so we call that instead of writing
|
||||
anything ourselves. This really is the way to go. */
|
||||
result= data->set.fprogress(data->set.progress_client,
|
||||
@@ -359,6 +344,21 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* If there's no external callback set, use internal code to show progress */
|
||||
|
||||
if(!(data->progress.flags & PGRS_HEADERS_OUT)) {
|
||||
if(data->reqdata.resume_from) {
|
||||
fprintf(data->set.err,
|
||||
"** Resuming transfer from byte position %" FORMAT_OFF_T
|
||||
"\n",
|
||||
data->reqdata.resume_from);
|
||||
}
|
||||
fprintf(data->set.err,
|
||||
" %% Total %% Received %% Xferd Average Speed Time Time Time Current\n"
|
||||
" Dload Upload Total Spent Left Speed\n");
|
||||
data->progress.flags |= PGRS_HEADERS_OUT; /* headers are shown */
|
||||
}
|
||||
|
||||
/* Figure out the estimated time of arrival for the upload */
|
||||
if((data->progress.flags & PGRS_UL_SIZE_KNOWN) &&
|
||||
(data->progress.ulspeed>0) &&
|
||||
@@ -420,5 +420,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
||||
/* we flush the output stream to make it appear as soon as possible */
|
||||
fflush(data->set.err);
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user