• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_multi_remove_handle
5Section: 3
6Source: libcurl
7See-also:
8  - curl_multi_add_handle (3)
9  - curl_multi_cleanup (3)
10  - curl_multi_init (3)
11---
12
13# NAME
14
15curl_multi_remove_handle - remove an easy handle from a multi session
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *easy_handle);
23~~~
24
25# DESCRIPTION
26
27Removes a given *easy_handle* from the *multi_handle*. This makes the
28specified easy handle be removed from this multi handle's control.
29
30When the easy handle has been removed from a multi stack, it is again
31perfectly legal to invoke curl_easy_perform(3) on this easy handle.
32
33Removing an easy handle while being in use is perfectly legal and effectively
34halts the transfer in progress involving that easy handle. All other easy
35handles and transfers remain unaffected.
36
37It is fine to remove a handle at any time during a transfer, just not from
38within any libcurl callback function.
39
40Removing an easy handle from the multi handle before the corresponding
41transfer is complete might cause libcurl to close the connection - if the
42state of it and the internal protocol handler deem it necessary. Otherwise
43libcurl keeps the connection alive in the connection pool associated with the
44multi handle, ready to get reused for a future transfer using this multi
45handle.
46
47# EXAMPLE
48
49~~~c
50int main(void)
51{
52  CURLM *multi = curl_multi_init();
53  int queued = 0;
54
55  /* when an easy handle has completed, remove it */
56  CURLMsg *msg = curl_multi_info_read(multi, &queued);
57  if(msg) {
58    if(msg->msg == CURLMSG_DONE) {
59      /* a transfer ended */
60      fprintf(stderr, "Transfer completed\n");
61      curl_multi_remove_handle(multi, msg->easy_handle);
62    }
63  }
64}
65~~~
66
67# AVAILABILITY
68
69Added in 7.9.6
70
71# RETURN VALUE
72
73CURLMcode type, general libcurl multi interface error code.
74