mirror of
https://github.com/curl/curl.git
synced 2026-08-25 21:03:34 +03:00
multi: add new information extraction method
Adds `curl_off_t curl_multi_get_offt(CURLM *multi_handle, CURLMinfo_offt info)` to the multi interface with enums: * CURLMINFO_XFERS_CURRENT: current number of transfers * CURLMINFO_XFERS_RUNNING: number of running transfers * CURLMINFO_XFERS_PENDING: number of pending transfers * CURLMINFO_XFERS_DONE: number of finished transfers to read * CURLMINFO_XFERS_ADDED: total number of transfers added, ever Add documentation for functions and info enums. Add use in the curl command line tool to replace two static variables counting the same "from the outside". refs #17870
This commit is contained in:
parent
4108d11008
commit
923055aed6
14 changed files with 177 additions and 18 deletions
|
|
@ -75,6 +75,7 @@ man_MANS = \
|
|||
curl_multi_cleanup.3 \
|
||||
curl_multi_fdset.3 \
|
||||
curl_multi_get_handles.3 \
|
||||
curl_multi_get_offt.3 \
|
||||
curl_multi_info_read.3 \
|
||||
curl_multi_init.3 \
|
||||
curl_multi_perform.3 \
|
||||
|
|
|
|||
97
docs/libcurl/curl_multi_get_offt.md
Normal file
97
docs/libcurl/curl_multi_get_offt.md
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_get_offt
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_add_handle (3)
|
||||
- curl_multi_remove_handle (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 8.16.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_get_offt - extract information from a multi handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
curl_off_t curl_multi_get_offt(CURLM *multi, CURLMinfo info);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Get the *info* kept in the *multi* handle for `CURLMI_OFFT_*`.
|
||||
If the multi handle is not valid or the *info* is not applicable, returns 0.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
The following information can be extracted:
|
||||
|
||||
## CURLMINFO_XFERS_CURRENT
|
||||
|
||||
The number of easy handles currently added to the multi. This does not
|
||||
count handles removed. It does count internal handles that get
|
||||
added for tasks (like resolving via DoH, for example).
|
||||
|
||||
For the total number of easy handles ever added to the multi, see
|
||||
curl_multi_get_offt(3).
|
||||
|
||||
## CURLMINFO_XFERS_RUNNING
|
||||
|
||||
The number of easy handles currently running, e.g. where the transfer
|
||||
has started but not finished yet.
|
||||
|
||||
## CURLMINFO_XFERS_PENDING
|
||||
|
||||
The number of current easy handles waiting to start. An added transfer
|
||||
might become pending for various reasons: a connection limit forces it
|
||||
to wait, resolving DNS is not finished or it is not clear if an existing,
|
||||
matching connection may allow multiplexing (HTTP/2 or HTTP/3).
|
||||
|
||||
## CURLMINFO_XFERS_DONE
|
||||
|
||||
The number of easy handles currently finished, but not yet processed
|
||||
via curl_multi_info_read(3).
|
||||
|
||||
## CURLMINFO_XFERS_ADDED
|
||||
|
||||
The cumulative number of all easy handles added to the multi, ever.
|
||||
This includes internal handles added for tasks (like resolving
|
||||
via DoH, for example).
|
||||
|
||||
For the current number of easy handles managed by the multi, use
|
||||
*CURLMINFO_XFERS_CURRENT*.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
/* init a multi stack */
|
||||
CURLM *multi = curl_multi_init();
|
||||
CURL *curl = curl_easy_init();
|
||||
curl_off_t n;
|
||||
|
||||
if(curl) {
|
||||
/* add the transfer */
|
||||
curl_multi_add_handle(multi, curl);
|
||||
|
||||
n = curl_multi_get_offt(multi, CURLMI_OFFT_XTOTAL);
|
||||
/* on successful add, n is 1 */
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
The extracted value
|
||||
|
|
@ -553,6 +553,12 @@ CURLM_RECURSIVE_API_CALL 7.59.0
|
|||
CURLM_UNKNOWN_OPTION 7.15.4
|
||||
CURLM_UNRECOVERABLE_POLL 7.84.0
|
||||
CURLM_WAKEUP_FAILURE 7.68.0
|
||||
CURLMINFO_NONE 8.16.0
|
||||
CURLMINFO_XFERS_CURRENT 8.16.0
|
||||
CURLMINFO_XFERS_RUNNING 8.16.0
|
||||
CURLMINFO_XFERS_PENDING 8.16.0
|
||||
CURLMINFO_XFERS_DONE 8.16.0
|
||||
CURLMINFO_XFERS_ADDED 8.16.0
|
||||
CURLMIMEOPT_FORMESCAPE 7.81.0
|
||||
CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE 7.30.0
|
||||
CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE 7.30.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue