comparison 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
comparison
equal deleted inserted replaced
6435:d1c791479bbb 6436:8f038068f4bc
273 break; 273 break;
274 } 274 }
275 275
276 port = ports->elts; 276 port = ports->elts;
277 for (i = 0; i < ports->nelts; i++) { 277 for (i = 0; i < ports->nelts; i++) {
278 if (p == port[i].port && sa->sa_family == port[i].family) { 278
279 279 if (p == port[i].port
280 && listen->type == port[i].type
281 && sa->sa_family == port[i].family)
282 {
280 /* a port is already in the port list */ 283 /* a port is already in the port list */
281 284
282 port = &port[i]; 285 port = &port[i];
283 goto found; 286 goto found;
284 } 287 }
290 if (port == NULL) { 293 if (port == NULL) {
291 return NGX_ERROR; 294 return NGX_ERROR;
292 } 295 }
293 296
294 port->family = sa->sa_family; 297 port->family = sa->sa_family;
298 port->type = listen->type;
295 port->port = p; 299 port->port = p;
296 300
297 if (ngx_array_init(&port->addrs, cf->temp_pool, 2, 301 if (ngx_array_init(&port->addrs, cf->temp_pool, 2,
298 sizeof(ngx_stream_conf_addr_t)) 302 sizeof(ngx_stream_conf_addr_t))
299 != NGX_OK) 303 != NGX_OK)
362 } 366 }
363 367
364 ls->addr_ntop = 1; 368 ls->addr_ntop = 1;
365 ls->handler = ngx_stream_init_connection; 369 ls->handler = ngx_stream_init_connection;
366 ls->pool_size = 256; 370 ls->pool_size = 256;
371 ls->type = addr[i].opt.type;
367 372
368 cscf = addr->opt.ctx->srv_conf[ngx_stream_core_module.ctx_index]; 373 cscf = addr->opt.ctx->srv_conf[ngx_stream_core_module.ctx_index];
369 374
370 ls->logp = cscf->error_log; 375 ls->logp = cscf->error_log;
371 ls->log.data = &ls->addr_text; 376 ls->log.data = &ls->addr_text;
372 ls->log.handler = ngx_accept_log_error; 377 ls->log.handler = ngx_accept_log_error;
373 378
374 ls->backlog = addr[i].opt.backlog; 379 ls->backlog = addr[i].opt.backlog;
380
381 ls->wildcard = addr[i].opt.wildcard;
375 382
376 ls->keepalive = addr[i].opt.so_keepalive; 383 ls->keepalive = addr[i].opt.so_keepalive;
377 #if (NGX_HAVE_KEEPALIVE_TUNABLE) 384 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
378 ls->keepidle = addr[i].opt.tcp_keepidle; 385 ls->keepidle = addr[i].opt.tcp_keepidle;
379 ls->keepintvl = addr[i].opt.tcp_keepintvl; 386 ls->keepintvl = addr[i].opt.tcp_keepintvl;