comparison src/http/ngx_http.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 69ad3e77922b
children 4f6efabcb09b
comparison
equal deleted inserted replaced
6151:b4cc553aafeb 6152:3c344ea7d88b
1717 return NGX_ERROR; 1717 return NGX_ERROR;
1718 } 1718 }
1719 1719
1720 ls->servers = hport; 1720 ls->servers = hport;
1721 1721
1722 if (i == last - 1) { 1722 hport->naddrs = i + 1;
1723 hport->naddrs = last;
1724
1725 } else {
1726 hport->naddrs = 1;
1727 i = 0;
1728 }
1729 1723
1730 switch (ls->sockaddr->sa_family) { 1724 switch (ls->sockaddr->sa_family) {
1731 1725
1732 #if (NGX_HAVE_INET6) 1726 #if (NGX_HAVE_INET6)
1733 case AF_INET6: 1727 case AF_INET6: