|
| 1 | +diff --git a/bundle/ngx_lua-0.10.17/src/ngx_http_lua_directive.c b/bundle/ngx_lua-0.10.17/src/ngx_http_lua_directive.c |
| 2 | +index a989c26..b5bc8af 100644 |
| 3 | +--- a/bundle/ngx_lua-0.10.17/src/ngx_http_lua_directive.c |
| 4 | ++++ b/bundle/ngx_lua-0.10.17/src/ngx_http_lua_directive.c |
| 5 | +@@ -125,7 +125,7 @@ ngx_http_lua_shared_dict(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
| 6 | + ctx->log = &cf->cycle->new_log; |
| 7 | + |
| 8 | + zone = ngx_http_lua_shared_memory_add(cf, &name, (size_t) size, |
| 9 | +- &ngx_http_lua_module); |
| 10 | ++ &ngx_shared_memory_add); |
| 11 | + if (zone == NULL) { |
| 12 | + return NGX_CONF_ERROR; |
| 13 | + } |
| 14 | +@@ -133,10 +133,16 @@ ngx_http_lua_shared_dict(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
| 15 | + if (zone->data) { |
| 16 | + ctx = zone->data; |
| 17 | + |
| 18 | +- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
| 19 | +- "lua_shared_dict \"%V\" is already defined as " |
| 20 | +- "\"%V\"", &name, &ctx->name); |
| 21 | +- return NGX_CONF_ERROR; |
| 22 | ++ if((&name)->len == (&ctx->name)->len && |
| 23 | ++ ! ngx_strcmp((&name)->data, (&ctx->name)->data) && |
| 24 | ++ zone->tag == &ngx_shared_memory_add) { |
| 25 | ++ dd("same zone in other subsystem"); |
| 26 | ++ } else { |
| 27 | ++ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
| 28 | ++ "http lua_shared_dict \"%V\" is already defined as " |
| 29 | ++ "\"%V\"", &name, &ctx->name); |
| 30 | ++ return NGX_CONF_ERROR; |
| 31 | ++ } |
| 32 | + } |
| 33 | + |
| 34 | + zone->init = ngx_http_lua_shdict_init_zone; |
| 35 | +diff --git a/bundle/ngx_stream_lua-0.0.8/src/ngx_stream_lua_directive.c b/bundle/ngx_stream_lua-0.0.8/src/ngx_stream_lua_directive.c |
| 36 | +index d32edea..248f961 100644 |
| 37 | +--- a/bundle/ngx_stream_lua-0.0.8/src/ngx_stream_lua_directive.c |
| 38 | ++++ b/bundle/ngx_stream_lua-0.0.8/src/ngx_stream_lua_directive.c |
| 39 | +@@ -123,7 +123,7 @@ ngx_stream_lua_shared_dict(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
| 40 | + ctx->log = &cf->cycle->new_log; |
| 41 | + |
| 42 | + zone = ngx_stream_lua_shared_memory_add(cf, &name, (size_t) size, |
| 43 | +- &ngx_stream_lua_module); |
| 44 | ++ &ngx_shared_memory_add); |
| 45 | + if (zone == NULL) { |
| 46 | + return NGX_CONF_ERROR; |
| 47 | + } |
| 48 | +@@ -131,10 +131,16 @@ ngx_stream_lua_shared_dict(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
| 49 | + if (zone->data) { |
| 50 | + ctx = zone->data; |
| 51 | + |
| 52 | +- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
| 53 | +- "lua_shared_dict \"%V\" is already defined as " |
| 54 | +- "\"%V\"", &name, &ctx->name); |
| 55 | +- return NGX_CONF_ERROR; |
| 56 | ++ if((&name)->len == (&ctx->name)->len && |
| 57 | ++ ! ngx_strcmp((&name)->data, (&ctx->name)->data) && |
| 58 | ++ zone->tag == &ngx_shared_memory_add) { |
| 59 | ++ dd("same zone in other subsystem"); |
| 60 | ++ } else { |
| 61 | ++ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
| 62 | ++ "stream lua_shared_dict \"%V\" is already defined as " |
| 63 | ++ "\"%V\"", &name, &ctx->name); |
| 64 | ++ return NGX_CONF_ERROR; |
| 65 | ++ } |
| 66 | + } |
| 67 | + |
| 68 | + zone->init = ngx_stream_lua_shdict_init_zone; |
0 commit comments