Lines Matching refs:ctx
131 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_baller_init() local
137 b->result = Curl_cf_setup_insert_after(cf, data, ctx->remotehost, in cf_hc_baller_init()
159 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_reset() local
161 if(ctx) { in cf_hc_reset()
162 cf_hc_baller_reset(&ctx->h3_baller, data); in cf_hc_reset()
163 cf_hc_baller_reset(&ctx->h21_baller, data); in cf_hc_reset()
164 ctx->state = CF_HC_INIT; in cf_hc_reset()
165 ctx->result = CURLE_OK; in cf_hc_reset()
166 ctx->hard_eyeballs_timeout_ms = data->set.happy_eyeballs_timeout; in cf_hc_reset()
167 ctx->soft_eyeballs_timeout_ms = data->set.happy_eyeballs_timeout / 2; in cf_hc_reset()
175 struct cf_hc_ctx *ctx = cf->ctx; in baller_connected() local
180 if(winner != &ctx->h3_baller) in baller_connected()
181 cf_hc_baller_reset(&ctx->h3_baller, data); in baller_connected()
182 if(winner != &ctx->h21_baller) in baller_connected()
183 cf_hc_baller_reset(&ctx->h21_baller, data); in baller_connected()
206 ctx->state = CF_HC_FAILURE; in baller_connected()
207 ctx->result = result; in baller_connected()
215 ctx->state = CF_HC_SUCCESS; in baller_connected()
225 struct cf_hc_ctx *ctx = cf->ctx; in time_to_start_h21() local
228 if(!ctx->h21_baller.enabled || cf_hc_baller_has_started(&ctx->h21_baller)) in time_to_start_h21()
231 if(!ctx->h3_baller.enabled || !cf_hc_baller_is_active(&ctx->h3_baller)) in time_to_start_h21()
234 elapsed_ms = Curl_timediff(now, ctx->started); in time_to_start_h21()
235 if(elapsed_ms >= ctx->hard_eyeballs_timeout_ms) { in time_to_start_h21()
237 ctx->hard_eyeballs_timeout_ms); in time_to_start_h21()
241 if(elapsed_ms >= ctx->soft_eyeballs_timeout_ms) { in time_to_start_h21()
242 if(cf_hc_baller_reply_ms(&ctx->h3_baller, data) < 0) { in time_to_start_h21()
245 ctx->soft_eyeballs_timeout_ms); in time_to_start_h21()
249 Curl_expire(data, ctx->hard_eyeballs_timeout_ms - elapsed_ms, in time_to_start_h21()
259 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_connect() local
271 switch(ctx->state) { in cf_hc_connect()
273 DEBUGASSERT(!ctx->h3_baller.cf); in cf_hc_connect()
274 DEBUGASSERT(!ctx->h21_baller.cf); in cf_hc_connect()
277 ctx->started = now; in cf_hc_connect()
278 if(ctx->h3_baller.enabled) { in cf_hc_connect()
279 cf_hc_baller_init(&ctx->h3_baller, cf, data, "h3", TRNSPRT_QUIC); in cf_hc_connect()
280 if(ctx->h21_baller.enabled) in cf_hc_connect()
281 Curl_expire(data, ctx->soft_eyeballs_timeout_ms, EXPIRE_ALPN_EYEBALLS); in cf_hc_connect()
283 else if(ctx->h21_baller.enabled) in cf_hc_connect()
284 cf_hc_baller_init(&ctx->h21_baller, cf, data, "h21", in cf_hc_connect()
286 ctx->state = CF_HC_CONNECT; in cf_hc_connect()
290 if(cf_hc_baller_is_active(&ctx->h3_baller)) { 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()
299 cf_hc_baller_init(&ctx->h21_baller, cf, data, "h21", in cf_hc_connect()
303 if(cf_hc_baller_is_active(&ctx->h21_baller)) { 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()
312 if((!ctx->h3_baller.enabled || ctx->h3_baller.result) && in cf_hc_connect()
313 (!ctx->h21_baller.enabled || ctx->h21_baller.result)) { in cf_hc_connect()
316 result = ctx->result = ctx->h3_baller.enabled ? in cf_hc_connect()
317 ctx->h3_baller.result : ctx->h21_baller.result; in cf_hc_connect()
318 ctx->state = CF_HC_FAILURE; in cf_hc_connect()
326 result = ctx->result; in cf_hc_connect()
346 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_shutdown() local
359 ballers[0] = &ctx->h3_baller; in cf_hc_shutdown()
360 ballers[1] = &ctx->h21_baller; in cf_hc_shutdown()
391 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_adjust_pollset() local
395 ballers[0] = &ctx->h3_baller; in cf_hc_adjust_pollset()
396 ballers[1] = &ctx->h21_baller; in cf_hc_adjust_pollset()
410 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_data_pending() local
416 return cf_hc_baller_data_pending(&ctx->h3_baller, data) in cf_hc_data_pending()
417 || cf_hc_baller_data_pending(&ctx->h21_baller, data); in cf_hc_data_pending()
424 struct cf_hc_ctx *ctx = cf->ctx; in cf_get_max_baller_time() local
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()
448 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_query() local
463 if(cf_hc_baller_needs_flush(&ctx->h3_baller, data) in cf_hc_query()
464 || cf_hc_baller_needs_flush(&ctx->h21_baller, data)) { in cf_hc_query()
483 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_cntrl() local
487 result = cf_hc_baller_cntrl(&ctx->h3_baller, data, event, arg1, arg2); in cf_hc_cntrl()
489 result = cf_hc_baller_cntrl(&ctx->h21_baller, data, event, arg1, arg2); in cf_hc_cntrl()
510 struct cf_hc_ctx *ctx = cf->ctx; in cf_hc_destroy() local
515 Curl_safefree(ctx); in cf_hc_destroy()
543 struct cf_hc_ctx *ctx; in cf_hc_create() local
547 ctx = calloc(1, sizeof(*ctx)); in cf_hc_create()
548 if(!ctx) { in cf_hc_create()
552 ctx->remotehost = remotehost; in cf_hc_create()
553 ctx->h3_baller.enabled = try_h3; in cf_hc_create()
554 ctx->h21_baller.enabled = try_h21; in cf_hc_create()
556 result = Curl_cf_create(&cf, &Curl_cft_http_connect, ctx); in cf_hc_create()
559 ctx = NULL; in cf_hc_create()
564 free(ctx); in cf_hc_create()