Stream: added postconfiguration method to stream modules.

This commit is contained in:
Vladimir Homutov 2015-06-09 13:00:45 +03:00
parent c81d7ec158
commit d56b84b783
9 changed files with 30 additions and 0 deletions

View File

@ -204,6 +204,20 @@ ngx_stream_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
}
for (m = 0; ngx_modules[m]; m++) {
if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
module = ngx_modules[m]->ctx;
if (module->postconfiguration) {
if (module->postconfiguration(cf) != NGX_OK) {
return NGX_CONF_ERROR;
}
}
}
*cf = pcf;

View File

@ -148,6 +148,8 @@ struct ngx_stream_session_s {
typedef struct {
ngx_int_t (*postconfiguration)(ngx_conf_t *cf);
void *(*create_main_conf)(ngx_conf_t *cf);
char *(*init_main_conf)(ngx_conf_t *cf, void *conf);

View File

@ -50,6 +50,8 @@ static ngx_command_t ngx_stream_core_commands[] = {
static ngx_stream_module_t ngx_stream_core_module_ctx = {
NULL, /* postconfiguration */
ngx_stream_core_create_main_conf, /* create main configuration */
NULL, /* init main configuration */

View File

@ -246,6 +246,8 @@ static ngx_command_t ngx_stream_proxy_commands[] = {
static ngx_stream_module_t ngx_stream_proxy_module_ctx = {
NULL, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */

View File

@ -132,6 +132,8 @@ static ngx_command_t ngx_stream_ssl_commands[] = {
static ngx_stream_module_t ngx_stream_ssl_module_ctx = {
NULL, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */

View File

@ -39,6 +39,8 @@ static ngx_command_t ngx_stream_upstream_commands[] = {
static ngx_stream_module_t ngx_stream_upstream_module_ctx = {
NULL, /* postconfiguration */
ngx_stream_upstream_create_main_conf, /* create main configuration */
ngx_stream_upstream_init_main_conf, /* init main configuration */

View File

@ -76,6 +76,8 @@ static ngx_command_t ngx_stream_upstream_hash_commands[] = {
static ngx_stream_module_t ngx_stream_upstream_hash_module_ctx = {
NULL, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */

View File

@ -32,6 +32,8 @@ static ngx_command_t ngx_stream_upstream_least_conn_commands[] = {
static ngx_stream_module_t ngx_stream_upstream_least_conn_module_ctx = {
NULL, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */

View File

@ -32,6 +32,8 @@ static ngx_command_t ngx_stream_upstream_zone_commands[] = {
static ngx_stream_module_t ngx_stream_upstream_zone_module_ctx = {
NULL, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */