diff src/stream/ngx_stream.c @ 6606:2f41d383c9c7

Stream: added preconfiguration step.
author Vladimir Homutov <vl@nginx.com>
date Wed, 15 Jun 2016 15:10:24 +0300
parents b3b7e33083ac
children c70b7f4537e1
line wrap: on
line diff
--- a/src/stream/ngx_stream.c
+++ b/src/stream/ngx_stream.c
@@ -143,11 +143,26 @@ ngx_stream_block(ngx_conf_t *cf, ngx_com
     }
 
 
-    /* parse inside the stream{} block */
-
     pcf = *cf;
     cf->ctx = ctx;
 
+    for (m = 0; cf->cycle->modules[m]; m++) {
+        if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
+            continue;
+        }
+
+        module = cf->cycle->modules[m]->ctx;
+
+        if (module->preconfiguration) {
+            if (module->preconfiguration(cf) != NGX_OK) {
+                return NGX_CONF_ERROR;
+            }
+        }
+    }
+
+
+    /* parse inside the stream{} block */
+
     cf->module_type = NGX_STREAM_MODULE;
     cf->cmd_type = NGX_STREAM_MAIN_CONF;
     rv = ngx_conf_parse(cf, NULL);