comparison src/http/modules/ngx_http_limit_req_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
222 ngx_http_limit_req_expire(ctx, 0); 222 ngx_http_limit_req_expire(ctx, 0);
223 223
224 node = ngx_slab_alloc_locked(ctx->shpool, n); 224 node = ngx_slab_alloc_locked(ctx->shpool, n);
225 if (node == NULL) { 225 if (node == NULL) {
226 ngx_shmtx_unlock(&ctx->shpool->mutex); 226 ngx_shmtx_unlock(&ctx->shpool->mutex);
227
228 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
229 "could not allocate memory in zone \"%V\"",
230 &lrcf->shm_zone->name);
231
232 return NGX_HTTP_SERVICE_UNAVAILABLE; 227 return NGX_HTTP_SERVICE_UNAVAILABLE;
233 } 228 }
234 } 229 }
235 230
236 lr = (ngx_http_limit_req_node_t *) &node->color; 231 lr = (ngx_http_limit_req_node_t *) &node->color;
455 static ngx_int_t 450 static ngx_int_t
456 ngx_http_limit_req_init_zone(ngx_shm_zone_t *shm_zone, void *data) 451 ngx_http_limit_req_init_zone(ngx_shm_zone_t *shm_zone, void *data)
457 { 452 {
458 ngx_http_limit_req_ctx_t *octx = data; 453 ngx_http_limit_req_ctx_t *octx = data;
459 454
455 size_t len;
460 ngx_rbtree_node_t *sentinel; 456 ngx_rbtree_node_t *sentinel;
461 ngx_http_limit_req_ctx_t *ctx; 457 ngx_http_limit_req_ctx_t *ctx;
462 458
463 ctx = shm_zone->data; 459 ctx = shm_zone->data;
464 460
498 return NGX_ERROR; 494 return NGX_ERROR;
499 } 495 }
500 496
501 ngx_queue_init(ctx->queue); 497 ngx_queue_init(ctx->queue);
502 498
499 len = sizeof(" in limit_req zone \"\"") + shm_zone->name.len;
500
501 ctx->shpool->log_ctx = ngx_slab_alloc(ctx->shpool, len);
502 if (ctx->shpool->log_ctx == NULL) {
503 return NGX_ERROR;
504 }
505
506 ngx_sprintf(ctx->shpool->log_ctx, " in limit_req zone \"%V\"%Z",
507 &shm_zone->name);
508
503 return NGX_OK; 509 return NGX_OK;
504 } 510 }
505 511
506 512
507 static void * 513 static void *