master
1#ifndef HEADER_CURL_CSHUTDN_H
2#define HEADER_CURL_CSHUTDN_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
11 * Copyright (C) Linus Nielsen Feltzing, <linus@haxx.se>
12 *
13 * This software is licensed as described in the file COPYING, which
14 * you should have received as part of this distribution. The terms
15 * are also available at https://curl.se/docs/copyright.html.
16 *
17 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
18 * copies of the Software, and permit persons to whom the Software is
19 * furnished to do so, under the terms of the COPYING file.
20 *
21 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22 * KIND, either express or implied.
23 *
24 * SPDX-License-Identifier: curl
25 *
26 ***************************************************************************/
27#include "ptrarray.h"
29struct connectdata;
30struct Curl_easy;
31struct curl_pollfds;
32struct Curl_waitfds;
33struct Curl_multi;
34struct Curl_share;
35struct Curl_sigpipe_ctx;
38/* Terminates the connection, e.g. closes and destroys it.
39 * If `do_shutdown` is TRUE, the shutdown will be run once.
40 * Takes ownership of `conn`. `conn` MUST no longer be in
41 * a pool or on a shutdown list. */
42void Curl_cshutdn_terminate(struct Curl_easy *admin,
43 struct connectdata *conn,
44 bool do_shutdown);
46/* Start the shutdown timer,
47 * marks the connection sockindex as being shut down. */
48void Curl_cshutdn_start_timer(struct Curl_easy *data, int8_t sockindex,
49 int timeout_ms);
50/* Clear the shutdown timer at sockindex again. */
51void Curl_cshutdn_clear_timer(struct Curl_easy *data, int8_t sockindex);
53/* return how much time there is left to shutdown the connection at
54 * sockindex. Returns 0 if there is no limit or shutdown has not started. */
55timediff_t Curl_cshutdn_timeleft_ms(struct Curl_easy *data,
56 struct connectdata *conn,
57 int8_t sockindex);
59#define CURL_CONN_IN_SHUTDOWN(c,i) ((c)->shutdown.start_ms[(i)] >= 0)
61/* Shutdown the connection at `sockindex` non-blocking.
62 * Will start the shutdown timer if not already set.
63 * Return CURLE_OK and *done == FALSE if not finished. */
64CURLcode Curl_cshutdn_try_once_idx(struct Curl_easy *data,
65 int8_t sockindex, bool *done);
67/* Run the shutdown of the connection once non-blocking for both
68 * socket indices. Will start the shutdown timer if not already set.
69 * Shortly attach/detach the admin handle to `conn` while doing so.
70 * `done` will be set TRUE if any error was encountered or if
71 * the connection was shut down completely. */
72void Curl_cshutdn_try_once(struct Curl_easy *admin,
73 struct connectdata *conn, bool *done);
75/* A `cshutdown` is always owned by a multi handle to maintain
76 * the connections to be shut down. It registers timers and
77 * sockets to monitor via the multi handle. */
78struct cshutdn {
79 struct ptrarray conns; /* connections being shut down */
80};
82/* Init as part of the given multi handle. */
83void Curl_cshutdn_init(struct cshutdn *cshutdn);
85/* Terminate all remaining connections and free resources. */
86void Curl_cshutdn_destroy(struct cshutdn *cshutdn,
87 struct Curl_easy *admin);
89/* Number of connections being shut down. */
90size_t Curl_cshutdn_count(struct cshutdn *cshutdn);
92/* Number of connections to the destination being shut down. */
93size_t Curl_cshutdn_dest_count(struct cshutdn *cshutdn,
94 const char *destination);
96/* Close the oldest `count` connections in shutdown to destination or,
97 * when destination is NULL for any destination.
98 * Return the number of connections closed. */
99size_t Curl_cshutdn_close_oldest(struct cshutdn *cshutdn,
100 struct Curl_easy *admin,
101 const char *destination,
102 size_t count);
104/* Add a connection to have it shut down. Terminate the oldest
105 * connection when shutdowns exceed max_shutdowns. */
106void Curl_cshutdn_add(struct cshutdn *cshutdn,
107 struct Curl_multi *multi,
108 struct connectdata *conn,
109 size_t max_shutdowns);
111/* Add sockets and POLLIN/OUT flags for connections being shut down. */
112CURLcode Curl_cshutdn_add_pollfds(struct cshutdn *cshutdn,
113 struct Curl_easy *admin,
114 struct curl_pollfds *cpfds);
116unsigned int Curl_cshutdn_add_waitfds(struct cshutdn *cshutdn,
117 struct Curl_easy *admin,
118 struct Curl_waitfds *cwfds);
120void Curl_cshutdn_setfds(struct cshutdn *cshutdn,
121 struct Curl_easy *admin,
122 fd_set *read_fd_set, fd_set *write_fd_set,
123 int *maxfd);
125/* Run maintenance on all connections. */
126void Curl_cshutdn_perform(struct cshutdn *cshutdn,
127 struct Curl_easy *admin,
128 struct Curl_sigpipe_ctx *sigpipe_ctx);
130#endif /* HEADER_CURL_CSHUTDN_H */
Diagnostics4 git calls · 29 ms
CallStatusSizeTime029 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 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 · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=23 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=86Open pack map
fetch2001.8 KiB · hit23 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1861 git.response.cache=HIT git.response.duration_ms=23 git.fetch.wants=d42d2cb9f6dbd4c58833664d3b38f3e9e834db0d 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=1861 git.pkt.payload.max=1840 git.sideband.band1.bytes=1839 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
- a5e1a4a1bf0a5e44
- Request
- 9eb03ff7…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format