comparison 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
comparison
equal deleted inserted replaced
7392:04ff25798002 7393:4698cede59ff
21 21
22 static void ngx_close_accepted_udp_connection(ngx_connection_t *c); 22 static void ngx_close_accepted_udp_connection(ngx_connection_t *c);
23 static ssize_t ngx_udp_shared_recv(ngx_connection_t *c, u_char *buf, 23 static ssize_t ngx_udp_shared_recv(ngx_connection_t *c, u_char *buf,
24 size_t size); 24 size_t size);
25 static ngx_int_t ngx_insert_udp_connection(ngx_connection_t *c); 25 static ngx_int_t ngx_insert_udp_connection(ngx_connection_t *c);
26 static void ngx_delete_udp_connection(void *data);
27 static ngx_connection_t *ngx_lookup_udp_connection(ngx_listening_t *ls, 26 static ngx_connection_t *ngx_lookup_udp_connection(ngx_listening_t *ls,
28 struct sockaddr *sockaddr, socklen_t socklen, 27 struct sockaddr *sockaddr, socklen_t socklen,
29 struct sockaddr *local_sockaddr, socklen_t local_socklen); 28 struct sockaddr *local_sockaddr, socklen_t local_socklen);
30 29
31 30
556 555
557 return NGX_OK; 556 return NGX_OK;
558 } 557 }
559 558
560 559
561 static void 560 void
562 ngx_delete_udp_connection(void *data) 561 ngx_delete_udp_connection(void *data)
563 { 562 {
564 ngx_connection_t *c = data; 563 ngx_connection_t *c = data;
564
565 if (c->udp == NULL) {
566 return;
567 }
565 568
566 ngx_rbtree_delete(&c->listening->rbtree, &c->udp->node); 569 ngx_rbtree_delete(&c->listening->rbtree, &c->udp->node);
567 570
568 c->udp = NULL; 571 c->udp = NULL;
569 } 572 }
641 } 644 }
642 645
643 return NULL; 646 return NULL;
644 } 647 }
645 648
646 #endif 649 #else
650
651 void
652 ngx_delete_udp_connection(void *data)
653 {
654 return;
655 }
656
657 #endif