summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-11-20 17:16:39 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-11-20 17:16:39 +0000
commitabb54176a2e3ffd84fcbb50735dcb14b3c97f389 (patch)
tree53b0c5e11664c61fdd803485092c64b79c8550a6 /src
parent85739a44d763d88e8213610934900b8a6b849b2c (diff)
downloadnginx-abb54176a2e3ffd84fcbb50735dcb14b3c97f389.tar.gz
nginx-abb54176a2e3ffd84fcbb50735dcb14b3c97f389.tar.bz2
r2205 merge:
fix divide by zero if max_fails=0
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_upstream_round_robin.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
index 062137158..c6541a33c 100644
--- a/src/http/ngx_http_upstream_round_robin.c
+++ b/src/http/ngx_http_upstream_round_robin.c
@@ -645,7 +645,9 @@ ngx_http_upstream_free_round_robin_peer(ngx_peer_connection_t *pc, void *data,
peer->fails++;
peer->accessed = now;
- peer->current_weight -= peer->weight / peer->max_fails;
+ if (peer->max_fails) {
+ peer->current_weight -= peer->weight / peer->max_fails;
+ }
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0,
"free rr peer failed: %ui %i",