Mercurial > hg > nginx
comparison src/stream/ngx_stream.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 | 113e2438dbd4 |
children |
comparison
equal
deleted
inserted
replaced
9106:113e2438dbd4 | 9107:adcc6d8acfd4 |
---|---|
516 | 516 |
517 #if (NGX_HAVE_REUSEPORT) | 517 #if (NGX_HAVE_REUSEPORT) |
518 ls->reuseport = addr[i].opt.reuseport; | 518 ls->reuseport = addr[i].opt.reuseport; |
519 #endif | 519 #endif |
520 | 520 |
521 #if !(NGX_WIN32) | |
522 ngx_rbtree_init(&ls->rbtree, &ls->sentinel, | |
523 ngx_udp_rbtree_insert_value); | |
524 #endif | |
525 | |
526 stport = ngx_palloc(cf->pool, sizeof(ngx_stream_port_t)); | 521 stport = ngx_palloc(cf->pool, sizeof(ngx_stream_port_t)); |
527 if (stport == NULL) { | 522 if (stport == NULL) { |
528 return NGX_CONF_ERROR; | 523 return NGX_CONF_ERROR; |
529 } | 524 } |
530 | 525 |