mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-14 08:01:07 +02:00
fixed http handlers stat/control
This commit is contained in:
parent
612fc4dd75
commit
e68add616c
|
@ -11,7 +11,7 @@
|
|||
#include "ngx_rtmp_record_module.h"
|
||||
|
||||
|
||||
static ngx_int_t ngx_rtmp_control_postconfiguration(ngx_conf_t *cf);
|
||||
static char *ngx_rtmp_control(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||
static void * ngx_rtmp_control_create_loc_conf(ngx_conf_t *cf);
|
||||
static char * ngx_rtmp_control_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
|
@ -52,7 +52,7 @@ static ngx_command_t ngx_rtmp_control_commands[] = {
|
|||
|
||||
{ ngx_string("rtmp_control"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
|
||||
ngx_conf_set_bitmask_slot,
|
||||
ngx_rtmp_control,
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
offsetof(ngx_rtmp_control_loc_conf_t, control),
|
||||
ngx_rtmp_control_masks },
|
||||
|
@ -63,7 +63,7 @@ static ngx_command_t ngx_rtmp_control_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_rtmp_control_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
ngx_rtmp_control_postconfiguration, /* postconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -511,19 +511,13 @@ ngx_rtmp_control_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_rtmp_control_postconfiguration(ngx_conf_t *cf)
|
||||
static char *
|
||||
ngx_rtmp_control(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
|
||||
clcf->handler = ngx_rtmp_control_handler;
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
*h = ngx_rtmp_control_handler;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
return ngx_conf_set_bitmask_slot(cf, cmd, conf);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "ngx_rtmp_codec_module.h"
|
||||
|
||||
|
||||
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);
|
||||
static char * ngx_rtmp_stat_merge_loc_conf(ngx_conf_t *cf,
|
||||
|
@ -49,7 +50,7 @@ static ngx_command_t ngx_rtmp_stat_commands[] = {
|
|||
|
||||
{ ngx_string("rtmp_stat"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
|
||||
ngx_conf_set_bitmask_slot,
|
||||
ngx_rtmp_stat,
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
offsetof(ngx_rtmp_stat_loc_conf_t, stat),
|
||||
ngx_rtmp_stat_masks },
|
||||
|
@ -622,22 +623,22 @@ ngx_rtmp_stat_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
}
|
||||
|
||||
|
||||
static char *
|
||||
ngx_rtmp_stat(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
||||
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
|
||||
clcf->handler = ngx_rtmp_stat_handler;
|
||||
|
||||
return ngx_conf_set_bitmask_slot(cf, cmd, conf);
|
||||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_rtmp_stat_postconfiguration(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
*h = ngx_rtmp_stat_handler;
|
||||
|
||||
start_time = ngx_cached_time->sec;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue