]> git.kaiwu.me - nginx.git/commitdiff
Stream: added postconfiguration method to stream modules.
authorVladimir Homutov <vl@nginx.com>
Tue, 9 Jun 2015 10:00:45 +0000 (13:00 +0300)
committerVladimir Homutov <vl@nginx.com>
Tue, 9 Jun 2015 10:00:45 +0000 (13:00 +0300)
src/stream/ngx_stream.c
src/stream/ngx_stream.h
src/stream/ngx_stream_core_module.c
src/stream/ngx_stream_proxy_module.c
src/stream/ngx_stream_ssl_module.c
src/stream/ngx_stream_upstream.c
src/stream/ngx_stream_upstream_hash_module.c
src/stream/ngx_stream_upstream_least_conn_module.c
src/stream/ngx_stream_upstream_zone_module.c

index 83b1c345bdcf72059ac07d6865d6706b5436bf2c..3dce35ab71da5421fbf4c3ad04d3ca14927a91c7 100644 (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;
 
 
index f96ea0a5880165c3704969274011c44ff518b0f9..472d9b6c6daf1d1fdcc277ec1716072addfca648 100644 (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);
 
index 414fe3ae0938d0de696ba219b9d2bcd04e47af24..246f55c459085d7973c7e4858477295e5c9e8409 100644 (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 */
 
index a34b7ceb91a5b1d03bf0bece9ee3ddb45d79a5ae..2fd7537a87911d104b04381b2b2385379e0fc7a9 100644 (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 */
 
index 4b27a1e3ea1f935bdc689f68061c4824bd49c039..97a0fa9728f48d802ad4b892b9d63e274e4855bd 100644 (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 */
 
index a991f8a9fbc797fd22264e9fb3c54a255f0aef22..f21e17d76784421a43b87b72aa1a169cc02aa496 100644 (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 */
 
index 88e74145fa580f15410326bf410c32225a2abe8e..56ff7d6e9872dc243ab687b485cbe42edb59dd1f 100644 (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 */
 
index eae4b177d106c999053eaff54cbc6e9ef72cab97..677da4549f908e29d1505a1510345b0ca1b9ef8a 100644 (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 */
 
index 95a778f10a9eeec7aefaa7a00582afe64d7ab4ed..6025aee7d63f42847459ee52e751b6aab28191ee 100644 (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 */