comparison src/http/modules/ngx_http_limit_zone_module.c @ 468:56baf312c1b5 NGINX_0_7_46

nginx 0.7.46 *) Bugfix: the previous release tarball was incorrect.
author Igor Sysoev <http://sysoev.ru>
date Mon, 30 Mar 2009 00:00:00 +0400
parents e7dbea1ee115
children 549994537f15
comparison
equal deleted inserted replaced
467:d46142e61c30 468:56baf312c1b5
208 + len; 208 + len;
209 209
210 node = ngx_slab_alloc_locked(shpool, n); 210 node = ngx_slab_alloc_locked(shpool, n);
211 if (node == NULL) { 211 if (node == NULL) {
212 ngx_shmtx_unlock(&shpool->mutex); 212 ngx_shmtx_unlock(&shpool->mutex);
213
214 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
215 "could not allocate memory in zone \"%V\"",
216 &lzcf->shm_zone->name);
217
218 return NGX_HTTP_SERVICE_UNAVAILABLE; 213 return NGX_HTTP_SERVICE_UNAVAILABLE;
219 } 214 }
220 215
221 lz = (ngx_http_limit_zone_node_t *) &node->color; 216 lz = (ngx_http_limit_zone_node_t *) &node->color;
222 217
319 static ngx_int_t 314 static ngx_int_t
320 ngx_http_limit_zone_init_zone(ngx_shm_zone_t *shm_zone, void *data) 315 ngx_http_limit_zone_init_zone(ngx_shm_zone_t *shm_zone, void *data)
321 { 316 {
322 ngx_http_limit_zone_ctx_t *octx = data; 317 ngx_http_limit_zone_ctx_t *octx = data;
323 318
319 size_t len;
324 ngx_slab_pool_t *shpool; 320 ngx_slab_pool_t *shpool;
325 ngx_rbtree_node_t *sentinel; 321 ngx_rbtree_node_t *sentinel;
326 ngx_http_limit_zone_ctx_t *ctx; 322 ngx_http_limit_zone_ctx_t *ctx;
327 323
328 ctx = shm_zone->data; 324 ctx = shm_zone->data;
354 } 350 }
355 351
356 ngx_rbtree_init(ctx->rbtree, sentinel, 352 ngx_rbtree_init(ctx->rbtree, sentinel,
357 ngx_http_limit_zone_rbtree_insert_value); 353 ngx_http_limit_zone_rbtree_insert_value);
358 354
355 len = sizeof(" in limit_zone \"\"") + shm_zone->name.len;
356
357 shpool->log_ctx = ngx_slab_alloc(shpool, len);
358 if (shpool->log_ctx == NULL) {
359 return NGX_ERROR;
360 }
361
362 ngx_sprintf(shpool->log_ctx, " in limit_zone \"%V\"%Z", &shm_zone->name);
363
359 return NGX_OK; 364 return NGX_OK;
360 } 365 }
361 366
362 367
363 static void * 368 static void *