comparison src/http/ngx_http_upstream_round_robin.c @ 634:23ef0645ea57 NGINX_1_1_1

nginx 1.1.1 *) Change: now cache loader processes either as many files as specified by "loader_files" parameter or works no more than time specified by "loader_threshold" parameter during each iteration. *) Change: now SIGWINCH signal works only in deamon mode. *) Feature: now shared zones and caches use POSIX semaphores on Solaris. Thanks to Den Ivanov. *) Feature: accept filters are now supported on NetBSD. *) Bugfix: nginx could not be build on Linux 3.0. *) Bugfix: nginx did not use gzipping in some cases; the bug had appeared in 1.1.0. *) Bugfix: request body might be incorrectly processed if client used pipelining. *) Bugfix: in the "request_body_in_single_buf" directive. *) Bugfix: in "proxy_set_body" and "proxy_pass_request_body" directives if SSL connection to backend was used. *) Bugfix: nginx hogged CPU if all servers in an upstream were marked as "down". *) Bugfix: a segmentation fault might occur during reconfiguration if ssl_session_cache was defined but not used in a previous configuration. *) Bugfix: a segmentation fault might occur in a worker process if many backup servers were used in an upstream. *) Bugfix: a segmentation fault might occur in a worker process if "fastcgi/scgi/uwsgi_param" directives were used with values starting with "HTTP_"; the bug had appeared in 0.8.40.
author Igor Sysoev <http://sysoev.ru>
date Mon, 22 Aug 2011 00:00:00 +0400
parents 5b73504dd4ba
children 6f21ae02fb01
comparison
equal deleted inserted replaced
633:561a37709f6d 634:23ef0645ea57
226 } 226 }
227 227
228 rrp->peers = us->peer.data; 228 rrp->peers = us->peer.data;
229 rrp->current = 0; 229 rrp->current = 0;
230 230
231 if (rrp->peers->number <= 8 * sizeof(uintptr_t)) { 231 n = rrp->peers->number;
232
233 if (rrp->peers->next && rrp->peers->next->number > n) {
234 n = rrp->peers->next->number;
235 }
236
237 if (n <= 8 * sizeof(uintptr_t)) {
232 rrp->tried = &rrp->data; 238 rrp->tried = &rrp->data;
233 rrp->data = 0; 239 rrp->data = 0;
234 240
235 } else { 241 } else {
236 n = (rrp->peers->number + (8 * sizeof(uintptr_t) - 1)) 242 n = (n + (8 * sizeof(uintptr_t) - 1)) / (8 * sizeof(uintptr_t));
237 / (8 * sizeof(uintptr_t));
238 243
239 rrp->tried = ngx_pcalloc(r->pool, n * sizeof(uintptr_t)); 244 rrp->tried = ngx_pcalloc(r->pool, n * sizeof(uintptr_t));
240 if (rrp->tried == NULL) { 245 if (rrp->tried == NULL) {
241 return NGX_ERROR; 246 return NGX_ERROR;
242 } 247 }
583 588
584 589
585 static ngx_uint_t 590 static ngx_uint_t
586 ngx_http_upstream_get_peer(ngx_http_upstream_rr_peers_t *peers) 591 ngx_http_upstream_get_peer(ngx_http_upstream_rr_peers_t *peers)
587 { 592 {
588 ngx_uint_t i, n; 593 ngx_uint_t i, n, reset = 0;
589 ngx_http_upstream_rr_peer_t *peer; 594 ngx_http_upstream_rr_peer_t *peer;
590 595
591 peer = &peers->peer[0]; 596 peer = &peers->peer[0];
592 597
593 for ( ;; ) { 598 for ( ;; ) {
622 } 627 }
623 628
624 return n; 629 return n;
625 } 630 }
626 631
632 if (reset++) {
633 return 0;
634 }
635
627 for (i = 0; i < peers->number; i++) { 636 for (i = 0; i < peers->number; i++) {
628 peer[i].current_weight = peer[i].weight; 637 peer[i].current_weight = peer[i].weight;
629 } 638 }
630 } 639 }
631 } 640 }