Mercurial > hg > nginx
diff src/event/quic/ngx_event_quic_migration.c @ 8777:d5f93733c17d quic
QUIC: relaxed client id requirements.
Client IDs cannot be reused on different paths. This change allows to reuse
client id previosly seen on the same path (but with different dcid) in case
when no unused client IDs are available.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 05 May 2021 18:11:55 +0300 |
parents | 4117aa7fa38e |
children | 5186ee5a94b9 |
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_migration.c +++ b/src/event/quic/ngx_event_quic_migration.c @@ -348,16 +348,23 @@ ngx_quic_update_paths(ngx_connection_t * } } + /* prefer unused client IDs if available */ cid = ngx_quic_next_client_id(c); if (cid == NULL) { - qc = ngx_quic_get_connection(c); - qc->error = NGX_QUIC_ERR_CONNECTION_ID_LIMIT_ERROR; - qc->error_reason = "no available client ids for new path"; + + /* try to reuse connection ID used on the same path */ + cid = ngx_quic_used_client_id(c, path); + if (cid == NULL) { - ngx_log_error(NGX_LOG_ERR, c->log, 0, - "no available client ids for new path"); + qc = ngx_quic_get_connection(c); + qc->error = NGX_QUIC_ERR_CONNECTION_ID_LIMIT_ERROR; + qc->error_reason = "no available client ids for new path"; - return NGX_ERROR; + ngx_log_error(NGX_LOG_ERR, c->log, 0, + "no available client ids for new path"); + + return NGX_ERROR; + } } ngx_quic_connect(c, qsock, path, cid);