diff options
author | Igor Sysoev <igor@sysoev.ru> | 2008-08-26 14:34:16 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2008-08-26 14:34:16 +0000 |
commit | 333723e0012e33fda92dfff420e2f917f8988318 (patch) | |
tree | 07fd8aacb331109ca5f4f31063be35f76967fdf3 /src | |
parent | c9491d113c47b36fec61c37b9c66905f097d92cb (diff) | |
download | nginx-333723e0012e33fda92dfff420e2f917f8988318.tar.gz nginx-333723e0012e33fda92dfff420e2f917f8988318.zip |
fix divide by zero if max_fails=0
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_upstream_round_robin.c | 4 |
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 d9450c95c..2479baa78 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", |