Mercurial > hg > nginx
diff src/event/ngx_event_udp.c @ 7393:4698cede59ff
Stream: proxy_requests directive.
The directive allows to drop binding between a client and existing UDP stream
session after receiving a specified number of packets. First packet from the
same client address and port will start a new session. Old session continues
to exist and will terminate at moment defined by configuration: either after
receiving the expected number of responses, or after timeout, as specified by
the "proxy_responses" and/or "proxy_timeout" directives.
By default, proxy_requests is zero (disabled).
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Mon, 12 Nov 2018 16:29:30 +0300 |
parents | 27559d4a5151 |
children | 6d4bc025c5a7 |
line wrap: on
line diff
--- a/src/event/ngx_event_udp.c +++ b/src/event/ngx_event_udp.c @@ -23,7 +23,6 @@ static void ngx_close_accepted_udp_conne static ssize_t ngx_udp_shared_recv(ngx_connection_t *c, u_char *buf, size_t size); static ngx_int_t ngx_insert_udp_connection(ngx_connection_t *c); -static void ngx_delete_udp_connection(void *data); static ngx_connection_t *ngx_lookup_udp_connection(ngx_listening_t *ls, struct sockaddr *sockaddr, socklen_t socklen, struct sockaddr *local_sockaddr, socklen_t local_socklen); @@ -558,11 +557,15 @@ ngx_insert_udp_connection(ngx_connection } -static void +void ngx_delete_udp_connection(void *data) { ngx_connection_t *c = data; + if (c->udp == NULL) { + return; + } + ngx_rbtree_delete(&c->listening->rbtree, &c->udp->node); c->udp = NULL; @@ -643,4 +646,12 @@ ngx_lookup_udp_connection(ngx_listening_ return NULL; } +#else + +void +ngx_delete_udp_connection(void *data) +{ + return; +} + #endif