[nginx] Stream: added postconfiguration method to stream modules.

Vladimir Homutov vl at nginx.com
Tue Jun 9 10:27:09 UTC 2015


details:   http://hg.nginx.org/nginx/rev/68c106e6fa0a
branches:  
changeset: 6174:68c106e6fa0a
user:      Vladimir Homutov <vl at nginx.com>
date:      Tue Jun 09 13:00:45 2015 +0300
description:
Stream: added postconfiguration method to stream modules.

diffstat:

 src/stream/ngx_stream.c                            |  14 ++++++++++++++
 src/stream/ngx_stream.h                            |   2 ++
 src/stream/ngx_stream_core_module.c                |   2 ++
 src/stream/ngx_stream_proxy_module.c               |   2 ++
 src/stream/ngx_stream_ssl_module.c                 |   2 ++
 src/stream/ngx_stream_upstream.c                   |   2 ++
 src/stream/ngx_stream_upstream_hash_module.c       |   2 ++
 src/stream/ngx_stream_upstream_least_conn_module.c |   2 ++
 src/stream/ngx_stream_upstream_zone_module.c       |   2 ++
 9 files changed, 30 insertions(+), 0 deletions(-)

diffs (120 lines):

diff -r 1729d8d3eb3a -r 68c106e6fa0a src/stream/ngx_stream.c
--- a/src/stream/ngx_stream.c	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/stream/ngx_stream.c	Tue Jun 09 13:00:45 2015 +0300
@@ -204,6 +204,20 @@ ngx_stream_block(ngx_conf_t *cf, ngx_com
         }
     }
 
+    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;
 
 
diff -r 1729d8d3eb3a -r 68c106e6fa0a src/stream/ngx_stream.h
--- a/src/stream/ngx_stream.h	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/stream/ngx_stream.h	Tue Jun 09 13:00:45 2015 +0300
@@ -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);
 
diff -r 1729d8d3eb3a -r 68c106e6fa0a src/stream/ngx_stream_core_module.c
--- a/src/stream/ngx_stream_core_module.c	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/stream/ngx_stream_core_module.c	Tue Jun 09 13:00:45 2015 +0300
@@ -50,6 +50,8 @@ static ngx_command_t  ngx_stream_core_co
 
 
 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 */
 
diff -r 1729d8d3eb3a -r 68c106e6fa0a src/stream/ngx_stream_proxy_module.c
--- a/src/stream/ngx_stream_proxy_module.c	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/stream/ngx_stream_proxy_module.c	Tue Jun 09 13:00:45 2015 +0300
@@ -246,6 +246,8 @@ static ngx_command_t  ngx_stream_proxy_c
 
 
 static ngx_stream_module_t  ngx_stream_proxy_module_ctx = {
+    NULL,                                  /* postconfiguration */
+
     NULL,                                  /* create main configuration */
     NULL,                                  /* init main configuration */
 
diff -r 1729d8d3eb3a -r 68c106e6fa0a src/stream/ngx_stream_ssl_module.c
--- a/src/stream/ngx_stream_ssl_module.c	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/stream/ngx_stream_ssl_module.c	Tue Jun 09 13:00:45 2015 +0300
@@ -132,6 +132,8 @@ static ngx_command_t  ngx_stream_ssl_com
 
 
 static ngx_stream_module_t  ngx_stream_ssl_module_ctx = {
+    NULL,                                  /* postconfiguration */
+
     NULL,                                  /* create main configuration */
     NULL,                                  /* init main configuration */
 
diff -r 1729d8d3eb3a -r 68c106e6fa0a src/stream/ngx_stream_upstream.c
--- a/src/stream/ngx_stream_upstream.c	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/stream/ngx_stream_upstream.c	Tue Jun 09 13:00:45 2015 +0300
@@ -39,6 +39,8 @@ static ngx_command_t  ngx_stream_upstrea
 
 
 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 */
 
diff -r 1729d8d3eb3a -r 68c106e6fa0a src/stream/ngx_stream_upstream_hash_module.c
--- a/src/stream/ngx_stream_upstream_hash_module.c	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/stream/ngx_stream_upstream_hash_module.c	Tue Jun 09 13:00:45 2015 +0300
@@ -76,6 +76,8 @@ static ngx_command_t  ngx_stream_upstrea
 
 
 static ngx_stream_module_t  ngx_stream_upstream_hash_module_ctx = {
+    NULL,                                  /* postconfiguration */
+
     NULL,                                  /* create main configuration */
     NULL,                                  /* init main configuration */
 
diff -r 1729d8d3eb3a -r 68c106e6fa0a src/stream/ngx_stream_upstream_least_conn_module.c
--- a/src/stream/ngx_stream_upstream_least_conn_module.c	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/stream/ngx_stream_upstream_least_conn_module.c	Tue Jun 09 13:00:45 2015 +0300
@@ -32,6 +32,8 @@ static ngx_command_t  ngx_stream_upstrea
 
 
 static ngx_stream_module_t  ngx_stream_upstream_least_conn_module_ctx = {
+    NULL,                                    /* postconfiguration */
+
     NULL,                                    /* create main configuration */
     NULL,                                    /* init main configuration */
 
diff -r 1729d8d3eb3a -r 68c106e6fa0a src/stream/ngx_stream_upstream_zone_module.c
--- a/src/stream/ngx_stream_upstream_zone_module.c	Mon Jun 08 23:13:56 2015 +0300
+++ b/src/stream/ngx_stream_upstream_zone_module.c	Tue Jun 09 13:00:45 2015 +0300
@@ -32,6 +32,8 @@ static ngx_command_t  ngx_stream_upstrea
 
 
 static ngx_stream_module_t  ngx_stream_upstream_zone_module_ctx = {
+    NULL,                                  /* postconfiguration */
+
     NULL,                                  /* create main configuration */
     NULL,                                  /* init main configuration */
 



More information about the nginx-devel mailing list