aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_upstream_round_robin.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2012-12-25 08:02:21 +0000
committerValentin Bartenev <vbart@nginx.com>2012-12-25 08:02:21 +0000
commitdd46cc659afe2fc947fc35b22fdd00ae9dd09ff7 (patch)
treea80d73087e77d3369133ea8af74dabe185ce4ccf /src/http/ngx_http_upstream_round_robin.c
parentcb90df084f417f0aa2d9adc96124b22c655cf67b (diff)
downloadnginx-dd46cc659afe2fc947fc35b22fdd00ae9dd09ff7.tar.gz
nginx-dd46cc659afe2fc947fc35b22fdd00ae9dd09ff7.zip
Upstream: fixed state resetting when switching to backup servers.
Based on patch by Thomas Chen (ticket #257).
Diffstat (limited to 'src/http/ngx_http_upstream_round_robin.c')
-rw-r--r--src/http/ngx_http_upstream_round_robin.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
index 4b78cffd8..61dce69cb 100644
--- a/src/http/ngx_http_upstream_round_robin.c
+++ b/src/http/ngx_http_upstream_round_robin.c
@@ -474,7 +474,9 @@ failed:
rrp->peers = peers->next;
pc->tries = rrp->peers->number;
- n = rrp->peers->number / (8 * sizeof(uintptr_t)) + 1;
+ n = (rrp->peers->number + (8 * sizeof(uintptr_t) - 1))
+ / (8 * sizeof(uintptr_t));
+
for (i = 0; i < n; i++) {
rrp->tried[i] = 0;
}