comparison 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
comparison
equal deleted inserted replaced
8776:901126931bd5 8777:d5f93733c17d
346 if (path == NULL) { 346 if (path == NULL) {
347 return NGX_ERROR; 347 return NGX_ERROR;
348 } 348 }
349 } 349 }
350 350
351 /* prefer unused client IDs if available */
351 cid = ngx_quic_next_client_id(c); 352 cid = ngx_quic_next_client_id(c);
352 if (cid == NULL) { 353 if (cid == NULL) {
353 qc = ngx_quic_get_connection(c); 354
354 qc->error = NGX_QUIC_ERR_CONNECTION_ID_LIMIT_ERROR; 355 /* try to reuse connection ID used on the same path */
355 qc->error_reason = "no available client ids for new path"; 356 cid = ngx_quic_used_client_id(c, path);
356 357 if (cid == NULL) {
357 ngx_log_error(NGX_LOG_ERR, c->log, 0, 358
358 "no available client ids for new path"); 359 qc = ngx_quic_get_connection(c);
359 360 qc->error = NGX_QUIC_ERR_CONNECTION_ID_LIMIT_ERROR;
360 return NGX_ERROR; 361 qc->error_reason = "no available client ids for new path";
362
363 ngx_log_error(NGX_LOG_ERR, c->log, 0,
364 "no available client ids for new path");
365
366 return NGX_ERROR;
367 }
361 } 368 }
362 369
363 ngx_quic_connect(c, qsock, path, cid); 370 ngx_quic_connect(c, qsock, path, cid);
364 371
365 update: 372 update: