Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added 'busy' directive

  • Loading branch information...
commit e5d61f2c62b7303c4708bcce78984b7e5105b92c 1 parent 72d175e
@arut authored
Showing with 17 additions and 0 deletions.
  1. +1 −0  ngx_rtmp.h
  2. +9 −0 ngx_rtmp_core_module.c
  3. +7 −0 ngx_rtmp_handler.c
View
1  ngx_rtmp.h
@@ -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
9 ngx_rtmp_core_module.c
@@ -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
7 ngx_rtmp_handler.c
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.