diff 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
line wrap: on
line diff
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -1719,13 +1719,7 @@ ngx_http_init_listening(ngx_conf_t *cf, 
 
         ls->servers = hport;
 
-        if (i == last - 1) {
-            hport->naddrs = last;
-
-        } else {
-            hport->naddrs = 1;
-            i = 0;
-        }
+        hport->naddrs = i + 1;
 
         switch (ls->sockaddr->sa_family) {