TODO fixed: Detect when called from within callbacks

Closes #2302
This commit is contained in:
Björn Stenberg 2018-02-10 15:13:15 +01:00 committed by Daniel Stenberg
parent 43a50a2580
commit b46cfbc068
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
28 changed files with 312 additions and 29 deletions

View file

@ -24,6 +24,7 @@
#include "urldata.h"
#include "sendf.h"
#include "multiif.h"
#include "progress.h"
#include "curl_printf.h"
@ -461,22 +462,26 @@ int Curl_pgrsUpdate(struct connectdata *conn)
if(data->set.fxferinfo) {
/* There's a callback set, call that */
Curl_set_in_callback(data, true);
result = data->set.fxferinfo(data->set.progress_client,
data->progress.size_dl,
data->progress.downloaded,
data->progress.size_ul,
data->progress.uploaded);
Curl_set_in_callback(data, false);
if(result)
failf(data, "Callback aborted");
return result;
}
if(data->set.fprogress) {
/* The older deprecated callback is set, call that */
Curl_set_in_callback(data, true);
result = data->set.fprogress(data->set.progress_client,
(double)data->progress.size_dl,
(double)data->progress.downloaded,
(double)data->progress.size_ul,
(double)data->progress.uploaded);
Curl_set_in_callback(data, false);
if(result)
failf(data, "Callback aborted");
return result;