comparison src/http/modules/ngx_http_limit_zone_module.c @ 2716:d5896f6608e8

move zone name from ngx_shm_zone_t to ngx_shm_t to use Win32 shared memory
author Igor Sysoev <igor@sysoev.ru>
date Thu, 16 Apr 2009 19:25:09 +0000
parents 038dc63b657a
children b3b8c66bd520
comparison
equal deleted inserted replaced
2715:a5845475a903 2716:d5896f6608e8
189 189
190 ngx_shmtx_unlock(&shpool->mutex); 190 ngx_shmtx_unlock(&shpool->mutex);
191 191
192 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 192 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
193 "limiting connections by zone \"%V\"", 193 "limiting connections by zone \"%V\"",
194 &lzcf->shm_zone->name); 194 &lzcf->shm_zone->shm.name);
195 195
196 return NGX_HTTP_SERVICE_UNAVAILABLE; 196 return NGX_HTTP_SERVICE_UNAVAILABLE;
197 } 197 }
198 198
199 node = (rc < 0) ? node->left : node->right; 199 node = (rc < 0) ? node->left : node->right;
326 if (octx) { 326 if (octx) {
327 if (ngx_strcmp(ctx->var.data, octx->var.data) != 0) { 327 if (ngx_strcmp(ctx->var.data, octx->var.data) != 0) {
328 ngx_log_error(NGX_LOG_EMERG, shm_zone->shm.log, 0, 328 ngx_log_error(NGX_LOG_EMERG, shm_zone->shm.log, 0,
329 "limit_zone \"%V\" uses the \"%V\" variable " 329 "limit_zone \"%V\" uses the \"%V\" variable "
330 "while previously it used the \"%V\" variable", 330 "while previously it used the \"%V\" variable",
331 &shm_zone->name, &ctx->var, &octx->var); 331 &shm_zone->shm.name, &ctx->var, &octx->var);
332 return NGX_ERROR; 332 return NGX_ERROR;
333 } 333 }
334 334
335 ctx->rbtree = octx->rbtree; 335 ctx->rbtree = octx->rbtree;
336 336
350 } 350 }
351 351
352 ngx_rbtree_init(ctx->rbtree, sentinel, 352 ngx_rbtree_init(ctx->rbtree, sentinel,
353 ngx_http_limit_zone_rbtree_insert_value); 353 ngx_http_limit_zone_rbtree_insert_value);
354 354
355 len = sizeof(" in limit_zone \"\"") + shm_zone->name.len; 355 len = sizeof(" in limit_zone \"\"") + shm_zone->shm.name.len;
356 356
357 shpool->log_ctx = ngx_slab_alloc(shpool, len); 357 shpool->log_ctx = ngx_slab_alloc(shpool, len);
358 if (shpool->log_ctx == NULL) { 358 if (shpool->log_ctx == NULL) {
359 return NGX_ERROR; 359 return NGX_ERROR;
360 } 360 }
361 361
362 ngx_sprintf(shpool->log_ctx, " in limit_zone \"%V\"%Z", &shm_zone->name); 362 ngx_sprintf(shpool->log_ctx, " in limit_zone \"%V\"%Z",
363 &shm_zone->shm.name);
363 364
364 return NGX_OK; 365 return NGX_OK;
365 } 366 }
366 367
367 368