Klaus Demo nginx / 0f67d63
Dynamic modules: changed ngx_modules to cycle->modules. Maxim Dounin 6 years ago
16 changed file(s) with 162 addition(s) and 154 deletion(s). Raw diff Collapse all Expand all
328328
329329 found = 0;
330330
331 for (i = 0; ngx_modules[i]; i++) {
332
333 cmd = ngx_modules[i]->commands;
331 for (i = 0; cf->cycle->modules[i]; i++) {
332
333 cmd = cf->cycle->modules[i]->commands;
334334 if (cmd == NULL) {
335335 continue;
336336 }
347347
348348 found = 1;
349349
350 if (ngx_modules[i]->type != NGX_CONF_MODULE
351 && ngx_modules[i]->type != cf->module_type)
350 if (cf->cycle->modules[i]->type != NGX_CONF_MODULE
351 && cf->cycle->modules[i]->type != cf->module_type)
352352 {
353353 continue;
354354 }
410410 conf = NULL;
411411
412412 if (cmd->type & NGX_DIRECT_CONF) {
413 conf = ((void **) cf->ctx)[ngx_modules[i]->index];
413 conf = ((void **) cf->ctx)[cf->cycle->modules[i]->index];
414414
415415 } else if (cmd->type & NGX_MAIN_CONF) {
416 conf = &(((void **) cf->ctx)[ngx_modules[i]->index]);
416 conf = &(((void **) cf->ctx)[cf->cycle->modules[i]->index]);
417417
418418 } else if (cf->ctx) {
419419 confp = *(void **) ((char *) cf->ctx + cmd->conf);
420420
421421 if (confp) {
422 conf = confp[ngx_modules[i]->ctx_index];
422 conf = confp[cf->cycle->modules[i]->ctx_index];
423423 }
424424 }
425425
211211 ngx_strlow(cycle->hostname.data, (u_char *) hostname, cycle->hostname.len);
212212
213213
214 for (i = 0; ngx_modules[i]; i++) {
215 if (ngx_modules[i]->type != NGX_CORE_MODULE) {
214 cycle->modules = ngx_modules;
215
216
217 for (i = 0; cycle->modules[i]; i++) {
218 if (cycle->modules[i]->type != NGX_CORE_MODULE) {
216219 continue;
217220 }
218221
219 module = ngx_modules[i]->ctx;
222 module = cycle->modules[i]->ctx;
220223
221224 if (module->create_conf) {
222225 rv = module->create_conf(cycle);
224227 ngx_destroy_pool(pool);
225228 return NULL;
226229 }
227 cycle->conf_ctx[ngx_modules[i]->index] = rv;
230 cycle->conf_ctx[cycle->modules[i]->index] = rv;
228231 }
229232 }
230233
275278 cycle->conf_file.data);
276279 }
277280
278 for (i = 0; ngx_modules[i]; i++) {
279 if (ngx_modules[i]->type != NGX_CORE_MODULE) {
281 for (i = 0; cycle->modules[i]; i++) {
282 if (cycle->modules[i]->type != NGX_CORE_MODULE) {
280283 continue;
281284 }
282285
283 module = ngx_modules[i]->ctx;
286 module = cycle->modules[i]->ctx;
284287
285288 if (module->init_conf) {
286 if (module->init_conf(cycle, cycle->conf_ctx[ngx_modules[i]->index])
289 if (module->init_conf(cycle,
290 cycle->conf_ctx[cycle->modules[i]->index])
287291 == NGX_CONF_ERROR)
288292 {
289293 environ = senv;
4646 ngx_connection_t **files;
4747 ngx_connection_t *free_connections;
4848 ngx_uint_t free_connection_n;
49
50 ngx_module_t **modules;
4951
5052 ngx_queue_t reusable_connections_queue;
5153
3131 {
3232 ngx_uint_t i;
3333
34 for (i = 0; ngx_modules[i]; i++) {
35 if (ngx_modules[i]->init_module) {
36 if (ngx_modules[i]->init_module(cycle) != NGX_OK) {
34 for (i = 0; cycle->modules[i]; i++) {
35 if (cycle->modules[i]->init_module) {
36 if (cycle->modules[i]->init_module(cycle) != NGX_OK) {
3737 return NGX_ERROR;
3838 }
3939 }
5252
5353 /* count appropriate modules, set up their indices */
5454
55 for (i = 0; ngx_modules[i]; i++) {
56 if (ngx_modules[i]->type != type) {
55 for (i = 0; cycle->modules[i]; i++) {
56 if (cycle->modules[i]->type != type) {
5757 continue;
5858 }
5959
60 ngx_modules[i]->ctx_index = max++;
60 cycle->modules[i]->ctx_index = max++;
6161 }
6262
6363 return max;
605605 return NGX_ERROR;
606606 }
607607
608 for (m = 0; ngx_modules[m]; m++) {
609 if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
608 for (m = 0; cycle->modules[m]; m++) {
609 if (cycle->modules[m]->type != NGX_EVENT_MODULE) {
610610 continue;
611611 }
612612
613 if (ngx_modules[m]->ctx_index != ecf->use) {
613 if (cycle->modules[m]->ctx_index != ecf->use) {
614614 continue;
615615 }
616616
617 module = ngx_modules[m]->ctx;
617 module = cycle->modules[m]->ctx;
618618
619619 if (module->actions.init(cycle, ngx_timer_resolution) != NGX_OK) {
620620 /* fatal */
904904
905905 *(void **) conf = ctx;
906906
907 for (i = 0; ngx_modules[i]; i++) {
908 if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
907 for (i = 0; cf->cycle->modules[i]; i++) {
908 if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) {
909909 continue;
910910 }
911911
912 m = ngx_modules[i]->ctx;
912 m = cf->cycle->modules[i]->ctx;
913913
914914 if (m->create_conf) {
915 (*ctx)[ngx_modules[i]->ctx_index] = m->create_conf(cf->cycle);
916 if ((*ctx)[ngx_modules[i]->ctx_index] == NULL) {
915 (*ctx)[cf->cycle->modules[i]->ctx_index] =
916 m->create_conf(cf->cycle);
917 if ((*ctx)[cf->cycle->modules[i]->ctx_index] == NULL) {
917918 return NGX_CONF_ERROR;
918919 }
919920 }
932933 return rv;
933934 }
934935
935 for (i = 0; ngx_modules[i]; i++) {
936 if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
936 for (i = 0; cf->cycle->modules[i]; i++) {
937 if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) {
937938 continue;
938939 }
939940
940 m = ngx_modules[i]->ctx;
941 m = cf->cycle->modules[i]->ctx;
941942
942943 if (m->init_conf) {
943 rv = m->init_conf(cf->cycle, (*ctx)[ngx_modules[i]->ctx_index]);
944 rv = m->init_conf(cf->cycle,
945 (*ctx)[cf->cycle->modules[i]->ctx_index]);
944946 if (rv != NGX_CONF_OK) {
945947 return rv;
946948 }
10011003 }
10021004
10031005
1004 for (m = 0; ngx_modules[m]; m++) {
1005 if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
1006 for (m = 0; cf->cycle->modules[m]; m++) {
1007 if (cf->cycle->modules[m]->type != NGX_EVENT_MODULE) {
10061008 continue;
10071009 }
10081010
1009 module = ngx_modules[m]->ctx;
1011 module = cf->cycle->modules[m]->ctx;
10101012 if (module->name->len == value[1].len) {
10111013 if (ngx_strcmp(module->name->data, value[1].data) == 0) {
1012 ecf->use = ngx_modules[m]->ctx_index;
1014 ecf->use = cf->cycle->modules[m]->ctx_index;
10131015 ecf->name = module->name->data;
10141016
10151017 if (ngx_process == NGX_PROCESS_SINGLE
12241226 #endif
12251227
12261228 if (module == NULL) {
1227 for (i = 0; ngx_modules[i]; i++) {
1228
1229 if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
1229 for (i = 0; cycle->modules[i]; i++) {
1230
1231 if (cycle->modules[i]->type != NGX_EVENT_MODULE) {
12301232 continue;
12311233 }
12321234
1233 event_module = ngx_modules[i]->ctx;
1235 event_module = cycle->modules[i]->ctx;
12341236
12351237 if (ngx_strcmp(event_module->name->data, event_core_name.data) == 0)
12361238 {
12371239 continue;
12381240 }
12391241
1240 module = ngx_modules[i];
1242 module = cycle->modules[i];
12411243 break;
12421244 }
12431245 }
559559 return NGX_CONF_ERROR;
560560 }
561561
562 for (i = 0; ngx_modules[i]; i++) {
563 if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
562 for (i = 0; cf->cycle->modules[i]; i++) {
563 if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
564564 continue;
565565 }
566566
567 module = ngx_modules[i]->ctx;
567 module = cf->cycle->modules[i]->ctx;
568568
569569 if (module->create_loc_conf) {
570570
573573 return NGX_CONF_ERROR;
574574 }
575575
576 ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
576 ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
577577 }
578578 }
579579
182182 * of the all http modules
183183 */
184184
185 for (m = 0; ngx_modules[m]; m++) {
186 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
185 for (m = 0; cf->cycle->modules[m]; m++) {
186 if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
187187 continue;
188188 }
189189
190 module = ngx_modules[m]->ctx;
191 mi = ngx_modules[m]->ctx_index;
190 module = cf->cycle->modules[m]->ctx;
191 mi = cf->cycle->modules[m]->ctx_index;
192192
193193 if (module->create_main_conf) {
194194 ctx->main_conf[mi] = module->create_main_conf(cf);
215215 pcf = *cf;
216216 cf->ctx = ctx;
217217
218 for (m = 0; ngx_modules[m]; m++) {
219 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
218 for (m = 0; cf->cycle->modules[m]; m++) {
219 if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
220220 continue;
221221 }
222222
223 module = ngx_modules[m]->ctx;
223 module = cf->cycle->modules[m]->ctx;
224224
225225 if (module->preconfiguration) {
226226 if (module->preconfiguration(cf) != NGX_OK) {
247247 cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
248248 cscfp = cmcf->servers.elts;
249249
250 for (m = 0; ngx_modules[m]; m++) {
251 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
250 for (m = 0; cf->cycle->modules[m]; m++) {
251 if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
252252 continue;
253253 }
254254
255 module = ngx_modules[m]->ctx;
256 mi = ngx_modules[m]->ctx_index;
255 module = cf->cycle->modules[m]->ctx;
256 mi = cf->cycle->modules[m]->ctx_index;
257257
258258 /* init http{} main_conf's */
259259
296296 }
297297
298298
299 for (m = 0; ngx_modules[m]; m++) {
300 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
299 for (m = 0; cf->cycle->modules[m]; m++) {
300 if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
301301 continue;
302302 }
303303
304 module = ngx_modules[m]->ctx;
304 module = cf->cycle->modules[m]->ctx;
305305
306306 if (module->postconfiguration) {
307307 if (module->postconfiguration(cf) != NGX_OK) {
29672967 return NGX_CONF_ERROR;
29682968 }
29692969
2970 for (i = 0; ngx_modules[i]; i++) {
2971 if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
2970 for (i = 0; cf->cycle->modules[i]; i++) {
2971 if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
29722972 continue;
29732973 }
29742974
2975 module = ngx_modules[i]->ctx;
2975 module = cf->cycle->modules[i]->ctx;
29762976
29772977 if (module->create_srv_conf) {
29782978 mconf = module->create_srv_conf(cf);
29802980 return NGX_CONF_ERROR;
29812981 }
29822982
2983 ctx->srv_conf[ngx_modules[i]->ctx_index] = mconf;
2983 ctx->srv_conf[cf->cycle->modules[i]->ctx_index] = mconf;
29842984 }
29852985
29862986 if (module->create_loc_conf) {
29892989 return NGX_CONF_ERROR;
29902990 }
29912991
2992 ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
2992 ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
29932993 }
29942994 }
29952995
30853085 return NGX_CONF_ERROR;
30863086 }
30873087
3088 for (i = 0; ngx_modules[i]; i++) {
3089 if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
3088 for (i = 0; cf->cycle->modules[i]; i++) {
3089 if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
30903090 continue;
30913091 }
30923092
3093 module = ngx_modules[i]->ctx;
3093 module = cf->cycle->modules[i]->ctx;
30943094
30953095 if (module->create_loc_conf) {
3096 ctx->loc_conf[ngx_modules[i]->ctx_index] =
3096 ctx->loc_conf[cf->cycle->modules[i]->ctx_index] =
30973097 module->create_loc_conf(cf);
3098 if (ctx->loc_conf[ngx_modules[i]->ctx_index] == NULL) {
3098 if (ctx->loc_conf[cf->cycle->modules[i]->ctx_index] == NULL) {
30993099 return NGX_CONF_ERROR;
31003100 }
31013101 }
46064606 return NGX_CONF_ERROR;
46074607 }
46084608
4609 for (i = 0; ngx_modules[i]; i++) {
4610 if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
4609 for (i = 0; cf->cycle->modules[i]; i++) {
4610 if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
46114611 continue;
46124612 }
46134613
4614 module = ngx_modules[i]->ctx;
4614 module = cf->cycle->modules[i]->ctx;
46154615
46164616 if (module->create_loc_conf) {
46174617
46204620 return NGX_CONF_ERROR;
46214621 }
46224622
4623 ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
4623 ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
46244624 }
46254625 }
46264626
53305330 return NGX_CONF_ERROR;
53315331 }
53325332
5333 for (m = 0; ngx_modules[m]; m++) {
5334 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
5333 for (m = 0; cf->cycle->modules[m]; m++) {
5334 if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
53355335 continue;
53365336 }
53375337
5338 module = ngx_modules[m]->ctx;
5338 module = cf->cycle->modules[m]->ctx;
53395339
53405340 if (module->create_srv_conf) {
53415341 mconf = module->create_srv_conf(cf);
53435343 return NGX_CONF_ERROR;
53445344 }
53455345
5346 ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
5346 ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
53475347 }
53485348
53495349 if (module->create_loc_conf) {
53525352 return NGX_CONF_ERROR;
53535353 }
53545354
5355 ctx->loc_conf[ngx_modules[m]->ctx_index] = mconf;
5355 ctx->loc_conf[cf->cycle->modules[m]->ctx_index] = mconf;
53565356 }
53575357 }
53585358
117117 * create the main_conf's and the null srv_conf's of the all mail modules
118118 */
119119
120 for (m = 0; ngx_modules[m]; m++) {
121 if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
120 for (m = 0; cf->cycle->modules[m]; m++) {
121 if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
122122 continue;
123123 }
124124
125 module = ngx_modules[m]->ctx;
126 mi = ngx_modules[m]->ctx_index;
125 module = cf->cycle->modules[m]->ctx;
126 mi = cf->cycle->modules[m]->ctx_index;
127127
128128 if (module->create_main_conf) {
129129 ctx->main_conf[mi] = module->create_main_conf(cf);
161161 cmcf = ctx->main_conf[ngx_mail_core_module.ctx_index];
162162 cscfp = cmcf->servers.elts;
163163
164 for (m = 0; ngx_modules[m]; m++) {
165 if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
164 for (m = 0; cf->cycle->modules[m]; m++) {
165 if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
166166 continue;
167167 }
168168
169 module = ngx_modules[m]->ctx;
170 mi = ngx_modules[m]->ctx_index;
169 module = cf->cycle->modules[m]->ctx;
170 mi = cf->cycle->modules[m]->ctx_index;
171171
172172 /* init mail{} main_conf's */
173173
236236 return NGX_CONF_ERROR;
237237 }
238238
239 for (m = 0; ngx_modules[m]; m++) {
240 if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
241 continue;
242 }
243
244 module = ngx_modules[m]->ctx;
239 for (m = 0; cf->cycle->modules[m]; m++) {
240 if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
241 continue;
242 }
243
244 module = cf->cycle->modules[m]->ctx;
245245
246246 if (module->create_srv_conf) {
247247 mconf = module->create_srv_conf(cf);
249249 return NGX_CONF_ERROR;
250250 }
251251
252 ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
252 ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
253253 }
254254 }
255255
391391 #endif
392392
393393 if (cscf->protocol == NULL) {
394 for (m = 0; ngx_modules[m]; m++) {
395 if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
394 for (m = 0; cf->cycle->modules[m]; m++) {
395 if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
396396 continue;
397397 }
398398
399 module = ngx_modules[m]->ctx;
399 module = cf->cycle->modules[m]->ctx;
400400
401401 if (module->protocol == NULL) {
402402 continue;
594594
595595 value = cf->args->elts;
596596
597 for (m = 0; ngx_modules[m]; m++) {
598 if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
599 continue;
600 }
601
602 module = ngx_modules[m]->ctx;
597 for (m = 0; cf->cycle->modules[m]; m++) {
598 if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
599 continue;
600 }
601
602 module = cf->cycle->modules[m]->ctx;
603603
604604 if (module->protocol
605605 && ngx_strcmp(module->protocol->name.data, value[1].data) == 0)
293293 exit(2);
294294 }
295295
296 for (i = 0; ngx_modules[i]; i++) {
297 if (ngx_modules[i]->init_process) {
298 if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
296 for (i = 0; cycle->modules[i]; i++) {
297 if (cycle->modules[i]->init_process) {
298 if (cycle->modules[i]->init_process(cycle) == NGX_ERROR) {
299299 /* fatal */
300300 exit(2);
301301 }
309309
310310 if (ngx_terminate || ngx_quit) {
311311
312 for (i = 0; ngx_modules[i]; i++) {
313 if (ngx_modules[i]->exit_process) {
314 ngx_modules[i]->exit_process(cycle);
312 for (i = 0; cycle->modules[i]; i++) {
313 if (cycle->modules[i]->exit_process) {
314 cycle->modules[i]->exit_process(cycle);
315315 }
316316 }
317317
688688
689689 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exit");
690690
691 for (i = 0; ngx_modules[i]; i++) {
692 if (ngx_modules[i]->exit_master) {
693 ngx_modules[i]->exit_master(cycle);
691 for (i = 0; cycle->modules[i]; i++) {
692 if (cycle->modules[i]->exit_master) {
693 cycle->modules[i]->exit_master(cycle);
694694 }
695695 }
696696
894894 ls[i].previous = NULL;
895895 }
896896
897 for (i = 0; ngx_modules[i]; i++) {
898 if (ngx_modules[i]->init_process) {
899 if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
897 for (i = 0; cycle->modules[i]; i++) {
898 if (cycle->modules[i]->init_process) {
899 if (cycle->modules[i]->init_process(cycle) == NGX_ERROR) {
900900 /* fatal */
901901 exit(2);
902902 }
948948 ngx_uint_t i;
949949 ngx_connection_t *c;
950950
951 for (i = 0; ngx_modules[i]; i++) {
952 if (ngx_modules[i]->exit_process) {
953 ngx_modules[i]->exit_process(cycle);
951 for (i = 0; cycle->modules[i]; i++) {
952 if (cycle->modules[i]->exit_process) {
953 cycle->modules[i]->exit_process(cycle);
954954 }
955955 }
956956
552552
553553 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exit");
554554
555 for (i = 0; ngx_modules[i]; i++) {
556 if (ngx_modules[i]->exit_master) {
557 ngx_modules[i]->exit_master(cycle);
555 for (i = 0; cycle->modules[i]; i++) {
556 if (cycle->modules[i]->exit_master) {
557 cycle->modules[i]->exit_master(cycle);
558558 }
559559 }
560560
765765
766766 cycle = (ngx_cycle_t *) ngx_cycle;
767767
768 for (n = 0; ngx_modules[n]; n++) {
769 if (ngx_modules[n]->init_process) {
770 if (ngx_modules[n]->init_process(cycle) == NGX_ERROR) {
768 for (n = 0; cycle->modules[n]; n++) {
769 if (cycle->modules[n]->init_process) {
770 if (cycle->modules[n]->init_process(cycle) == NGX_ERROR) {
771771 /* fatal */
772772 exit(2);
773773 }
824824
825825 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exit");
826826
827 for (i = 0; ngx_modules[i]; i++) {
828 if (ngx_modules[i]->exit_process) {
829 ngx_modules[i]->exit_process(cycle);
827 for (i = 0; cycle->modules[i]; i++) {
828 if (cycle->modules[i]->exit_process) {
829 cycle->modules[i]->exit_process(cycle);
830830 }
831831 }
832832
118118 * create the main_conf's and the null srv_conf's of the all stream modules
119119 */
120120
121 for (m = 0; ngx_modules[m]; m++) {
122 if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
121 for (m = 0; cf->cycle->modules[m]; m++) {
122 if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
123123 continue;
124124 }
125125
126 module = ngx_modules[m]->ctx;
127 mi = ngx_modules[m]->ctx_index;
126 module = cf->cycle->modules[m]->ctx;
127 mi = cf->cycle->modules[m]->ctx_index;
128128
129129 if (module->create_main_conf) {
130130 ctx->main_conf[mi] = module->create_main_conf(cf);
162162 cmcf = ctx->main_conf[ngx_stream_core_module.ctx_index];
163163 cscfp = cmcf->servers.elts;
164164
165 for (m = 0; ngx_modules[m]; m++) {
166 if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
165 for (m = 0; cf->cycle->modules[m]; m++) {
166 if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
167167 continue;
168168 }
169169
170 module = ngx_modules[m]->ctx;
171 mi = ngx_modules[m]->ctx_index;
170 module = cf->cycle->modules[m]->ctx;
171 mi = cf->cycle->modules[m]->ctx_index;
172172
173173 /* init stream{} main_conf's */
174174
200200 }
201201 }
202202
203 for (m = 0; ngx_modules[m]; m++) {
204 if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
203 for (m = 0; cf->cycle->modules[m]; m++) {
204 if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
205205 continue;
206206 }
207207
208 module = ngx_modules[m]->ctx;
208 module = cf->cycle->modules[m]->ctx;
209209
210210 if (module->postconfiguration) {
211211 if (module->postconfiguration(cf) != NGX_OK) {
198198 return NGX_CONF_ERROR;
199199 }
200200
201 for (m = 0; ngx_modules[m]; m++) {
202 if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
203 continue;
204 }
205
206 module = ngx_modules[m]->ctx;
201 for (m = 0; cf->cycle->modules[m]; m++) {
202 if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
203 continue;
204 }
205
206 module = cf->cycle->modules[m]->ctx;
207207
208208 if (module->create_srv_conf) {
209209 mconf = module->create_srv_conf(cf);
211211 return NGX_CONF_ERROR;
212212 }
213213
214 ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
214 ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
215215 }
216216 }
217217
115115
116116 uscf->srv_conf = ctx->srv_conf;
117117
118 for (m = 0; ngx_modules[m]; m++) {
119 if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
120 continue;
121 }
122
123 module = ngx_modules[m]->ctx;
118 for (m = 0; cf->cycle->modules[m]; m++) {
119 if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
120 continue;
121 }
122
123 module = cf->cycle->modules[m]->ctx;
124124
125125 if (module->create_srv_conf) {
126126 mconf = module->create_srv_conf(cf);
128128 return NGX_CONF_ERROR;
129129 }
130130
131 ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
131 ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
132132 }
133133 }
134134