From 1a344ced38056d75f87c85ada6aacd1f29fff446 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 10 Oct 2007 13:58:47 +0000 Subject: [PATCH] optimization --- src/http/ngx_http_upstream_round_robin.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c index a2b269d92..6b612b67a 100644 --- a/src/http/ngx_http_upstream_round_robin.c +++ b/src/http/ngx_http_upstream_round_robin.c @@ -167,17 +167,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, peers->number = n; peers->name = &us->host; - n = 0; - for (i = 0; i < u.naddrs; i++) { - peers->peer[n].sockaddr = u.addrs[i].sockaddr; - peers->peer[n].socklen = u.addrs[i].socklen; - peers->peer[n].name = u.addrs[i].name; - peers->peer[n].weight = 1; - peers->peer[n].current_weight = 1; - peers->peer[n].max_fails = 1; - peers->peer[n].fail_timeout = 10; - n++; + peers->peer[i].sockaddr = u.addrs[i].sockaddr; + peers->peer[i].socklen = u.addrs[i].socklen; + peers->peer[i].name = u.addrs[i].name; + peers->peer[i].weight = 1; + peers->peer[i].current_weight = 1; + peers->peer[i].max_fails = 1; + peers->peer[i].fail_timeout = 10; } us->peer.data = peers;