Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_socket.c @ 9107:adcc6d8acfd4 quic
Common tree insert function for QUIC and UDP connections.
Previously, ngx_udp_rbtree_insert_value() was used for plain UDP and
ngx_quic_rbtree_insert_value() was used for QUIC. Because of this it was
impossible to initialize connection tree in ngx_create_listening() since
this function is not aware what kind of listening it creates.
Now ngx_udp_rbtree_insert_value() is used for both QUIC and UDP. To make
is possible, a generic key field is added to ngx_udp_connection_t. It keeps
client address for UDP and connection ID for QUIC.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Sun, 14 May 2023 12:30:11 +0400 |
parents | c2f5d79cde64 |
children | bba136612fe4 |
comparison
equal
deleted
inserted
replaced
9106:113e2438dbd4 | 9107:adcc6d8acfd4 |
---|---|
177 id.data = sid->id; | 177 id.data = sid->id; |
178 id.len = sid->len; | 178 id.len = sid->len; |
179 | 179 |
180 qsock->udp.connection = c; | 180 qsock->udp.connection = c; |
181 qsock->udp.node.key = ngx_crc32_long(id.data, id.len); | 181 qsock->udp.node.key = ngx_crc32_long(id.data, id.len); |
182 qsock->udp.key = id; | |
182 | 183 |
183 ngx_rbtree_insert(&c->listening->rbtree, &qsock->udp.node); | 184 ngx_rbtree_insert(&c->listening->rbtree, &qsock->udp.node); |
184 | 185 |
185 ngx_queue_insert_tail(&qc->sockets, &qsock->queue); | 186 ngx_queue_insert_tail(&qc->sockets, &qsock->queue); |
186 | 187 |