mirror of
https://github.com/curl/curl.git
synced 2026-08-25 19:33:32 +03:00
curl_multi_get_handles: get easy handles from a multi handle
Closes #11750
This commit is contained in:
parent
bb4032a152
commit
9ffd411735
10 changed files with 113 additions and 1 deletions
|
|
@ -107,6 +107,7 @@ int Curl_conncache_init(struct conncache *connc, int size)
|
|||
connc->closure_handle = curl_easy_init();
|
||||
if(!connc->closure_handle)
|
||||
return 1; /* bad */
|
||||
connc->closure_handle->internal = true;
|
||||
|
||||
Curl_hash_init(&connc->hash, size, Curl_hash_str,
|
||||
Curl_str_key_compare, free_bundle_hash_entry);
|
||||
|
|
|
|||
|
|
@ -242,6 +242,7 @@ static CURLcode dohprobe(struct Curl_easy *data,
|
|||
/* pass in the struct pointer via a local variable to please coverity and
|
||||
the gcc typecheck helpers */
|
||||
struct dynbuf *resp = &p->serverdoh;
|
||||
doh->internal = true;
|
||||
ERROR_CHECK_SETOPT(CURLOPT_URL, url);
|
||||
ERROR_CHECK_SETOPT(CURLOPT_DEFAULT_PROTOCOL, "https");
|
||||
ERROR_CHECK_SETOPT(CURLOPT_WRITEFUNCTION, doh_write_cb);
|
||||
|
|
|
|||
18
lib/multi.c
18
lib/multi.c
|
|
@ -3788,3 +3788,21 @@ unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi)
|
|||
DEBUGASSERT(multi);
|
||||
return multi->max_concurrent_streams;
|
||||
}
|
||||
|
||||
struct Curl_easy **curl_multi_get_handles(struct Curl_multi *multi)
|
||||
{
|
||||
struct Curl_easy **a = malloc(sizeof(struct Curl_easy *) *
|
||||
(multi->num_easy + 1));
|
||||
if(a) {
|
||||
int i = 0;
|
||||
struct Curl_easy *e = multi->easyp;
|
||||
while(e) {
|
||||
DEBUGASSERT(i < multi->num_easy);
|
||||
if(!e->internal)
|
||||
a[i++] = e;
|
||||
e = e->next;
|
||||
}
|
||||
a[i] = NULL; /* last entry is a NULL */
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1950,7 +1950,7 @@ struct Curl_easy {
|
|||
other using the same cache. For easier tracking
|
||||
in log output.
|
||||
This may wrap around after LONG_MAX to 0 again, so it
|
||||
has no uniqueness guarantuee for very large processings. */
|
||||
has no uniqueness guarantee for very large processings. */
|
||||
curl_off_t id;
|
||||
|
||||
/* first, two fields for the linked list of these */
|
||||
|
|
@ -2013,6 +2013,10 @@ struct Curl_easy {
|
|||
#ifdef USE_HYPER
|
||||
struct hyptransfer hyp;
|
||||
#endif
|
||||
|
||||
/* internal: true if this easy handle was created for internal use and the
|
||||
user does not have ownership of the handle. */
|
||||
bool internal;
|
||||
};
|
||||
|
||||
#define LIBCURL_NAME "libcurl"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue