Mercurial > hg > nginx
diff src/stream/ngx_stream_handler.c @ 6197:0dcef374b8bb
Stream: connection limiting module.
stream {
limit_conn_zone $binary_remote_addr zone=perip:1m;
limit_conn_log_level error;
server {
...
limit_conn perip 1;
}
}
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 18 Jun 2015 14:17:30 +0300 |
parents | 8807a2369b1a |
children | 7565e056fad6 |
line wrap: on
line diff
--- a/src/stream/ngx_stream_handler.c +++ b/src/stream/ngx_stream_handler.c @@ -147,6 +147,15 @@ ngx_stream_init_connection(ngx_connectio cmcf = ngx_stream_get_module_main_conf(s, ngx_stream_core_module); + if (cmcf->limit_conn_handler) { + rc = cmcf->limit_conn_handler(s); + + if (rc != NGX_DECLINED) { + ngx_stream_close_connection(c); + return; + } + } + if (cmcf->access_handler) { rc = cmcf->access_handler(s);