Handling Events
which conforms to ngx_event_module there are two modules are ngx_event_core_module, Ngx_epoll_module
Core code
Ngx_modules[i]->ctx_index = ngx_event_max_module++;//Set Module Internal Index} CTX = Ngx_pcalloc (Cf->pool, sizeof (void *)); if (CTX = = NULL) {return ngx_conf_error; } *ctx = Ngx_pcalloc (cf->pool, ngx_event_max_module * sizeof (void *));//ctx points to array if (*ctx = = NULL) { return ngx_conf_error; } * (void * *) conf = CTX; for (i = 0; ngx_modules[i]; i++) {if (Ngx_modules[i]->type! = Ngx_event_module) {continue; } m = ngx_modules[i]->ctx; if (m->create_conf) {//If the Ngx_event_module type module exists create_conf function then call the module's create_conf function and mount it to the EVENT context (*CTX) [Ngx _modules[i]->ctx_index] = m->create_conf (cf->cycle);//Create the appropriate context if ((*CTX) [Ngx_modules[i]->ctx_inde X] = = NULL) {return NGx_conf_error; }}} PCF = *CF; Cf->ctx = CTX; Cf->module_type = ngx_event_module;//Set module Environment cf->cmd_type = ngx_event_conf;//SET Command Type RV = Ngx_conf_parse (cf, NULL) ;
Then parse worker_connections1024, the command in Ngx_event_core_module, call the Ngx_event_connections function, set the Connect value to 1024, the structure is as follows:
[Nginx Source parsing] Configuration resolution (event scope)