mirror of
https://github.com/nginx/nginx.git
synced 2024-12-12 18:29:00 +08:00
count connection once per request
This commit is contained in:
parent
d5ca16cdd4
commit
6eee80156f
@ -107,6 +107,10 @@ ngx_http_limit_zone_handler(ngx_http_request_t *r)
|
||||
ngx_http_limit_zone_conf_t *lzcf;
|
||||
ngx_http_limit_zone_cleanup_t *lzcln;
|
||||
|
||||
if (r->limit_zone_set) {
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
lzcf = ngx_http_get_module_loc_conf(r, ngx_http_limit_zone_module);
|
||||
|
||||
if (lzcf->shm_zone == NULL) {
|
||||
@ -119,6 +123,8 @@ ngx_http_limit_zone_handler(ngx_http_request_t *r)
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
r->limit_zone_set = 1;
|
||||
|
||||
len = vv->len;
|
||||
|
||||
hash = ngx_crc32_short(vv->data, len);
|
||||
|
@ -430,6 +430,12 @@ struct ngx_http_request_s {
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* instead of using the request context data in ngx_http_limit_zone_module
|
||||
* we use the single bit in the request structure
|
||||
*/
|
||||
unsigned limit_zone_set:1;
|
||||
|
||||
#if 0
|
||||
unsigned cachable:1;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user