comparison src/http/modules/ngx_http_limit_zone_module.c @ 2611:2bce3f6416c6

improve ngx_slab_alloc() error logging
author Igor Sysoev <igor@sysoev.ru>
date Fri, 27 Mar 2009 17:00:42 +0000
parents f4603d71f532
children 038dc63b657a
comparison
equal deleted inserted replaced
2610:3a9b22405138 2611:2bce3f6416c6
319 static ngx_int_t 319 static ngx_int_t
320 ngx_http_limit_zone_init_zone(ngx_shm_zone_t *shm_zone, void *data) 320 ngx_http_limit_zone_init_zone(ngx_shm_zone_t *shm_zone, void *data)
321 { 321 {
322 ngx_http_limit_zone_ctx_t *octx = data; 322 ngx_http_limit_zone_ctx_t *octx = data;
323 323
324 size_t len;
324 ngx_slab_pool_t *shpool; 325 ngx_slab_pool_t *shpool;
325 ngx_rbtree_node_t *sentinel; 326 ngx_rbtree_node_t *sentinel;
326 ngx_http_limit_zone_ctx_t *ctx; 327 ngx_http_limit_zone_ctx_t *ctx;
327 328
328 ctx = shm_zone->data; 329 ctx = shm_zone->data;
354 } 355 }
355 356
356 ngx_rbtree_init(ctx->rbtree, sentinel, 357 ngx_rbtree_init(ctx->rbtree, sentinel,
357 ngx_http_limit_zone_rbtree_insert_value); 358 ngx_http_limit_zone_rbtree_insert_value);
358 359
360 len = sizeof(" in limit_zone \"\"") + shm_zone->name.len;
361
362 shpool->log_ctx = ngx_slab_alloc(shpool, len);
363 if (shpool->log_ctx == NULL) {
364 return NGX_ERROR;
365 }
366
367 ngx_sprintf(shpool->log_ctx, " in limit_zone \"%V\"%Z", &shm_zone->name);
368
359 return NGX_OK; 369 return NGX_OK;
360 } 370 }
361 371
362 372
363 static void * 373 static void *