Welcome! Log In Create A New Profile

Advanced

master exit почему-то не видит все с main_conf

Posted by JPascal 
master exit почему-то не видит все с main_conf
August 16, 2011 09:11AM
Имею следующее:

static ngx_http_module_t rpm_module_ctx = {
NULL, /* preconfiguration */
NULL, /* postconfiguration */

rpm_create_main_conf, /* create main configuration */
NULL, /* init main configuration */

NULL, /* create server configuration */
NULL, /* merge server configuration */

rpm_create_loc_conf, /* create location configuration */
NULL /* merge location configuration */
};

ngx_module_t rpm_module = {
NGX_MODULE_V1,
&rpm_module_ctx, /* module context */
(ngx_command_t *) rpm_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
rpm_init_module, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
NULL, /* exit process */
rpm_exit_master, /* exit master */
NGX_MODULE_V1_PADDING
};


static void rpm_exit_master(ngx_cycle_t *cycle) {
rpm_main_conf_t *rpmcf;
rpmcf = ngx_http_cycle_get_module_main_conf(cycle, rpm_module);
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "RPM: size %l ", rpmcf->applications.nelts);
}

Тут в лог всегда выводится: RPM: size 0

static void *rpm_create_main_conf(ngx_conf_t *cf) {
rpm_main_conf_t *rpmcf;
rpmcf = ngx_pcalloc(cf->pool, sizeof(rpm_main_conf_t));
if (rpmcf == NULL) {
return NGX_CONF_ERROR;
}
if (ngx_array_init(&rpmcf->applications, cf->pool, 1,
sizeof(rpm_application_t *))
!= NGX_OK)
{
return NULL;
}
return rpmcf;
}

Так же есть:
ngx_int_t rpm_content_handler(ngx_http_request_t *r) {
rpm_main_conf_t *rpmcf;
rpmcf = ngx_http_get_module_main_conf(r, rpm_module);
rpm_application_t *application = ngx_array_push(&rpmcf->applications);
ngx_log_error(NGX_LOG_EMERG, r->connection->log, 0, "RPM: size %l ", rpmcf->applications.nelts);
}
Тут в лог всегда выводится реальный размер rpmcf->applications: RPM: size X

Почему в rpm_exit_master другие данные?
Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 192
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready