Mercurial > hg > nginx
comparison src/http/ngx_http_upstream_round_robin.c @ 2204:70a2bcc7e307
fix divide by zero if max_fails=0
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 26 Aug 2008 14:34:16 +0000 |
parents | 74477ea8074f |
children | 7af1e5fe102c |
comparison
equal
deleted
inserted
replaced
2203:8e5bf1bc87e2 | 2204:70a2bcc7e307 |
---|---|
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 |