Skip to content

Commit 3fc1598

Browse files
committed
implemented proper initializers for exec_static and pull static
1 parent 709b173 commit 3fc1598

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

ngx_rtmp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ static char * ngx_rtmp_merge_applications(ngx_conf_t *cf,
2929
ngx_uint_t ctx_index);
3030

3131

32+
ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue;
33+
34+
3235
ngx_uint_t ngx_rtmp_max_module;
3336

3437

ngx_rtmp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ extern ngx_rtmp_bandwidth_t ngx_rtmp_bw_in;
576576

577577

578578
extern ngx_uint_t ngx_rtmp_naccepted;
579-
579+
extern ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue;
580580

581581
extern ngx_uint_t ngx_rtmp_max_module;
582582
extern ngx_module_t ngx_rtmp_core_module;

ngx_rtmp_exec_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ ngx_rtmp_exec_init_process(ngx_cycle_t *cycle)
335335
e->respawn_evt.data = e;
336336
e->respawn_evt.log = e->log;
337337
e->respawn_evt.handler = ngx_rtmp_exec_respawn;
338-
ngx_post_event((&e->respawn_evt), &ngx_posted_events);
338+
ngx_post_event((&e->respawn_evt), &ngx_rtmp_init_queue);
339339
}
340340

341341
return NGX_OK;

ngx_rtmp_relay_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,7 @@ ngx_rtmp_relay_init_process(ngx_cycle_t *cycle)
16231623
rs->cctx = *lst->ctx;
16241624
rs->cctx.app_conf = cacf->app_conf;
16251625

1626-
ngx_post_event(event, &ngx_posted_events);
1626+
ngx_post_event(event, &ngx_rtmp_init_queue);
16271627
}
16281628
}
16291629
}

ngx_rtmp_stat_module.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "ngx_rtmp_codec_module.h"
1212

1313

14+
static ngx_int_t ngx_rtmp_stat_init_process(ngx_cycle_t *cycle);
1415
static char *ngx_rtmp_stat(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
1516
static ngx_int_t ngx_rtmp_stat_postconfiguration(ngx_conf_t *cf);
1617
static void * ngx_rtmp_stat_create_loc_conf(ngx_conf_t *cf);
@@ -88,7 +89,7 @@ ngx_module_t ngx_rtmp_stat_module = {
8889
NGX_HTTP_MODULE, /* module type */
8990
NULL, /* init master */
9091
NULL, /* init module */
91-
NULL, /* init process */
92+
ngx_rtmp_stat_init_process, /* init process */
9293
NULL, /* init thread */
9394
NULL, /* exit thread */
9495
NULL, /* exit process */
@@ -100,6 +101,21 @@ ngx_module_t ngx_rtmp_stat_module = {
100101
#define NGX_RTMP_STAT_BUFSIZE 256
101102

102103

104+
static ngx_int_t
105+
ngx_rtmp_stat_init_process(ngx_cycle_t *cycle)
106+
{
107+
/*
108+
* HTTP process initializer is called
109+
* after event module initializer
110+
* so we can run posted events here
111+
*/
112+
113+
ngx_event_process_posted(cycle, &ngx_rtmp_init_queue);
114+
115+
return NGX_OK;
116+
}
117+
118+
103119
/* ngx_escape_html does not escape characters out of ASCII range
104120
* which are bad for xslt */
105121

0 commit comments

Comments
 (0)