-
Notifications
You must be signed in to change notification settings - Fork 381
[+] Fix: Support more specific idletimeout calculation #535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -943,6 +943,9 @@ xqc_conn_create(xqc_engine_t *engine, xqc_cid_t *dcid, xqc_cid_t *scid, | |||||||||||
| goto fail; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| // Initial here as idle_timeout dependency | ||||||||||||
| xqc_init_list_head(&xc->conn_paths_list); | ||||||||||||
|
|
||||||||||||
| xqc_conn_init_timer_manager(xc); | ||||||||||||
|
|
||||||||||||
| if (xc->conn_settings.datagram_redundant_probe) { | ||||||||||||
|
|
@@ -5818,17 +5821,6 @@ xqc_conn_get_local_transport_params(xqc_connection_t *conn, xqc_transport_params | |||||||||||
| conn->original_dcid.cid_buf, conn->original_dcid.cid_len); | ||||||||||||
| params->original_dest_connection_id_present = 1; | ||||||||||||
|
|
||||||||||||
| xqc_gen_reset_token(&conn->original_dcid, | ||||||||||||
| params->stateless_reset_token, | ||||||||||||
| XQC_STATELESS_RESET_TOKENLEN, | ||||||||||||
| conn->engine->config->reset_token_key, | ||||||||||||
| conn->engine->config->reset_token_keylen); | ||||||||||||
| params->stateless_reset_token_present = 1; | ||||||||||||
|
|
||||||||||||
| xqc_log(conn->log, XQC_LOG_INFO, "|generate sr_token[%s] for cid[%s]", | ||||||||||||
| xqc_sr_token_str(conn->engine, params->stateless_reset_token), | ||||||||||||
| xqc_scid_str(conn->engine, &conn->original_dcid)); | ||||||||||||
|
|
||||||||||||
| } else { | ||||||||||||
| params->original_dest_connection_id_present = 0; | ||||||||||||
| } | ||||||||||||
|
|
@@ -5837,6 +5829,22 @@ xqc_conn_get_local_transport_params(xqc_connection_t *conn, xqc_transport_params | |||||||||||
| conn->initial_scid.cid_buf, conn->initial_scid.cid_len); | ||||||||||||
| params->initial_source_connection_id_present = 1; | ||||||||||||
|
|
||||||||||||
| /* RFC 9000: server's stateless_reset_token is associated with its CID */ | ||||||||||||
| if (conn->conn_type == XQC_CONN_TYPE_SERVER | ||||||||||||
| && conn->initial_scid.cid_len > 0) | ||||||||||||
| { | ||||||||||||
| xqc_gen_reset_token(&conn->initial_scid, | ||||||||||||
| params->stateless_reset_token, | ||||||||||||
| XQC_STATELESS_RESET_TOKENLEN, | ||||||||||||
| conn->engine->config->reset_token_key, | ||||||||||||
| conn->engine->config->reset_token_keylen); | ||||||||||||
| params->stateless_reset_token_present = 1; | ||||||||||||
|
|
||||||||||||
| xqc_log(conn->log, XQC_LOG_INFO, "|generate sr_token[%s] for cid[%s]|", | ||||||||||||
| xqc_sr_token_str(conn->engine, params->stateless_reset_token), | ||||||||||||
| xqc_scid_str(conn->engine, &conn->initial_scid)); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if (conn->conn_type == XQC_CONN_TYPE_SERVER | ||||||||||||
| && conn->conn_flag & XQC_CONN_FLAG_RETRY_SENT | ||||||||||||
| && conn->retry_scid.cid_len > 0) | ||||||||||||
|
|
@@ -6393,8 +6401,19 @@ xqc_conn_get_idle_timeout(xqc_connection_t *conn) | |||||||||||
| ? XQC_CONN_INITIAL_IDLE_TIMEOUT : conn->conn_settings.init_idle_time_out; | ||||||||||||
|
|
||||||||||||
| } else { | ||||||||||||
| return conn->local_settings.max_idle_timeout == 0 | ||||||||||||
| xqc_msec_t local = conn->local_settings.max_idle_timeout == 0 | ||||||||||||
| ? XQC_CONN_DEFAULT_IDLE_TIMEOUT : conn->local_settings.max_idle_timeout; | ||||||||||||
|
|
||||||||||||
| xqc_msec_t remote_idle_timeout = (xqc_msec_t)conn->remote_settings.max_idle_timeout; | ||||||||||||
| xqc_msec_t idle_timeout = (remote_idle_timeout > 0) ? xqc_min(local, remote_idle_timeout) : local; | ||||||||||||
|
|
||||||||||||
| xqc_usec_t pto = xqc_conn_get_max_pto(conn); | ||||||||||||
| if (pto > 0) { | ||||||||||||
| xqc_msec_t min_idle_timeout = (xqc_msec_t)((3 * pto + 999) / 1000); | ||||||||||||
| idle_timeout = xqc_max(idle_timeout, min_idle_timeout); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
Comment on lines
+6410
to
+6415
|
||||||||||||
| xqc_usec_t pto = xqc_conn_get_max_pto(conn); | |
| if (pto > 0) { | |
| xqc_msec_t min_idle_timeout = (xqc_msec_t)((3 * pto + 999) / 1000); | |
| idle_timeout = xqc_max(idle_timeout, min_idle_timeout); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in
xqc_conn_get_idle_timeout()alter timeout semantics (using both local and remote advertised values). There are no unit tests covering the effective idle-timeout calculation; please add targeted cases intests/unittest/xqc_conn_test.cto prevent regressions.