aboutsummaryrefslogtreecommitdiff
path: root/src/event
diff options
context:
space:
mode:
Diffstat (limited to 'src/event')
-rw-r--r--src/event/ngx_event_udp.c6
-rw-r--r--src/event/ngx_event_udp.h1
-rw-r--r--src/event/quic/ngx_event_quic.h2
-rw-r--r--src/event/quic/ngx_event_quic_socket.c1
-rw-r--r--src/event/quic/ngx_event_quic_udp.c53
5 files changed, 6 insertions, 57 deletions
diff --git a/src/event/ngx_event_udp.c b/src/event/ngx_event_udp.c
index ec86fdfbc..43fa621b0 100644
--- a/src/event/ngx_event_udp.c
+++ b/src/event/ngx_event_udp.c
@@ -417,8 +417,8 @@ ngx_udp_rbtree_insert_value(ngx_rbtree_node_t *temp,
udpt = (ngx_udp_connection_t *) temp;
ct = udpt->connection;
- rc = ngx_cmp_sockaddr(c->sockaddr, c->socklen,
- ct->sockaddr, ct->socklen, 1);
+ rc = ngx_memn2cmp(udp->key.data, udpt->key.data,
+ udp->key.len, udpt->key.len);
if (rc == 0 && c->listening->wildcard) {
rc = ngx_cmp_sockaddr(c->local_sockaddr, c->local_socklen,
@@ -471,6 +471,8 @@ ngx_insert_udp_connection(ngx_connection_t *c)
ngx_crc32_final(hash);
udp->node.key = hash;
+ udp->key.data = (u_char *) c->sockaddr;
+ udp->key.len = c->socklen;
cln = ngx_pool_cleanup_add(c->pool, 0);
if (cln == NULL) {
diff --git a/src/event/ngx_event_udp.h b/src/event/ngx_event_udp.h
index d7a64ee03..e5ddf1b31 100644
--- a/src/event/ngx_event_udp.h
+++ b/src/event/ngx_event_udp.h
@@ -27,6 +27,7 @@ struct ngx_udp_connection_s {
ngx_rbtree_node_t node;
ngx_connection_t *connection;
ngx_buf_t *buffer;
+ ngx_str_t key;
};
diff --git a/src/event/quic/ngx_event_quic.h b/src/event/quic/ngx_event_quic.h
index 0c68d68f0..ca15200b4 100644
--- a/src/event/quic/ngx_event_quic.h
+++ b/src/event/quic/ngx_event_quic.h
@@ -111,8 +111,6 @@ struct ngx_quic_stream_s {
void ngx_quic_recvmsg(ngx_event_t *ev);
-void ngx_quic_rbtree_insert_value(ngx_rbtree_node_t *temp,
- ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);
void ngx_quic_run(ngx_connection_t *c, ngx_quic_conf_t *conf);
ngx_connection_t *ngx_quic_open_stream(ngx_connection_t *c, ngx_uint_t bidi);
void ngx_quic_finalize_connection(ngx_connection_t *c, ngx_uint_t err,
diff --git a/src/event/quic/ngx_event_quic_socket.c b/src/event/quic/ngx_event_quic_socket.c
index 6813fcd0a..6652523b7 100644
--- a/src/event/quic/ngx_event_quic_socket.c
+++ b/src/event/quic/ngx_event_quic_socket.c
@@ -179,6 +179,7 @@ ngx_quic_listen(ngx_connection_t *c, ngx_quic_connection_t *qc,
qsock->udp.connection = c;
qsock->udp.node.key = ngx_crc32_long(id.data, id.len);
+ qsock->udp.key = id;
ngx_rbtree_insert(&c->listening->rbtree, &qsock->udp.node);
diff --git a/src/event/quic/ngx_event_quic_udp.c b/src/event/quic/ngx_event_quic_udp.c
index 0721ca8b6..71754a48b 100644
--- a/src/event/quic/ngx_event_quic_udp.c
+++ b/src/event/quic/ngx_event_quic_udp.c
@@ -365,59 +365,6 @@ ngx_quic_close_accepted_connection(ngx_connection_t *c)
}
-void
-ngx_quic_rbtree_insert_value(ngx_rbtree_node_t *temp,
- ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
-{
- ngx_int_t rc;
- ngx_connection_t *c, *ct;
- ngx_rbtree_node_t **p;
- ngx_quic_socket_t *qsock, *qsockt;
-
- for ( ;; ) {
-
- if (node->key < temp->key) {
-
- p = &temp->left;
-
- } else if (node->key > temp->key) {
-
- p = &temp->right;
-
- } else { /* node->key == temp->key */
-
- qsock = (ngx_quic_socket_t *) node;
- c = qsock->udp.connection;
-
- qsockt = (ngx_quic_socket_t *) temp;
- ct = qsockt->udp.connection;
-
- rc = ngx_memn2cmp(qsock->sid.id, qsockt->sid.id,
- qsock->sid.len, qsockt->sid.len);
-
- if (rc == 0 && c->listening->wildcard) {
- rc = ngx_cmp_sockaddr(c->local_sockaddr, c->local_socklen,
- ct->local_sockaddr, ct->local_socklen, 1);
- }
-
- p = (rc < 0) ? &temp->left : &temp->right;
- }
-
- if (*p == sentinel) {
- break;
- }
-
- temp = *p;
- }
-
- *p = node;
- node->parent = temp;
- node->left = sentinel;
- node->right = sentinel;
- ngx_rbt_red(node);
-}
-
-
static ngx_connection_t *
ngx_quic_lookup_connection(ngx_listening_t *ls, ngx_str_t *key,
struct sockaddr *local_sockaddr, socklen_t local_socklen)