[nginx] svn commit: r4992 - in trunk/src/http: . modules
vbart at nginx.com
vbart at nginx.com
Tue Dec 25 08:02:22 UTC 2012
Author: vbart
Date: 2012-12-25 08:02:21 +0000 (Tue, 25 Dec 2012)
New Revision: 4992
URL: http://trac.nginx.org/nginx/changeset/4992/nginx
Log:
Upstream: fixed state resetting when switching to backup servers.
Based on patch by Thomas Chen (ticket #257).
Modified:
trunk/src/http/modules/ngx_http_upstream_least_conn_module.c
trunk/src/http/ngx_http_upstream_round_robin.c
Modified: trunk/src/http/modules/ngx_http_upstream_least_conn_module.c
===================================================================
--- trunk/src/http/modules/ngx_http_upstream_least_conn_module.c 2012-12-24 17:32:53 UTC (rev 4991)
+++ trunk/src/http/modules/ngx_http_upstream_least_conn_module.c 2012-12-25 08:02:21 UTC (rev 4992)
@@ -313,7 +313,9 @@
lcp->rrp.peers = peers->next;
pc->tries = lcp->rrp.peers->number;
- n = lcp->rrp.peers->number / (8 * sizeof(uintptr_t)) + 1;
+ n = (lcp->rrp.peers->number + (8 * sizeof(uintptr_t) - 1))
+ / (8 * sizeof(uintptr_t));
+
for (i = 0; i < n; i++) {
lcp->rrp.tried[i] = 0;
}
Modified: trunk/src/http/ngx_http_upstream_round_robin.c
===================================================================
--- trunk/src/http/ngx_http_upstream_round_robin.c 2012-12-24 17:32:53 UTC (rev 4991)
+++ trunk/src/http/ngx_http_upstream_round_robin.c 2012-12-25 08:02:21 UTC (rev 4992)
@@ -474,7 +474,9 @@
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;
}
More information about the nginx-devel
mailing list