comparison src/event/quic/ngx_event_quic_connid.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
323 323
324 return NULL; 324 return NULL;
325 } 325 }
326 326
327 327
328 ngx_quic_client_id_t *
329 ngx_quic_used_client_id(ngx_connection_t *c, ngx_quic_path_t *path)
330 {
331 ngx_queue_t *q;
332 ngx_quic_socket_t *qsock;
333 ngx_quic_connection_t *qc;
334
335 qc = ngx_quic_get_connection(c);
336
337 /* best guess: cid used by active path is good for us */
338 if (qc->socket->path == path) {
339 return qc->socket->cid;
340 }
341
342 for (q = ngx_queue_head(&qc->sockets);
343 q != ngx_queue_sentinel(&qc->sockets);
344 q = ngx_queue_next(q))
345 {
346 qsock = ngx_queue_data(q, ngx_quic_socket_t, queue);
347
348 if (qsock->path && qsock->path == path) {
349 return qsock->cid;
350 }
351 }
352
353 return NULL;
354 }
355
356
328 ngx_int_t 357 ngx_int_t
329 ngx_quic_handle_retire_connection_id_frame(ngx_connection_t *c, 358 ngx_quic_handle_retire_connection_id_frame(ngx_connection_t *c,
330 ngx_quic_header_t *pkt, ngx_quic_retire_cid_frame_t *f) 359 ngx_quic_header_t *pkt, ngx_quic_retire_cid_frame_t *f)
331 { 360 {
332 ngx_quic_path_t *path; 361 ngx_quic_path_t *path;