fix divide by zero if max_fails=0

This commit is contained in:
Igor Sysoev 2008-08-26 14:34:16 +00:00
parent c9491d113c
commit 333723e001

View File

@ -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",