Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_connid.c @ 8896:e2ec952dc295 quic
QUIC: fixed removal of unused client IDs.
If client ID was never used, its refcount is zero. To keep things simple,
the ngx_quic_unref_client_id() function is now aware of such IDs.
If client ID was used, the ngx_quic_replace_retired_client_id() function
is supposed to find all users and unref the ID, thus ngx_quic_unref_client_id()
should not be called after it.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 13 Oct 2021 14:48:33 +0300 |
parents | 4715f3e669f1 |
children | f8848f5a1014 |
comparison
equal
deleted
inserted
replaced
8895:4b2d259bdadd | 8896:e2ec952dc295 |
---|---|
181 if (cid->refcnt) { | 181 if (cid->refcnt) { |
182 /* we are going to retire client id which is in use */ | 182 /* we are going to retire client id which is in use */ |
183 if (ngx_quic_replace_retired_client_id(c, cid) != NGX_OK) { | 183 if (ngx_quic_replace_retired_client_id(c, cid) != NGX_OK) { |
184 return NGX_ERROR; | 184 return NGX_ERROR; |
185 } | 185 } |
186 } | 186 |
187 | 187 } else { |
188 ngx_quic_unref_client_id(c, cid); | 188 ngx_quic_unref_client_id(c, cid); |
189 } | |
189 } | 190 } |
190 | 191 |
191 done: | 192 done: |
192 | 193 |
193 if (qc->nclient_ids > qc->tp.active_connection_id_limit) { | 194 if (qc->nclient_ids > qc->tp.active_connection_id_limit) { |
532 void | 533 void |
533 ngx_quic_unref_client_id(ngx_connection_t *c, ngx_quic_client_id_t *cid) | 534 ngx_quic_unref_client_id(ngx_connection_t *c, ngx_quic_client_id_t *cid) |
534 { | 535 { |
535 ngx_quic_connection_t *qc; | 536 ngx_quic_connection_t *qc; |
536 | 537 |
537 cid->refcnt--; | 538 if (cid->refcnt) { |
539 cid->refcnt--; | |
540 } /* else: unused client id */ | |
538 | 541 |
539 if (cid->refcnt) { | 542 if (cid->refcnt) { |
540 return; | 543 return; |
541 } | 544 } |
542 | 545 |