Mercurial > hg > nginx
comparison src/event/ngx_event.c @ 6379:cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Feb 2016 18:30:21 +0300 |
parents | 0f203a2af17c |
children | 8f038068f4bc |
comparison
equal
deleted
inserted
replaced
6378:0f203a2af17c | 6379:cf5e822cf470 |
---|---|
604 | 604 |
605 if (ngx_event_timer_init(cycle->log) == NGX_ERROR) { | 605 if (ngx_event_timer_init(cycle->log) == NGX_ERROR) { |
606 return NGX_ERROR; | 606 return NGX_ERROR; |
607 } | 607 } |
608 | 608 |
609 for (m = 0; ngx_modules[m]; m++) { | 609 for (m = 0; cycle->modules[m]; m++) { |
610 if (ngx_modules[m]->type != NGX_EVENT_MODULE) { | 610 if (cycle->modules[m]->type != NGX_EVENT_MODULE) { |
611 continue; | 611 continue; |
612 } | 612 } |
613 | 613 |
614 if (ngx_modules[m]->ctx_index != ecf->use) { | 614 if (cycle->modules[m]->ctx_index != ecf->use) { |
615 continue; | 615 continue; |
616 } | 616 } |
617 | 617 |
618 module = ngx_modules[m]->ctx; | 618 module = cycle->modules[m]->ctx; |
619 | 619 |
620 if (module->actions.init(cycle, ngx_timer_resolution) != NGX_OK) { | 620 if (module->actions.init(cycle, ngx_timer_resolution) != NGX_OK) { |
621 /* fatal */ | 621 /* fatal */ |
622 exit(2); | 622 exit(2); |
623 } | 623 } |
903 return NGX_CONF_ERROR; | 903 return NGX_CONF_ERROR; |
904 } | 904 } |
905 | 905 |
906 *(void **) conf = ctx; | 906 *(void **) conf = ctx; |
907 | 907 |
908 for (i = 0; ngx_modules[i]; i++) { | 908 for (i = 0; cf->cycle->modules[i]; i++) { |
909 if (ngx_modules[i]->type != NGX_EVENT_MODULE) { | 909 if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) { |
910 continue; | 910 continue; |
911 } | 911 } |
912 | 912 |
913 m = ngx_modules[i]->ctx; | 913 m = cf->cycle->modules[i]->ctx; |
914 | 914 |
915 if (m->create_conf) { | 915 if (m->create_conf) { |
916 (*ctx)[ngx_modules[i]->ctx_index] = m->create_conf(cf->cycle); | 916 (*ctx)[cf->cycle->modules[i]->ctx_index] = |
917 if ((*ctx)[ngx_modules[i]->ctx_index] == NULL) { | 917 m->create_conf(cf->cycle); |
918 if ((*ctx)[cf->cycle->modules[i]->ctx_index] == NULL) { | |
918 return NGX_CONF_ERROR; | 919 return NGX_CONF_ERROR; |
919 } | 920 } |
920 } | 921 } |
921 } | 922 } |
922 | 923 |
931 | 932 |
932 if (rv != NGX_CONF_OK) { | 933 if (rv != NGX_CONF_OK) { |
933 return rv; | 934 return rv; |
934 } | 935 } |
935 | 936 |
936 for (i = 0; ngx_modules[i]; i++) { | 937 for (i = 0; cf->cycle->modules[i]; i++) { |
937 if (ngx_modules[i]->type != NGX_EVENT_MODULE) { | 938 if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) { |
938 continue; | 939 continue; |
939 } | 940 } |
940 | 941 |
941 m = ngx_modules[i]->ctx; | 942 m = cf->cycle->modules[i]->ctx; |
942 | 943 |
943 if (m->init_conf) { | 944 if (m->init_conf) { |
944 rv = m->init_conf(cf->cycle, (*ctx)[ngx_modules[i]->ctx_index]); | 945 rv = m->init_conf(cf->cycle, |
946 (*ctx)[cf->cycle->modules[i]->ctx_index]); | |
945 if (rv != NGX_CONF_OK) { | 947 if (rv != NGX_CONF_OK) { |
946 return rv; | 948 return rv; |
947 } | 949 } |
948 } | 950 } |
949 } | 951 } |
1000 } else { | 1002 } else { |
1001 old_ecf = NULL; | 1003 old_ecf = NULL; |
1002 } | 1004 } |
1003 | 1005 |
1004 | 1006 |
1005 for (m = 0; ngx_modules[m]; m++) { | 1007 for (m = 0; cf->cycle->modules[m]; m++) { |
1006 if (ngx_modules[m]->type != NGX_EVENT_MODULE) { | 1008 if (cf->cycle->modules[m]->type != NGX_EVENT_MODULE) { |
1007 continue; | 1009 continue; |
1008 } | 1010 } |
1009 | 1011 |
1010 module = ngx_modules[m]->ctx; | 1012 module = cf->cycle->modules[m]->ctx; |
1011 if (module->name->len == value[1].len) { | 1013 if (module->name->len == value[1].len) { |
1012 if (ngx_strcmp(module->name->data, value[1].data) == 0) { | 1014 if (ngx_strcmp(module->name->data, value[1].data) == 0) { |
1013 ecf->use = ngx_modules[m]->ctx_index; | 1015 ecf->use = cf->cycle->modules[m]->ctx_index; |
1014 ecf->name = module->name->data; | 1016 ecf->name = module->name->data; |
1015 | 1017 |
1016 if (ngx_process == NGX_PROCESS_SINGLE | 1018 if (ngx_process == NGX_PROCESS_SINGLE |
1017 && old_ecf | 1019 && old_ecf |
1018 && old_ecf->use != ecf->use) | 1020 && old_ecf->use != ecf->use) |
1223 } | 1225 } |
1224 | 1226 |
1225 #endif | 1227 #endif |
1226 | 1228 |
1227 if (module == NULL) { | 1229 if (module == NULL) { |
1228 for (i = 0; ngx_modules[i]; i++) { | 1230 for (i = 0; cycle->modules[i]; i++) { |
1229 | 1231 |
1230 if (ngx_modules[i]->type != NGX_EVENT_MODULE) { | 1232 if (cycle->modules[i]->type != NGX_EVENT_MODULE) { |
1231 continue; | 1233 continue; |
1232 } | 1234 } |
1233 | 1235 |
1234 event_module = ngx_modules[i]->ctx; | 1236 event_module = cycle->modules[i]->ctx; |
1235 | 1237 |
1236 if (ngx_strcmp(event_module->name->data, event_core_name.data) == 0) | 1238 if (ngx_strcmp(event_module->name->data, event_core_name.data) == 0) |
1237 { | 1239 { |
1238 continue; | 1240 continue; |
1239 } | 1241 } |
1240 | 1242 |
1241 module = ngx_modules[i]; | 1243 module = cycle->modules[i]; |
1242 break; | 1244 break; |
1243 } | 1245 } |
1244 } | 1246 } |
1245 | 1247 |
1246 if (module == NULL) { | 1248 if (module == NULL) { |