comparison src/http/modules/ngx_http_limit_zone_module.c @ 489:549994537f15 NGINX_0_7_52

nginx 0.7.52 *) Feature: the first native Windows binary release. *) Bugfix: in processing HEAD method while caching. *) Bugfix: in processing the "If-Modified-Since", "If-Range", etc. client request header lines while caching. *) Bugfix: now the "Set-Cookie" and "P3P" header lines are hidden in cacheable responses. *) Bugfix: if nginx was built with the ngx_http_perl_module and with a perl which supports threads, then during a master process exit the message "panic: MUTEX_LOCK" might be issued. *) Bugfix: nginx could not be built --without-http-cache; the bug had appeared in 0.7.48. *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc, and ppc; the bug had appeared in 0.7.42.
author Igor Sysoev <http://sysoev.ru>
date Mon, 20 Apr 2009 00:00:00 +0400
parents 56baf312c1b5
children f39b9e29530d
comparison
equal deleted inserted replaced
488:eb4fdebda673 489:549994537f15
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
337 return NGX_OK; 337 return NGX_OK;
338 } 338 }
339 339
340 shpool = (ngx_slab_pool_t *) shm_zone->shm.addr; 340 shpool = (ngx_slab_pool_t *) shm_zone->shm.addr;
341
342 if (shm_zone->shm.exists) {
343 ctx->rbtree = shpool->data;
344
345 return NGX_OK;
346 }
341 347
342 ctx->rbtree = ngx_slab_alloc(shpool, sizeof(ngx_rbtree_t)); 348 ctx->rbtree = ngx_slab_alloc(shpool, sizeof(ngx_rbtree_t));
343 if (ctx->rbtree == NULL) { 349 if (ctx->rbtree == NULL) {
344 return NGX_ERROR; 350 return NGX_ERROR;
345 } 351 }
346 352
353 shpool->data = ctx->rbtree;
354
347 sentinel = ngx_slab_alloc(shpool, sizeof(ngx_rbtree_node_t)); 355 sentinel = ngx_slab_alloc(shpool, sizeof(ngx_rbtree_node_t));
348 if (sentinel == NULL) { 356 if (sentinel == NULL) {
349 return NGX_ERROR; 357 return NGX_ERROR;
350 } 358 }
351 359
352 ngx_rbtree_init(ctx->rbtree, sentinel, 360 ngx_rbtree_init(ctx->rbtree, sentinel,
353 ngx_http_limit_zone_rbtree_insert_value); 361 ngx_http_limit_zone_rbtree_insert_value);
354 362
355 len = sizeof(" in limit_zone \"\"") + shm_zone->name.len; 363 len = sizeof(" in limit_zone \"\"") + shm_zone->shm.name.len;
356 364
357 shpool->log_ctx = ngx_slab_alloc(shpool, len); 365 shpool->log_ctx = ngx_slab_alloc(shpool, len);
358 if (shpool->log_ctx == NULL) { 366 if (shpool->log_ctx == NULL) {
359 return NGX_ERROR; 367 return NGX_ERROR;
360 } 368 }
361 369
362 ngx_sprintf(shpool->log_ctx, " in limit_zone \"%V\"%Z", &shm_zone->name); 370 ngx_sprintf(shpool->log_ctx, " in limit_zone \"%V\"%Z",
371 &shm_zone->shm.name);
363 372
364 return NGX_OK; 373 return NGX_OK;
365 } 374 }
366 375
367 376