Mercurial > hg > nginx
comparison src/http/ngx_http_upstream_round_robin.c @ 2325:50be8dd53d5e stable-0.6
r2205 merge:
fix divide by zero if max_fails=0
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 20 Nov 2008 17:16:39 +0000 |
parents | cb8c0c8e0c27 |
children |
comparison
equal
deleted
inserted
replaced
2324:9e219f02594c | 2325:50be8dd53d5e |
---|---|
643 /* ngx_lock_mutex(rrp->peers->mutex); */ | 643 /* ngx_lock_mutex(rrp->peers->mutex); */ |
644 | 644 |
645 peer->fails++; | 645 peer->fails++; |
646 peer->accessed = now; | 646 peer->accessed = now; |
647 | 647 |
648 peer->current_weight -= peer->weight / peer->max_fails; | 648 if (peer->max_fails) { |
649 peer->current_weight -= peer->weight / peer->max_fails; | |
650 } | |
649 | 651 |
650 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, | 652 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, |
651 "free rr peer failed: %ui %i", | 653 "free rr peer failed: %ui %i", |
652 rrp->current, peer->current_weight); | 654 rrp->current, peer->current_weight); |
653 | 655 |