diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-01-09 15:59:20 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-01-09 15:59:20 +0000 |
| commit | 4e77a2bb83260015bd60156916178f0eb658da82 (patch) | |
| tree | edc252404be7793cf28b9ecf5a67daa9293b02b9 /src/http/modules | |
| parent | 1691aaf290e90da6206b3ca5eea53676764f8432 (diff) | |
| download | nginx-4e77a2bb83260015bd60156916178f0eb658da82.tar.gz nginx-4e77a2bb83260015bd60156916178f0eb658da82.tar.bz2 | |
pass the inherited shm_zone data
Diffstat (limited to 'src/http/modules')
| -rw-r--r-- | src/http/modules/ngx_http_limit_zone_module.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/http/modules/ngx_http_limit_zone_module.c b/src/http/modules/ngx_http_limit_zone_module.c index c2b44ccea..07802581c 100644 --- a/src/http/modules/ngx_http_limit_zone_module.c +++ b/src/http/modules/ngx_http_limit_zone_module.c @@ -247,15 +247,32 @@ ngx_http_limit_zone_cleanup(void *data) static ngx_int_t -ngx_http_limit_zone_init_zone(ngx_shm_zone_t *shm_zone) +ngx_http_limit_zone_init_zone(ngx_shm_zone_t *shm_zone, void *data) { + ngx_http_limit_zone_ctx_t *octx = data; + ngx_slab_pool_t *shpool; ngx_rbtree_node_t *sentinel; ngx_http_limit_zone_ctx_t *ctx; - shpool = (ngx_slab_pool_t *) shm_zone->shm.addr; ctx = shm_zone->data; + if (octx) { + if (ngx_strcmp(ctx->var.data, octx->var.data) != 0) { + ngx_log_error(NGX_LOG_EMERG, shm_zone->shm.log, 0, + "limit_zone \"%V\" use the \"%V\" variable " + "while previously it used the \"%V\" variable", + &shm_zone->name, &ctx->var, &octx->var); + return NGX_ERROR; + } + + ctx->rbtree = octx->rbtree; + + return NGX_OK; + } + + shpool = (ngx_slab_pool_t *) shm_zone->shm.addr; + ctx->rbtree = ngx_slab_alloc(shpool, sizeof(ngx_rbtree_t)); if (ctx->rbtree == NULL) { return NGX_ERROR; |
