aboutsummaryrefslogtreecommitdiff
path: root/src/stream/ngx_stream_upstream_hash_module.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2016-09-22 19:32:47 +0300
committerRuslan Ermilov <ru@nginx.com>2016-09-22 19:32:47 +0300
commitf674f32c09c9938d5f2b19509166e5c5e28a9e3c (patch)
tree225a53166111dd4f818b83a4d603aab4d187e52e /src/stream/ngx_stream_upstream_hash_module.c
parentfd9e74f656b3a7683424304da3bc859988407acf (diff)
downloadnginx-f674f32c09c9938d5f2b19509166e5c5e28a9e3c.tar.gz
nginx-f674f32c09c9938d5f2b19509166e5c5e28a9e3c.zip
Upstream: max_conns.
Diffstat (limited to 'src/stream/ngx_stream_upstream_hash_module.c')
-rw-r--r--src/stream/ngx_stream_upstream_hash_module.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/stream/ngx_stream_upstream_hash_module.c b/src/stream/ngx_stream_upstream_hash_module.c
index 0952f330a..cb44fcdad 100644
--- a/src/stream/ngx_stream_upstream_hash_module.c
+++ b/src/stream/ngx_stream_upstream_hash_module.c
@@ -241,6 +241,10 @@ ngx_stream_upstream_get_hash_peer(ngx_peer_connection_t *pc, void *data)
goto next;
}
+ if (peer->max_conns && peer->conns >= peer->max_conns) {
+ goto next;
+ }
+
break;
next:
@@ -549,6 +553,10 @@ ngx_stream_upstream_get_chash_peer(ngx_peer_connection_t *pc, void *data)
continue;
}
+ if (peer->max_conns && peer->conns >= peer->max_conns) {
+ continue;
+ }
+
peer->current_weight += peer->effective_weight;
total += peer->effective_weight;
@@ -646,6 +654,7 @@ ngx_stream_upstream_hash(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
uscf->flags = NGX_STREAM_UPSTREAM_CREATE
|NGX_STREAM_UPSTREAM_WEIGHT
+ |NGX_STREAM_UPSTREAM_MAX_CONNS
|NGX_STREAM_UPSTREAM_MAX_FAILS
|NGX_STREAM_UPSTREAM_FAIL_TIMEOUT
|NGX_STREAM_UPSTREAM_DOWN;