Skip to content

Commit

Permalink
[+] add key update threshold at demo server (#362)
Browse files Browse the repository at this point in the history
* [+] add key update trigger at demo server side

* [+] add option for key update
  • Loading branch information
Yanmei-Liu authored Nov 5, 2023
1 parent 838e0d1 commit 5bac338
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion demo/demo_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ typedef struct xqc_demo_svr_quic_config_s {

uint32_t reinjection;

uint64_t keyupdate_pkt_threshold;
} xqc_demo_svr_quic_config_t;


Expand Down Expand Up @@ -1181,6 +1182,7 @@ xqc_demo_svr_usage(int argc, char *argv[])
" -P enable MPQUIC to return ACK_MPs on any paths.\n"
" -s multipath scheduler (interop, minrtt, backup), default: interop\n"
" -R Reinjection (1,2,4) \n"
" -u Keyupdate packet threshold\n"
, prog);
}

Expand Down Expand Up @@ -1216,13 +1218,15 @@ xqc_demo_svr_init_args(xqc_demo_svr_args_t *args)
strncpy(args->env_cfg.key_out_path, KEY_PATH, PATH_LEN - 1);
strncpy(args->env_cfg.priv_key_path, PRIV_KEY_PATH, PATH_LEN - 1);
strncpy(args->env_cfg.cert_pem_path, CERT_PEM_PATH, PATH_LEN - 1);

args->quic_cfg.keyupdate_pkt_threshold = UINT64_MAX;
}

void
xqc_demo_svr_parse_args(int argc, char *argv[], xqc_demo_svr_args_t *args)
{
int ch = 0;
while ((ch = getopt(argc, argv, "p:c:CD:l:L:6k:rdMPs:R:")) != -1) {
while ((ch = getopt(argc, argv, "p:c:CD:l:L:6k:rdMPs:R:u:")) != -1) {
switch (ch) {
/* listen port */
case 'p':
Expand Down Expand Up @@ -1322,6 +1326,11 @@ xqc_demo_svr_parse_args(int argc, char *argv[], xqc_demo_svr_args_t *args)
args->quic_cfg.reinjection = atoi(optarg);
break;

case 'u': /* key update packet threshold */
printf("key update packet threshold: %s\n", optarg);
args->quic_cfg.keyupdate_pkt_threshold = atoi(optarg);
break;

default:
printf("other option :%c\n", ch);
xqc_demo_svr_usage(argc, argv);
Expand Down Expand Up @@ -1435,6 +1444,7 @@ xqc_demo_svr_init_conn_settings(xqc_demo_svr_args_t *args)
.reinj_ctl_callback = xqc_deadline_reinj_ctl_cb,
.mp_enable_reinjection = args->quic_cfg.reinjection,
.standby_path_probe_timeout = 1000,
.keyupdate_pkt_threshold = args->quic_cfg.keyupdate_pkt_threshold,
};

xqc_server_set_conn_settings(&conn_settings);
Expand Down
3 changes: 3 additions & 0 deletions src/transport/xqc_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ xqc_server_set_conn_settings(const xqc_conn_settings_t *settings)
default_conn_settings.standby_path_probe_timeout = xqc_max(settings->standby_path_probe_timeout, XQC_MIN_STANDBY_RPOBE_TIMEOUT);
}

if (settings->keyupdate_pkt_threshold != UINT64_MAX) {
default_conn_settings.keyupdate_pkt_threshold = settings->keyupdate_pkt_threshold;
}
}

static const char * const xqc_conn_flag_to_str[XQC_CONN_FLAG_SHIFT_NUM] = {
Expand Down

0 comments on commit 5bac338

Please sign in to comment.