diff options
author | Björn Stenberg <bjorn@haxx.se> | 2018-02-10 15:13:15 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-02-15 09:36:03 +0100 |
commit | b46cfbc068ebe90f18e9777b9e877e4934c1b5e3 (patch) | |
tree | 4d88b0f4d9492f51a93251e488400ff7a8abba62 /lib/easy.c | |
parent | 43a50a2580db2bfb28483a96964ae27b584472da (diff) | |
download | curl-b46cfbc068ebe90f18e9777b9e877e4934c1b5e3.tar.gz |
TODO fixed: Detect when called from within callbacks
Closes #2302
Diffstat (limited to 'lib/easy.c')
-rw-r--r-- | lib/easy.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/easy.c b/lib/easy.c index 3389d4463..4ebec7cf5 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -61,6 +61,7 @@ #include "strdup.h" #include "progress.h" #include "easyif.h" +#include "multiif.h" #include "select.h" #include "sendf.h" /* for failf function prototype */ #include "connect.h" /* for Curl_getconnectinfo */ @@ -761,6 +762,9 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events) data->multi_easy = multi; } + if(multi->in_callback) + return CURLE_RECURSIVE_API_CALL; + /* Copy the MAXCONNECTS option to the multi handle */ curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, data->set.maxconnects); @@ -1030,6 +1034,9 @@ void curl_easy_reset(struct Curl_easy *data) * the pausing, you may get your write callback called at this point. * * Action is a bitmask consisting of CURLPAUSE_* bits in curl/curl.h + * + * NOTE: This is one of few API functions that are allowed to be called from + * within a callback. */ CURLcode curl_easy_pause(struct Curl_easy *data, int action) { @@ -1134,6 +1141,9 @@ CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen, ssize_t n1; struct connectdata *c; + if(Curl_is_in_callback(data)) + return CURLE_RECURSIVE_API_CALL; + result = easy_connection(data, &sfd, &c); if(result) return result; @@ -1161,6 +1171,9 @@ CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer, ssize_t n1; struct connectdata *c = NULL; + if(Curl_is_in_callback(data)) + return CURLE_RECURSIVE_API_CALL; + result = easy_connection(data, &sfd, &c); if(result) return result; |