aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGu Feng <flygoast@126.com>2014-10-27 19:52:03 +0800
committerGu Feng <flygoast@126.com>2014-10-27 19:52:03 +0800
commit726c5726fb0a58b9eb567d0a7f3e9b56339959e9 (patch)
treeae52e80cb2f877e25113ebb6574a7573b68b2ce5 /src
parentcf1e4781a9c0efd2c057096191ece4c79d3a0edd (diff)
downloadnginx-726c5726fb0a58b9eb567d0a7f3e9b56339959e9.tar.gz
nginx-726c5726fb0a58b9eb567d0a7f3e9b56339959e9.zip
Upstream: limited next_upstream time and tries when resolving DNS.
When got multiple upstream IP addresses using DNS resolving, the number of upstreams tries and the maxinum time spent for these tries were not affected. This patch fixed it.
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_upstream.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index c5070a07e..3e8ce09e1 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -981,6 +981,14 @@ ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx)
ngx_resolve_name_done(ctx);
ur->ctx = NULL;
+ u->peer.start_time = ngx_current_msec;
+
+ if (u->conf->next_upstream_tries
+ && u->peer.tries > u->conf->next_upstream_tries)
+ {
+ u->peer.tries = u->conf->next_upstream_tries;
+ }
+
ngx_http_upstream_connect(r, u);
failed: