comparison src/http/modules/ngx_http_limit_zone_module.c @ 2720:b3b8c66bd520

support attaching to an existent Win32 shared memory
author Igor Sysoev <igor@sysoev.ru>
date Sat, 18 Apr 2009 19:27:28 +0000
parents d5896f6608e8
children c7d57b539248
comparison
equal deleted inserted replaced
2719:9237cf8b400b 2720:b3b8c66bd520
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 341
342 if (shm_zone->shm.exists) {
343 ctx->rbtree = shpool->data;
344
345 return NGX_OK;
346 }
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 }
352
353 shpool->data = ctx->rbtree;
346 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 }