[nginx] svn commit: r5056 - in branches/stable-1.2: . src/http src/http/modules

mdounin at mdounin.ru mdounin at mdounin.ru
Mon Feb 11 14:56:16 UTC 2013


Author: mdounin
Date: 2013-02-11 14:56:14 +0000 (Mon, 11 Feb 2013)
New Revision: 5056
URL: http://trac.nginx.org/nginx/changeset/5056/nginx

Log:
Merge of r4992: off-by-one with 32/64 upstream backup servers.

Fixed off-by-one during upstream state resetting when switching to
backup servers if there were exactly 32 (64 on 64-bit platforms)
backup servers configured.

Based on patch by Thomas Chen (ticket #257).


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/http/modules/ngx_http_upstream_least_conn_module.c
   branches/stable-1.2/src/http/ngx_http_upstream_round_robin.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2013-02-11 14:39:49 UTC (rev 5055)
+++ branches/stable-1.2	2013-02-11 14:56:14 UTC (rev 5056)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4925,4933-4934,4939,4944-4949,4961-4969,4973-4974,4976-4991,4993-4994,4997,5000,5002,5011
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4925,4933-4934,4939,4944-4949,4961-4969,4973-4974,4976-4994,4997,5000,5002,5011
\ No newline at end of property
Modified: branches/stable-1.2/src/http/modules/ngx_http_upstream_least_conn_module.c
===================================================================
--- branches/stable-1.2/src/http/modules/ngx_http_upstream_least_conn_module.c	2013-02-11 14:39:49 UTC (rev 5055)
+++ branches/stable-1.2/src/http/modules/ngx_http_upstream_least_conn_module.c	2013-02-11 14:56:14 UTC (rev 5056)
@@ -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: branches/stable-1.2/src/http/ngx_http_upstream_round_robin.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_upstream_round_robin.c	2013-02-11 14:39:49 UTC (rev 5055)
+++ branches/stable-1.2/src/http/ngx_http_upstream_round_robin.c	2013-02-11 14:56:14 UTC (rev 5056)
@@ -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