Mercurial > hg > nginx
changeset 984:dd128232e6ba
count connection once per request
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 07 Jan 2007 17:47:17 +0000 |
parents | 7a8ca436d611 |
children | 36f70b8776e7 |
files | src/http/modules/ngx_http_limit_zone_module.c src/http/ngx_http_request.h |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_limit_zone_module.c Sun Jan 07 13:36:56 2007 +0000 +++ b/src/http/modules/ngx_http_limit_zone_module.c Sun Jan 07 17:47:17 2007 +0000 @@ -107,6 +107,10 @@ 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 @@ return NGX_DECLINED; } + r->limit_zone_set = 1; + len = vv->len; hash = ngx_crc32_short(vv->data, len);
--- a/src/http/ngx_http_request.h Sun Jan 07 13:36:56 2007 +0000 +++ b/src/http/ngx_http_request.h Sun Jan 07 17:47:17 2007 +0000 @@ -430,6 +430,12 @@ #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