Skip to content

Commit

Permalink
[+] add threshold option for path standby and available
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanmei-Liu committed Nov 5, 2023
1 parent 67ff422 commit 15b82fd
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions demo/demo_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,23 +1088,31 @@ xqc_demo_cli_h3_request_read_notify(xqc_h3_request_t *h3_request, xqc_request_no
xqc_demo_cli_task_ctx_t *ctx = &user_stream->user_conn->ctx->task_ctx;
xqc_demo_cli_user_conn_t *user_conn = user_stream->user_conn;
uint32_t task_idx = user_conn->task->task_idx;
xqc_msec_t ts_now = 0;

if (user_conn->send_path_standby) {
/* set initial path standby here */
if (user_conn->path_status == 0
&& xqc_conn_available_paths(user_conn->ctx->engine, &user_conn->cid) >= 2)
{
xqc_conn_mark_path_standby(user_conn->ctx->engine, &user_conn->cid, 0);
user_conn->path_status = 1; /* 1:standby */
user_conn->path_status_time = xqc_demo_now();
printf("mark initial path standby\n");
ts_now = xqc_demo_now();
if (ts_now > user_conn->path_status_time + user_conn->path_status_timer_threshold) {
xqc_conn_mark_path_standby(user_conn->ctx->engine, &user_conn->cid, 0);
user_conn->path_status = 1; /* 1:standby */
printf("mark initial path standby: now=" PRId64 "\n", user_conn->path_status_time);

user_conn->path_status_time = ts_now;
}

} else if (user_conn->path_status == 1) {
xqc_msec_t ts_now = xqc_demo_now();
ts_now = xqc_demo_now();
if (ts_now > user_conn->path_status_time + user_conn->path_status_timer_threshold) {
xqc_conn_mark_path_available(user_conn->ctx->engine, &user_conn->cid, 0);
user_conn->path_status = 0; /* 0:available */
printf("mark initial path available\n");
printf("mark initial path available: now=" PRId64 ", threshold=" PRId64 "\n",
user_conn->path_status_time, user_conn->path_status_timer_threshold);

user_conn->path_status_time = ts_now;
}
}
}
Expand Down Expand Up @@ -2416,6 +2424,7 @@ xqc_demo_cli_init_xquic_connection(xqc_demo_cli_user_conn_t *user_conn,
user_conn->send_path_standby = 1;
user_conn->path_status = 0;
user_conn->path_status_timer_threshold = args->quic_cfg.path_status_timer_threshold;
user_conn->path_status_time = 0;
}

return 0;
Expand Down

0 comments on commit 15b82fd

Please sign in to comment.