added 'busy' directive

This commit is contained in:
Roman Arutyunyan 2012-10-09 18:22:14 +04:00
parent 72d175ed7f
commit e5d61f2c62
3 changed files with 17 additions and 0 deletions

View file

@ -287,6 +287,7 @@ typedef struct ngx_rtmp_core_srv_conf_s {
size_t max_message;
ngx_flag_t play_time_fix;
ngx_flag_t publish_time_fix;
ngx_flag_t busy;
size_t out_queue;
size_t out_cork;

View file

@ -127,6 +127,13 @@ static ngx_command_t ngx_rtmp_core_commands[] = {
offsetof(ngx_rtmp_core_srv_conf_t, out_cork),
NULL },
{ ngx_string("busy"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_flag_slot,
NGX_RTMP_SRV_CONF_OFFSET,
offsetof(ngx_rtmp_core_srv_conf_t, busy),
NULL },
/* time fixes are needed for flash clients */
{ ngx_string("play_time_fix"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
@ -232,6 +239,7 @@ ngx_rtmp_core_create_srv_conf(ngx_conf_t *cf)
conf->out_cork = NGX_CONF_UNSET;
conf->play_time_fix = NGX_CONF_UNSET;
conf->publish_time_fix = NGX_CONF_UNSET;
conf->busy = NGX_CONF_UNSET;
return conf;
}
@ -258,6 +266,7 @@ ngx_rtmp_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
conf->out_queue / 8);
ngx_conf_merge_value(conf->play_time_fix, prev->play_time_fix, 1);
ngx_conf_merge_value(conf->publish_time_fix, prev->publish_time_fix, 1);
ngx_conf_merge_value(conf->busy, prev->busy, 0);
if (prev->pool == NULL) {
prev->pool = ngx_create_pool(4096, &cf->cycle->new_log);

View file

@ -164,6 +164,13 @@ ngx_rtmp_ping(ngx_event_t *pev)
return;
}
if (cscf->busy) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"ping: not busy between pings");
ngx_rtmp_finalize_session(s);
return;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"ping: schedule %Mms", cscf->ping_timeout);