Mercurial > hg > nginx
comparison src/http/modules/ngx_http_limit_req_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 |
---|---|
177 if (rc == NGX_BUSY) { | 177 if (rc == NGX_BUSY) { |
178 ngx_shmtx_unlock(&ctx->shpool->mutex); | 178 ngx_shmtx_unlock(&ctx->shpool->mutex); |
179 | 179 |
180 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 180 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
181 "limiting requests, excess: %ui.%03ui by zone \"%V\"", | 181 "limiting requests, excess: %ui.%03ui by zone \"%V\"", |
182 excess / 1000, excess % 1000, &lrcf->shm_zone->name); | 182 excess / 1000, excess % 1000, &lrcf->shm_zone->shm.name); |
183 | 183 |
184 return NGX_HTTP_SERVICE_UNAVAILABLE; | 184 return NGX_HTTP_SERVICE_UNAVAILABLE; |
185 } | 185 } |
186 | 186 |
187 if (rc == NGX_AGAIN) { | 187 if (rc == NGX_AGAIN) { |
191 return NGX_DECLINED; | 191 return NGX_DECLINED; |
192 } | 192 } |
193 | 193 |
194 ngx_log_error(NGX_LOG_WARN, r->connection->log, 0, | 194 ngx_log_error(NGX_LOG_WARN, r->connection->log, 0, |
195 "delaying request, excess: %ui.%03ui, by zone \"%V\"", | 195 "delaying request, excess: %ui.%03ui, by zone \"%V\"", |
196 excess / 1000, excess % 1000, &lrcf->shm_zone->name); | 196 excess / 1000, excess % 1000, &lrcf->shm_zone->shm.name); |
197 | 197 |
198 if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) { | 198 if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) { |
199 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 199 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
200 } | 200 } |
201 | 201 |
461 if (octx) { | 461 if (octx) { |
462 if (ngx_strcmp(ctx->var.data, octx->var.data) != 0) { | 462 if (ngx_strcmp(ctx->var.data, octx->var.data) != 0) { |
463 ngx_log_error(NGX_LOG_EMERG, shm_zone->shm.log, 0, | 463 ngx_log_error(NGX_LOG_EMERG, shm_zone->shm.log, 0, |
464 "limit_req \"%V\" uses the \"%V\" variable " | 464 "limit_req \"%V\" uses the \"%V\" variable " |
465 "while previously it used the \"%V\" variable", | 465 "while previously it used the \"%V\" variable", |
466 &shm_zone->name, &ctx->var, &octx->var); | 466 &shm_zone->shm.name, &ctx->var, &octx->var); |
467 return NGX_ERROR; | 467 return NGX_ERROR; |
468 } | 468 } |
469 | 469 |
470 ctx->rbtree = octx->rbtree; | 470 ctx->rbtree = octx->rbtree; |
471 ctx->queue = octx->queue; | 471 ctx->queue = octx->queue; |
494 return NGX_ERROR; | 494 return NGX_ERROR; |
495 } | 495 } |
496 | 496 |
497 ngx_queue_init(ctx->queue); | 497 ngx_queue_init(ctx->queue); |
498 | 498 |
499 len = sizeof(" in limit_req zone \"\"") + shm_zone->name.len; | 499 len = sizeof(" in limit_req zone \"\"") + shm_zone->shm.name.len; |
500 | 500 |
501 ctx->shpool->log_ctx = ngx_slab_alloc(ctx->shpool, len); | 501 ctx->shpool->log_ctx = ngx_slab_alloc(ctx->shpool, len); |
502 if (ctx->shpool->log_ctx == NULL) { | 502 if (ctx->shpool->log_ctx == NULL) { |
503 return NGX_ERROR; | 503 return NGX_ERROR; |
504 } | 504 } |
505 | 505 |
506 ngx_sprintf(ctx->shpool->log_ctx, " in limit_req zone \"%V\"%Z", | 506 ngx_sprintf(ctx->shpool->log_ctx, " in limit_req zone \"%V\"%Z", |
507 &shm_zone->name); | 507 &shm_zone->shm.name); |
508 | 508 |
509 return NGX_OK; | 509 return NGX_OK; |
510 } | 510 } |
511 | 511 |
512 | 512 |
572 name.data = value[i].data + 5; | 572 name.data = value[i].data + 5; |
573 | 573 |
574 p = (u_char *) ngx_strchr(name.data, ':'); | 574 p = (u_char *) ngx_strchr(name.data, ':'); |
575 | 575 |
576 if (p) { | 576 if (p) { |
577 *p = '\0'; | |
578 | |
577 name.len = p - name.data; | 579 name.len = p - name.data; |
578 | 580 |
579 p++; | 581 p++; |
580 | 582 |
581 s.len = value[i].data + value[i].len - p; | 583 s.len = value[i].data + value[i].len - p; |
742 } | 744 } |
743 | 745 |
744 if (lrcf->shm_zone->data == NULL) { | 746 if (lrcf->shm_zone->data == NULL) { |
745 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 747 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
746 "unknown limit_req_zone \"%V\"", | 748 "unknown limit_req_zone \"%V\"", |
747 &lrcf->shm_zone->name); | 749 &lrcf->shm_zone->shm.name); |
748 return NGX_CONF_ERROR; | 750 return NGX_CONF_ERROR; |
749 } | 751 } |
750 | 752 |
751 lrcf->burst = burst * 1000; | 753 lrcf->burst = burst * 1000; |
752 | 754 |