comparison src/stream/ngx_stream.c @ 6152:3c344ea7d88b

Simplified ngx_http_init_listening(). There is no need to set "i" to 0, as it's expected to be 0 assuming the bindings are properly sorted, and we already rely on this when explicitly set hport->naddrs to 1. Remaining conditional code is replaced with identical "hport->naddrs = i + 1". Identical modifications are done in the mail and stream modules, in the ngx_mail_optimize_servers() and ngx_stream_optimize_servers() functions, respectively. No functional changes.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 20 May 2015 15:51:28 +0300
parents 187aa751ad62
children 4f6efabcb09b
comparison
equal deleted inserted replaced
6151:b4cc553aafeb 6152:3c344ea7d88b
391 return NGX_CONF_ERROR; 391 return NGX_CONF_ERROR;
392 } 392 }
393 393
394 ls->servers = stport; 394 ls->servers = stport;
395 395
396 if (i == last - 1) { 396 stport->naddrs = i + 1;
397 stport->naddrs = last;
398
399 } else {
400 stport->naddrs = 1;
401 i = 0;
402 }
403 397
404 switch (ls->sockaddr->sa_family) { 398 switch (ls->sockaddr->sa_family) {
405 #if (NGX_HAVE_INET6) 399 #if (NGX_HAVE_INET6)
406 case AF_INET6: 400 case AF_INET6:
407 if (ngx_stream_add_addrs6(cf, stport, addr) != NGX_OK) { 401 if (ngx_stream_add_addrs6(cf, stport, addr) != NGX_OK) {