diff src/stream/ngx_stream.c @ 6436:8f038068f4bc

Stream: UDP proxy.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 20 Jan 2016 19:52:12 +0300
parents cf5e822cf470
children c90cf79d0e1d
line wrap: on
line diff
--- a/src/stream/ngx_stream.c
+++ b/src/stream/ngx_stream.c
@@ -275,8 +275,11 @@ ngx_stream_add_ports(ngx_conf_t *cf, ngx
 
     port = ports->elts;
     for (i = 0; i < ports->nelts; i++) {
-        if (p == port[i].port && sa->sa_family == port[i].family) {
 
+        if (p == port[i].port
+            && listen->type == port[i].type
+            && sa->sa_family == port[i].family)
+        {
             /* a port is already in the port list */
 
             port = &port[i];
@@ -292,6 +295,7 @@ ngx_stream_add_ports(ngx_conf_t *cf, ngx
     }
 
     port->family = sa->sa_family;
+    port->type = listen->type;
     port->port = p;
 
     if (ngx_array_init(&port->addrs, cf->temp_pool, 2,
@@ -364,6 +368,7 @@ ngx_stream_optimize_servers(ngx_conf_t *
             ls->addr_ntop = 1;
             ls->handler = ngx_stream_init_connection;
             ls->pool_size = 256;
+            ls->type = addr[i].opt.type;
 
             cscf = addr->opt.ctx->srv_conf[ngx_stream_core_module.ctx_index];
 
@@ -373,6 +378,8 @@ ngx_stream_optimize_servers(ngx_conf_t *
 
             ls->backlog = addr[i].opt.backlog;
 
+            ls->wildcard = addr[i].opt.wildcard;
+
             ls->keepalive = addr[i].opt.so_keepalive;
 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
             ls->keepidle = addr[i].opt.tcp_keepidle;