comparison src/http/ngx_http_upstream_round_robin.c @ 644:6f21ae02fb01 NGINX_1_1_6

nginx 1.1.6 *) Change in internal API: now module context data are cleared while internal redirect to named location. Requested by Yichun Zhang. *) Change: if a server in an upstream failed, only one request will be sent to it after fail_timeout; the server will be considered alive if it will successfully respond to the request. *) Change: now the 0x7F-0x1F characters are escaped as \xXX in an access_log. *) Feature: "proxy/fastcgi/scgi/uwsgi_ignore_headers" directives support the following additional values: X-Accel-Limit-Rate, X-Accel-Buffering, X-Accel-Charset. *) Feature: decrease of memory consumption if SSL is used. *) Bugfix: some UTF-8 characters were processed incorrectly. Thanks to Alexey Kuts. *) Bugfix: the ngx_http_rewrite_module directives specified at "server" level were executed twice if no matching locations were defined. *) Bugfix: a socket leak might occurred if "aio sendfile" was used. *) Bugfix: connections with fast clients might be closed after send_timeout if file AIO was used. *) Bugfix: in the ngx_http_autoindex_module. *) Bugfix: the module ngx_http_mp4_module did not support seeking on 32-bit platforms.
author Igor Sysoev <http://sysoev.ru>
date Mon, 17 Oct 2011 00:00:00 +0400
parents 23ef0645ea57
children d0f7a625f27c
comparison
equal deleted inserted replaced
643:a4bb0b481f6c 644:6f21ae02fb01
441 || peer->fails < peer->max_fails) 441 || peer->fails < peer->max_fails)
442 { 442 {
443 break; 443 break;
444 } 444 }
445 445
446 if (now - peer->accessed > peer->fail_timeout) { 446 if (now - peer->checked > peer->fail_timeout) {
447 peer->fails = 0; 447 peer->checked = now;
448 break; 448 break;
449 } 449 }
450 450
451 peer->current_weight = 0; 451 peer->current_weight = 0;
452 452
489 || peer->fails < peer->max_fails) 489 || peer->fails < peer->max_fails)
490 { 490 {
491 break; 491 break;
492 } 492 }
493 493
494 if (now - peer->accessed > peer->fail_timeout) { 494 if (now - peer->checked > peer->fail_timeout) {
495 peer->fails = 0; 495 peer->checked = now;
496 break; 496 break;
497 } 497 }
498 498
499 peer->current_weight = 0; 499 peer->current_weight = 0;
500 500
661 if (rrp->peers->single) { 661 if (rrp->peers->single) {
662 pc->tries = 0; 662 pc->tries = 0;
663 return; 663 return;
664 } 664 }
665 665
666 peer = &rrp->peers->peer[rrp->current];
667
666 if (state & NGX_PEER_FAILED) { 668 if (state & NGX_PEER_FAILED) {
667 now = ngx_time(); 669 now = ngx_time();
668 670
669 peer = &rrp->peers->peer[rrp->current];
670
671 /* ngx_lock_mutex(rrp->peers->mutex); */ 671 /* ngx_lock_mutex(rrp->peers->mutex); */
672 672
673 peer->fails++; 673 peer->fails++;
674 peer->accessed = now; 674 peer->accessed = now;
675 peer->checked = now;
675 676
676 if (peer->max_fails) { 677 if (peer->max_fails) {
677 peer->current_weight -= peer->weight / peer->max_fails; 678 peer->current_weight -= peer->weight / peer->max_fails;
678 } 679 }
679 680
684 if (peer->current_weight < 0) { 685 if (peer->current_weight < 0) {
685 peer->current_weight = 0; 686 peer->current_weight = 0;
686 } 687 }
687 688
688 /* ngx_unlock_mutex(rrp->peers->mutex); */ 689 /* ngx_unlock_mutex(rrp->peers->mutex); */
690
691 } else {
692
693 /* mark peer live if check passed */
694
695 if (peer->accessed < peer->checked) {
696 peer->fails = 0;
697 }
689 } 698 }
690 699
691 rrp->current++; 700 rrp->current++;
692 701
693 if (rrp->current >= rrp->peers->number) { 702 if (rrp->current >= rrp->peers->number) {