summaryrefslogtreecommitdiffhomepage
path: root/src/event/ngx_event_udp.c
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2018-11-12 16:29:30 +0300
committerVladimir Homutov <vl@nginx.com>2018-11-12 16:29:30 +0300
commit41a451e286cb6de9e0a0ad97f91a1dcac17ef68f (patch)
treefc502118ce9e6f38161f876cb71c67cedb4a56cf /src/event/ngx_event_udp.c
parentabf04ed87abd048c9f6c2de62f6a771bbd923f8a (diff)
downloadnginx-41a451e286cb6de9e0a0ad97f91a1dcac17ef68f.tar.gz
nginx-41a451e286cb6de9e0a0ad97f91a1dcac17ef68f.tar.bz2
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).
Diffstat (limited to 'src/event/ngx_event_udp.c')
-rw-r--r--src/event/ngx_event_udp.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/event/ngx_event_udp.c b/src/event/ngx_event_udp.c
index 53b090475..65eb22fd2 100644
--- a/src/event/ngx_event_udp.c
+++ b/src/event/ngx_event_udp.c
@@ -23,7 +23,6 @@ static void ngx_close_accepted_udp_connection(ngx_connection_t *c);
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_t *c)
}
-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_t *ls, struct sockaddr *sockaddr,
return NULL;
}
+#else
+
+void
+ngx_delete_udp_connection(void *data)
+{
+ return;
+}
+
#endif