xref: /aosp_15_r20/external/curl/docs/libcurl/curl_multi_cleanup.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerTitle: curl_multi_cleanup
5*6236dae4SAndroid Build Coastguard WorkerSection: 3
6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl
7*6236dae4SAndroid Build Coastguard WorkerSee-also:
8*6236dae4SAndroid Build Coastguard Worker  - curl_easy_cleanup (3)
9*6236dae4SAndroid Build Coastguard Worker  - curl_easy_init (3)
10*6236dae4SAndroid Build Coastguard Worker  - curl_multi_get_handles (3)
11*6236dae4SAndroid Build Coastguard Worker  - curl_multi_init (3)
12*6236dae4SAndroid Build Coastguard WorkerProtocol:
13*6236dae4SAndroid Build Coastguard Worker  - All
14*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.9.6
15*6236dae4SAndroid Build Coastguard Worker---
16*6236dae4SAndroid Build Coastguard Worker
17*6236dae4SAndroid Build Coastguard Worker# NAME
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard Workercurl_multi_cleanup - close down a multi session
20*6236dae4SAndroid Build Coastguard Worker
21*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS
22*6236dae4SAndroid Build Coastguard Worker
23*6236dae4SAndroid Build Coastguard Worker~~~c
24*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h>
25*6236dae4SAndroid Build Coastguard Worker
26*6236dae4SAndroid Build Coastguard WorkerCURLMcode curl_multi_cleanup(CURLM *multi_handle);
27*6236dae4SAndroid Build Coastguard Worker~~~
28*6236dae4SAndroid Build Coastguard Worker
29*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION
30*6236dae4SAndroid Build Coastguard Worker
31*6236dae4SAndroid Build Coastguard WorkerThis function is the opposite of curl_multi_init(3). Cleans up and removes a
32*6236dae4SAndroid Build Coastguard Workerwhole multi stack. It does not free or touch any individual easy handles in
33*6236dae4SAndroid Build Coastguard Workerany way - they still need to be closed individually, using the usual
34*6236dae4SAndroid Build Coastguard Workercurl_easy_cleanup(3) way. The order of cleaning up should be:
35*6236dae4SAndroid Build Coastguard Worker
36*6236dae4SAndroid Build Coastguard Worker1 - curl_multi_remove_handle(3) before any easy handles are cleaned up
37*6236dae4SAndroid Build Coastguard Worker
38*6236dae4SAndroid Build Coastguard Worker2 - curl_easy_cleanup(3) can now be called independently since the easy
39*6236dae4SAndroid Build Coastguard Workerhandle is no longer connected to the multi handle
40*6236dae4SAndroid Build Coastguard Worker
41*6236dae4SAndroid Build Coastguard Worker3 - curl_multi_cleanup(3) should be called when all easy handles are
42*6236dae4SAndroid Build Coastguard Workerremoved
43*6236dae4SAndroid Build Coastguard Worker
44*6236dae4SAndroid Build Coastguard WorkerWhen this function is called, remaining entries in the connection pool held by
45*6236dae4SAndroid Build Coastguard Workerthe multi handle are shut down, which might trigger calls to the
46*6236dae4SAndroid Build Coastguard WorkerCURLMOPT_SOCKETFUNCTION(3) callback.
47*6236dae4SAndroid Build Coastguard Worker
48*6236dae4SAndroid Build Coastguard WorkerPassing in a NULL pointer in *multi_handle* makes this function return
49*6236dae4SAndroid Build Coastguard WorkerCURLM_BAD_HANDLE immediately with no other action.
50*6236dae4SAndroid Build Coastguard Worker
51*6236dae4SAndroid Build Coastguard WorkerAny use of the **multi_handle** after this function has been called and have
52*6236dae4SAndroid Build Coastguard Workerreturned, is illegal.
53*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS%
54*6236dae4SAndroid Build Coastguard Worker
55*6236dae4SAndroid Build Coastguard Worker# EXAMPLE
56*6236dae4SAndroid Build Coastguard Worker
57*6236dae4SAndroid Build Coastguard Worker~~~c
58*6236dae4SAndroid Build Coastguard Workerint main(void)
59*6236dae4SAndroid Build Coastguard Worker{
60*6236dae4SAndroid Build Coastguard Worker  CURLM *multi = curl_multi_init();
61*6236dae4SAndroid Build Coastguard Worker
62*6236dae4SAndroid Build Coastguard Worker  /* when the multi transfer is done ... */
63*6236dae4SAndroid Build Coastguard Worker
64*6236dae4SAndroid Build Coastguard Worker  /* remove all easy handles, then: */
65*6236dae4SAndroid Build Coastguard Worker  curl_multi_cleanup(multi);
66*6236dae4SAndroid Build Coastguard Worker}
67*6236dae4SAndroid Build Coastguard Worker~~~
68*6236dae4SAndroid Build Coastguard Worker
69*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY%
70*6236dae4SAndroid Build Coastguard Worker
71*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE
72*6236dae4SAndroid Build Coastguard Worker
73*6236dae4SAndroid Build Coastguard WorkerCURLMcode type, general libcurl multi interface error code. On success,
74*6236dae4SAndroid Build Coastguard WorkerCURLM_OK is returned.
75