Artifactspublic-v0

curl

master
ply4 git calls32 ms289 KiB3 cachedprotocol v2
209 lines5.9 KiBRaw
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24#include "curl_setup.h"
26#include "urldata.h"
27#include "curl_trc.h"
28#include "multihandle.h"
29#include "multiif.h"
30#include "multi_ntfy.h"
32#if CURLMNOTIFY_LAST > 31
33#error "notification types must fit below the curl_multi_ntfy high flag bit"
34#endif
36#define CURL_MNTFY_TYPE_FLAG(type) ((uint32_t)1 << (type))
38struct mntfy_entry {
39 uint32_t mid;
40 uint32_t type;
41};
43#define CURL_MNTFY_CHUNK_SIZE 128
45struct mntfy_chunk {
46 struct mntfy_chunk *next;
47 size_t r_offset;
48 size_t w_offset;
49 struct mntfy_entry entries[CURL_MNTFY_CHUNK_SIZE];
50};
52static struct mntfy_chunk *mnfty_chunk_create(void)
54 return curlx_calloc(1, sizeof(struct mntfy_chunk));
57static void mnfty_chunk_destroy(struct mntfy_chunk *chunk)
59 curlx_free(chunk);
62static void mnfty_chunk_reset(struct mntfy_chunk *chunk)
64 chunk->r_offset = chunk->w_offset = 0;
67static bool mntfy_chunk_append(struct mntfy_chunk *chunk,
68 struct Curl_easy *data,
69 uint32_t type)
71 struct mntfy_entry *e;
73 if(chunk->w_offset >= CURL_MNTFY_CHUNK_SIZE)
74 return FALSE;
75 e = &chunk->entries[chunk->w_offset++];
76 e->mid = data->mid;
77 e->type = type;
78 return TRUE;
81static struct mntfy_chunk *mntfy_non_full_tail(struct curl_multi_ntfy *mntfy)
83 struct mntfy_chunk *chunk;
84 if(!mntfy->tail) {
85 chunk = mnfty_chunk_create();
86 if(!chunk)
87 return NULL;
88 DEBUGASSERT(!mntfy->head);
89 mntfy->head = mntfy->tail = chunk;
90 return chunk;
91 }
92 else if(mntfy->tail->w_offset < CURL_MNTFY_CHUNK_SIZE)
93 return mntfy->tail;
94 else { /* tail is full. */
95 chunk = mnfty_chunk_create();
96 if(!chunk)
97 return NULL;
98 DEBUGASSERT(mntfy->head);
99 mntfy->tail->next = chunk;
100 mntfy->tail = chunk;
101 return chunk;
102 }
105static void mntfy_chunk_dispatch_all(struct Curl_multi *multi,
106 struct mntfy_chunk *chunk)
108 struct mntfy_entry *e;
109 struct Curl_easy *data;
111 while(multi->ntfy.ntfy_cb &&
112 (chunk->r_offset < chunk->w_offset) && !multi->ntfy.failure) {
113 e = &chunk->entries[chunk->r_offset];
114 data = e->mid ? Curl_multi_get_easy(multi, e->mid) : multi->admin;
115 /* only when notification has not been disabled in the meantime */
116 if(data && (multi->ntfy.flags & CURL_MNTFY_TYPE_FLAG(e->type))) {
117 /* this may cause new notifications to be added! */
118 CURL_TRC_M(multi->admin, "[NTFY] dispatch %u to xfer %u",
119 e->type, e->mid);
120 multi->ntfy.ntfy_cb(multi, e->type, data, multi->ntfy.ntfy_cb_data);
121 }
122 /* once dispatched, safe to increment */
123 chunk->r_offset++;
124 }
125 mnfty_chunk_reset(chunk);
128void Curl_mntfy_init(struct Curl_multi *multi)
130 memset(&multi->ntfy, 0, sizeof(multi->ntfy));
133void Curl_mntfy_cleanup(struct Curl_multi *multi)
135 while(multi->ntfy.head) {
136 struct mntfy_chunk *chunk = multi->ntfy.head;
137 multi->ntfy.head = chunk->next;
138 mnfty_chunk_destroy(chunk);
139 }
140 multi->ntfy.tail = NULL;
143CURLMcode Curl_mntfy_enable(struct Curl_multi *multi, unsigned int type)
145 if(type >= CURLMNOTIFY_LAST)
146 return CURLM_UNKNOWN_OPTION;
147 multi->ntfy.flags |= CURL_MNTFY_TYPE_FLAG(type);
148 return CURLM_OK;
151CURLMcode Curl_mntfy_disable(struct Curl_multi *multi, unsigned int type)
153 if(type >= CURLMNOTIFY_LAST)
154 return CURLM_UNKNOWN_OPTION;
155 multi->ntfy.flags &= ~CURL_MNTFY_TYPE_FLAG(type);
156 return CURLM_OK;
159void Curl_mntfy_add(struct Curl_easy *data, unsigned int type)
161 struct Curl_multi *multi = data ? data->multi : NULL;
162 if(multi && multi->ntfy.ntfy_cb && !multi->ntfy.failure &&
163 type < CURLMNOTIFY_LAST &&
164 (multi->ntfy.flags & CURL_MNTFY_TYPE_FLAG(type))) {
165 /* append to list of outstanding notifications */
166 struct mntfy_chunk *tail = mntfy_non_full_tail(&multi->ntfy);
167 CURL_TRC_M(data, "[NTFY] add %u for xfer %u", type, data->mid);
168 if(tail)
169 mntfy_chunk_append(tail, data, (uint32_t)type);
170 else
171 multi->ntfy.failure = CURLM_OUT_OF_MEMORY;
172 multi->ntfy.flags |= CURL_MNTFY_FLAG_HAS_ENTRIES;
173 }
176CURLMcode Curl_mntfy_dispatch_all(struct Curl_multi *multi)
178 struct Curl_mapi_guard guard;
180 if(!multi)
181 return CURLM_BAD_FUNCTION_ARGUMENT;
183 CURL_CBAPI_MULTI_START(&guard, multi, multi_ntfy_cb);
185 while(multi->ntfy.head && !multi->ntfy.failure) {
186 struct mntfy_chunk *chunk = multi->ntfy.head;
187 /* this may cause new notifications to be added! */
188 mntfy_chunk_dispatch_all(multi, chunk);
189 DEBUGASSERT(chunk->r_offset == chunk->w_offset);
191 if(chunk == multi->ntfy.tail) /* last one, keep */
192 break;
193 DEBUGASSERT(chunk->next);
194 DEBUGASSERT(multi->ntfy.head != multi->ntfy.tail);
195 multi->ntfy.head = chunk->next;
196 mnfty_chunk_destroy(chunk);
197 }
199 CURL_CBAPI_MULTI_END(&guard);
201 if(multi->ntfy.failure) {
202 CURLMcode mresult = multi->ntfy.failure;
203 multi->ntfy.failure = CURLM_OK; /* reset, once delivered */
204 return mresult;
205 }
206 else
207 multi->ntfy.flags &= ~CURL_MNTFY_FLAG_HAS_ENTRIES;
208 return CURLM_OK;
Diagnostics4 git calls · 32 ms
CallStatusSizeTime032 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
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 · hit2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=2
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 · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=27
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=3
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
fetch2002.0 KiB · hit27 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=2097
git.response.cache=HIT
git.response.duration_ms=27
git.fetch.wants=4723c8025bdd5e969de819b8bcde5a7df4718b64
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=2097
git.pkt.payload.max=2076
git.sideband.band1.bytes=2075
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
a5e2aa32fb93e6b0
Request
8c281164…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format