count connection once per request

This commit is contained in:
Igor Sysoev 2007-01-07 17:47:17 +00:00
parent d5ca16cdd4
commit 6eee80156f
2 changed files with 12 additions and 0 deletions

View File

@ -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);

View File

@ -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