Lines Matching refs:cf
54 struct Curl_cfilter *cf; member
65 if(b->cf) { in cf_hc_baller_reset()
66 Curl_conn_cf_close(b->cf, data); in cf_hc_baller_reset()
67 Curl_conn_cf_discard_chain(&b->cf, data); in cf_hc_baller_reset()
68 b->cf = NULL; in cf_hc_baller_reset()
76 return b->enabled && b->cf && !b->result; in cf_hc_baller_is_active()
81 return !!b->cf; in cf_hc_baller_has_started()
88 b->cf->cft->query(b->cf, data, CF_QUERY_CONNECT_REPLY_MS, in cf_hc_baller_reply_ms()
96 return b->cf && !b->result && b->cf->cft->has_data_pending(b->cf, data); in cf_hc_baller_data_pending()
102 return b->cf && !b->result && Curl_conn_cf_needs_flush(b->cf, data); in cf_hc_baller_needs_flush()
109 if(b->cf && !b->result) in cf_hc_baller_cntrl()
110 return Curl_conn_cf_cntrl(b->cf, data, FALSE, event, arg1, arg2); in cf_hc_baller_cntrl()
126 struct Curl_cfilter *cf, in cf_hc_baller_init() argument
131 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_baller_init()
132 struct Curl_cfilter *save = cf->next; in cf_hc_baller_init()
135 cf->next = NULL; in cf_hc_baller_init()
137 b->result = Curl_cf_setup_insert_after(cf, data, ctx->remotehost, in cf_hc_baller_init()
139 b->cf = cf->next; in cf_hc_baller_init()
140 cf->next = save; in cf_hc_baller_init()
144 struct Curl_cfilter *cf, in cf_hc_baller_connect() argument
148 struct Curl_cfilter *save = cf->next; in cf_hc_baller_connect()
150 cf->next = b->cf; in cf_hc_baller_connect()
151 b->result = Curl_conn_cf_connect(cf->next, data, FALSE, done); in cf_hc_baller_connect()
152 b->cf = cf->next; /* it might mutate */ in cf_hc_baller_connect()
153 cf->next = save; in cf_hc_baller_connect()
157 static void cf_hc_reset(struct Curl_cfilter *cf, struct Curl_easy *data) in cf_hc_reset() argument
159 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_reset()
171 static CURLcode baller_connected(struct Curl_cfilter *cf, in baller_connected() argument
175 struct cf_hc_ctx *ctx = cf->ctx; in baller_connected()
179 DEBUGASSERT(winner->cf); in baller_connected()
187 CURL_TRC_CF(data, cf, "connect+handshake %s: %dms, 1st data: %dms", in baller_connected()
191 CURL_TRC_CF(data, cf, "deferred handshake %s: %dms", in baller_connected()
194 cf->next = winner->cf; in baller_connected()
195 winner->cf = NULL; in baller_connected()
197 switch(cf->conn->alpn) { in baller_connected()
204 result = Curl_http2_switch_at(cf, data); in baller_connected()
216 cf->connected = TRUE; in baller_connected()
221 static bool time_to_start_h21(struct Curl_cfilter *cf, in time_to_start_h21() argument
225 struct cf_hc_ctx *ctx = cf->ctx; in time_to_start_h21()
236 CURL_TRC_CF(data, cf, "hard timeout of %dms reached, starting h21", in time_to_start_h21()
243 CURL_TRC_CF(data, cf, "soft timeout of %dms reached, h3 has not " in time_to_start_h21()
255 static CURLcode cf_hc_connect(struct Curl_cfilter *cf, in cf_hc_connect() argument
259 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_connect()
264 if(cf->connected) { in cf_hc_connect()
273 DEBUGASSERT(!ctx->h3_baller.cf); in cf_hc_connect()
274 DEBUGASSERT(!ctx->h21_baller.cf); in cf_hc_connect()
275 DEBUGASSERT(!cf->next); in cf_hc_connect()
276 CURL_TRC_CF(data, cf, "connect, init"); in cf_hc_connect()
279 cf_hc_baller_init(&ctx->h3_baller, cf, data, "h3", TRNSPRT_QUIC); in cf_hc_connect()
284 cf_hc_baller_init(&ctx->h21_baller, cf, data, "h21", in cf_hc_connect()
285 cf->conn->transport); in cf_hc_connect()
291 result = cf_hc_baller_connect(&ctx->h3_baller, cf, data, done); in cf_hc_connect()
293 result = baller_connected(cf, data, &ctx->h3_baller); in cf_hc_connect()
298 if(time_to_start_h21(cf, data, now)) { in cf_hc_connect()
299 cf_hc_baller_init(&ctx->h21_baller, cf, data, "h21", in cf_hc_connect()
300 cf->conn->transport); in cf_hc_connect()
304 CURL_TRC_CF(data, cf, "connect, check h21"); in cf_hc_connect()
305 result = cf_hc_baller_connect(&ctx->h21_baller, cf, data, done); in cf_hc_connect()
307 result = baller_connected(cf, data, &ctx->h21_baller); in cf_hc_connect()
315 CURL_TRC_CF(data, cf, "connect, all failed"); in cf_hc_connect()
327 cf->connected = FALSE; in cf_hc_connect()
333 cf->connected = TRUE; in cf_hc_connect()
339 CURL_TRC_CF(data, cf, "connect -> %d, done=%d", result, *done); in cf_hc_connect()
343 static CURLcode cf_hc_shutdown(struct Curl_cfilter *cf, in cf_hc_shutdown() argument
346 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_shutdown()
352 if(cf->connected) { in cf_hc_shutdown()
366 b->result = b->cf->cft->do_shutdown(b->cf, data, &bdone); in cf_hc_shutdown()
382 CURL_TRC_CF(data, cf, "shutdown -> %d, done=%d", result, *done); in cf_hc_shutdown()
386 static void cf_hc_adjust_pollset(struct Curl_cfilter *cf, in cf_hc_adjust_pollset() argument
390 if(!cf->connected) { in cf_hc_adjust_pollset()
391 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_adjust_pollset()
401 Curl_conn_cf_adjust_pollset(b->cf, data, ps); in cf_hc_adjust_pollset()
403 CURL_TRC_CF(data, cf, "adjust_pollset -> %d socks", ps->num); in cf_hc_adjust_pollset()
407 static bool cf_hc_data_pending(struct Curl_cfilter *cf, in cf_hc_data_pending() argument
410 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_data_pending()
412 if(cf->connected) in cf_hc_data_pending()
413 return cf->next->cft->has_data_pending(cf->next, data); in cf_hc_data_pending()
415 CURL_TRC_CF((struct Curl_easy *)data, cf, "data_pending"); in cf_hc_data_pending()
420 static struct curltime cf_get_max_baller_time(struct Curl_cfilter *cf, in cf_get_max_baller_time() argument
424 struct cf_hc_ctx *ctx = cf->ctx; in cf_get_max_baller_time()
430 cfb = ctx->h21_baller.enabled ? ctx->h21_baller.cf : NULL; in cf_get_max_baller_time()
436 cfb = ctx->h3_baller.enabled ? ctx->h3_baller.cf : NULL; in cf_get_max_baller_time()
444 static CURLcode cf_hc_query(struct Curl_cfilter *cf, in cf_hc_query() argument
448 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_query()
450 if(!cf->connected) { in cf_hc_query()
454 *when = cf_get_max_baller_time(cf, data, CF_QUERY_TIMER_CONNECT); in cf_hc_query()
459 *when = cf_get_max_baller_time(cf, data, CF_QUERY_TIMER_APPCONNECT); in cf_hc_query()
474 return cf->next ? in cf_hc_query()
475 cf->next->cft->query(cf->next, data, query, pres1, pres2) : in cf_hc_query()
479 static CURLcode cf_hc_cntrl(struct Curl_cfilter *cf, in cf_hc_cntrl() argument
483 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_cntrl()
486 if(!cf->connected) { in cf_hc_cntrl()
496 static void cf_hc_close(struct Curl_cfilter *cf, struct Curl_easy *data) in cf_hc_close() argument
498 CURL_TRC_CF(data, cf, "close"); in cf_hc_close()
499 cf_hc_reset(cf, data); in cf_hc_close()
500 cf->connected = FALSE; in cf_hc_close()
502 if(cf->next) { in cf_hc_close()
503 cf->next->cft->do_close(cf->next, data); in cf_hc_close()
504 Curl_conn_cf_discard_chain(&cf->next, data); in cf_hc_close()
508 static void cf_hc_destroy(struct Curl_cfilter *cf, struct Curl_easy *data) in cf_hc_destroy() argument
510 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_destroy()
513 CURL_TRC_CF(data, cf, "destroy"); in cf_hc_destroy()
514 cf_hc_reset(cf, data); in cf_hc_destroy()
542 struct Curl_cfilter *cf = NULL; in cf_hc_create() local
556 result = Curl_cf_create(&cf, &Curl_cft_http_connect, ctx); in cf_hc_create()
560 cf_hc_reset(cf, data); in cf_hc_create()
563 *pcf = result ? NULL : cf; in cf_hc_create()
574 struct Curl_cfilter *cf; in cf_http_connect_add() local
578 result = cf_hc_create(&cf, data, remotehost, try_h3, try_h21); in cf_http_connect_add()
581 Curl_conn_cf_add(data, conn, sockindex, cf); in cf_http_connect_add()