comparison src/http/ngx_http_upstream_round_robin.c @ 634:0d6525917227 NGINX_1_0_7

nginx 1.0.7 *) Change: now if total size of all ranges is greater than source response size, then nginx disables ranges and returns just the source response. *) Feature: the "max_ranges" directive. *) Feature: the module ngx_http_mp4_module. *) Feature: the "worker_aio_requests" directive. *) Bugfix: if nginx was built --with-file-aio it could not be run on Linux kernel which did not support AIO. *) Bugfix: in Linux AIO error processing. Thanks to Hagai Avrahami. *) Bugfix: in Linux AIO combined with open_file_cache. *) Bugfix: open_file_cache did not update file info on retest if file was not atomically changed. *) Bugfix: reduced memory consumption for long-lived requests. *) Bugfix: in the "proxy/fastcgi/scgi/uwsgi_ignore_client_abort" directives. *) Bugfix: nginx could not be built on MacOSX 10.7. *) Bugfix: in the "proxy/fastcgi/scgi/uwsgi_ignore_client_abort" directives. *) Bugfix: request body might be processed incorrectly 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 previous configuration. *) Bugfix: a segmentation fault might occur in a worker process if many backup servers were used in an upstream.
author Igor Sysoev <http://sysoev.ru>
date Fri, 30 Sep 2011 00:00:00 +0400
parents 65fd8be45530
children ad25218fd14b
comparison
equal deleted inserted replaced
633:7c3c34755d2e 634:0d6525917227
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 }