diff --git a/ngx_rtmp.c b/ngx_rtmp.c index 1962f5e..cd59825 100644 --- a/ngx_rtmp.c +++ b/ngx_rtmp.c @@ -29,6 +29,9 @@ static char * ngx_rtmp_merge_applications(ngx_conf_t *cf, ngx_uint_t ctx_index); +ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue; + + ngx_uint_t ngx_rtmp_max_module; diff --git a/ngx_rtmp.h b/ngx_rtmp.h index 6222503..9ac520a 100644 --- a/ngx_rtmp.h +++ b/ngx_rtmp.h @@ -576,7 +576,7 @@ extern ngx_rtmp_bandwidth_t ngx_rtmp_bw_in; extern ngx_uint_t ngx_rtmp_naccepted; - +extern ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue; extern ngx_uint_t ngx_rtmp_max_module; extern ngx_module_t ngx_rtmp_core_module; diff --git a/ngx_rtmp_exec_module.c b/ngx_rtmp_exec_module.c index 28ce2d6..3d309f2 100644 --- a/ngx_rtmp_exec_module.c +++ b/ngx_rtmp_exec_module.c @@ -335,7 +335,7 @@ ngx_rtmp_exec_init_process(ngx_cycle_t *cycle) e->respawn_evt.data = e; e->respawn_evt.log = e->log; e->respawn_evt.handler = ngx_rtmp_exec_respawn; - ngx_post_event((&e->respawn_evt), &ngx_posted_events); + ngx_post_event((&e->respawn_evt), &ngx_rtmp_init_queue); } return NGX_OK; diff --git a/ngx_rtmp_relay_module.c b/ngx_rtmp_relay_module.c index b36aa04..9f6a6cf 100644 --- a/ngx_rtmp_relay_module.c +++ b/ngx_rtmp_relay_module.c @@ -1623,7 +1623,7 @@ ngx_rtmp_relay_init_process(ngx_cycle_t *cycle) rs->cctx = *lst->ctx; rs->cctx.app_conf = cacf->app_conf; - ngx_post_event(event, &ngx_posted_events); + ngx_post_event(event, &ngx_rtmp_init_queue); } } } diff --git a/ngx_rtmp_stat_module.c b/ngx_rtmp_stat_module.c index e4337ff..ce636ad 100644 --- a/ngx_rtmp_stat_module.c +++ b/ngx_rtmp_stat_module.c @@ -11,6 +11,7 @@ #include "ngx_rtmp_codec_module.h" +static ngx_int_t ngx_rtmp_stat_init_process(ngx_cycle_t *cycle); static char *ngx_rtmp_stat(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static ngx_int_t ngx_rtmp_stat_postconfiguration(ngx_conf_t *cf); static void * ngx_rtmp_stat_create_loc_conf(ngx_conf_t *cf); @@ -88,7 +89,7 @@ ngx_module_t ngx_rtmp_stat_module = { NGX_HTTP_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ - NULL, /* init process */ + ngx_rtmp_stat_init_process, /* init process */ NULL, /* init thread */ NULL, /* exit thread */ NULL, /* exit process */ @@ -100,6 +101,21 @@ ngx_module_t ngx_rtmp_stat_module = { #define NGX_RTMP_STAT_BUFSIZE 256 +static ngx_int_t +ngx_rtmp_stat_init_process(ngx_cycle_t *cycle) +{ + /* + * HTTP process initializer is called + * after event module initializer + * so we can run posted events here + */ + + ngx_event_process_posted(cycle, &ngx_rtmp_init_queue); + + return NGX_OK; +} + + /* ngx_escape_html does not escape characters out of ASCII range * which are bad for xslt */