Artifactspublic-v0

curl

master
ply4 git calls160 ms288 KiB2 cachedprotocol v2
94 lines2.5 KiBRaw

NAME

curl_multi_add_handle - add an easy handle to a multi session

SYNOPSIS

c
#include <curl/curl.h>

CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_handle);

DESCRIPTION

Adds the easy handle to the multi_handle.

While an easy handle is added to a multi stack, you cannot and you must not use curl_easy_perform(3) on that handle. After having removed the easy handle from the multi stack again, it is perfectly fine to use it with the easy interface again.

If the easy handle is not set to use a shared (CURLOPT_SHARE(3)) cache, it is made to use a DNS cache that is shared between all easy handles within the multi handle when curl_multi_add_handle(3) is called.

When an easy interface is added to a multi handle, it is set to use a shared connection cache owned by the multi handle. Removing and adding new easy handles does not affect the pool of connections or the ability to do connection reuse.

If you have CURLMOPT_TIMERFUNCTION(3) set in the multi handle (as you should if you are working event-based with curl_multi_socket_action(3) and friends), that callback is called from within this function to ask for an updated timer so that your main event loop gets the activity on this handle to get started.

The easy handle remains added to the multi handle until you remove it again with curl_multi_remove_handle(3) - even when a transfer with that specific easy handle is completed.

You should remove the easy handle from the multi stack before you terminate first the easy handle and then the multi handle:

1 - curl_multi_remove_handle(3)

2 - curl_easy_cleanup(3)

3 - curl_multi_cleanup(3)

%PROTOCOLS%

EXAMPLE

c
int main(void)
{
  /* init a multi stack */
  CURLM *multi = curl_multi_init();

  /* create two easy handles */
  CURL *http_handle = curl_easy_init();
  CURL *http_handle2 = curl_easy_init();

  /* add individual transfers */
  curl_multi_add_handle(multi, http_handle);
  curl_multi_add_handle(multi, http_handle2);
}

%AVAILABILITY%

RETURN VALUE

This function returns a CURLMcode indicating success or error.

CURLM_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3).

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_multi_add_handle
5Section: 3
6Source: libcurl
7See-also:
8 - curl_multi_cleanup (3)
9 - curl_multi_get_handles (3)
10 - curl_multi_init (3)
11 - curl_multi_setopt (3)
12 - curl_multi_socket_action (3)
13Protocol:
14 - All
15Added-in: 7.9.6
16---
18# NAME
20curl_multi_add_handle - add an easy handle to a multi session
22# SYNOPSIS
24~~~c
25#include <curl/curl.h>
27CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_handle);
28~~~
30# DESCRIPTION
32Adds the *easy handle* to the *multi_handle*.
34While an easy handle is added to a multi stack, you cannot and you must not
35use curl_easy_perform(3) on that handle. After having removed the easy
36handle from the multi stack again, it is perfectly fine to use it with the
37easy interface again.
39If the easy handle is not set to use a shared (CURLOPT_SHARE(3)) cache,
40it is made to use a DNS cache that is shared between all easy handles within
41the multi handle when curl_multi_add_handle(3) is called.
43When an easy interface is added to a multi handle, it is set to use a shared
44connection cache owned by the multi handle. Removing and adding new easy
45handles does not affect the pool of connections or the ability to do
46connection reuse.
48If you have CURLMOPT_TIMERFUNCTION(3) set in the multi handle (as you
49should if you are working event-based with curl_multi_socket_action(3)
50and friends), that callback is called from within this function to ask for an
51updated timer so that your main event loop gets the activity on this handle to
52get started.
54The easy handle remains added to the multi handle until you remove it again
55with curl_multi_remove_handle(3) - even when a transfer with that
56specific easy handle is completed.
58You should remove the easy handle from the multi stack before you terminate
59first the easy handle and then the multi handle:
611 - curl_multi_remove_handle(3)
632 - curl_easy_cleanup(3)
653 - curl_multi_cleanup(3)
67# %PROTOCOLS%
69# EXAMPLE
71~~~c
72int main(void)
74 /* init a multi stack */
75 CURLM *multi = curl_multi_init();
77 /* create two easy handles */
78 CURL *http_handle = curl_easy_init();
79 CURL *http_handle2 = curl_easy_init();
81 /* add individual transfers */
82 curl_multi_add_handle(multi, http_handle);
83 curl_multi_add_handle(multi, http_handle2);
85~~~
87# %AVAILABILITY%
89# RETURN VALUE
91This function returns a CURLMcode indicating success or error.
93CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
94libcurl-errors(3).
Diagnostics4 git calls · 160 ms
CallStatusSizeTime0160 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit22 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=22
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch2001.2 KiB135 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=135
git.response.bytes=1186
git.response.cache=MISS
git.response.duration_ms=135
git.fetch.wants=ac29b89abdc470b177d043dedad792dac27d15bf
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1186
git.pkt.payload.max=1165
git.sideband.band1.bytes=1164
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e33f499baebe76
Request
2d4928f2…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format