comparison 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
comparison
equal deleted inserted replaced
6196:c3ec43580a48 6197:0dcef374b8bb
145 c->log->action = "initializing connection"; 145 c->log->action = "initializing connection";
146 c->log_error = NGX_ERROR_INFO; 146 c->log_error = NGX_ERROR_INFO;
147 147
148 cmcf = ngx_stream_get_module_main_conf(s, ngx_stream_core_module); 148 cmcf = ngx_stream_get_module_main_conf(s, ngx_stream_core_module);
149 149
150 if (cmcf->limit_conn_handler) {
151 rc = cmcf->limit_conn_handler(s);
152
153 if (rc != NGX_DECLINED) {
154 ngx_stream_close_connection(c);
155 return;
156 }
157 }
158
150 if (cmcf->access_handler) { 159 if (cmcf->access_handler) {
151 rc = cmcf->access_handler(s); 160 rc = cmcf->access_handler(s);
152 161
153 if (rc != NGX_OK && rc != NGX_DECLINED) { 162 if (rc != NGX_OK && rc != NGX_DECLINED) {
154 ngx_stream_close_connection(c); 163 ngx_stream_close_connection(c);