Skip to content

Commit

Permalink
implemented notify_update_strict
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed Nov 17, 2012
1 parent 52e3819 commit 1ee8979
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions ngx_rtmp_notify_module.c
Expand Up @@ -55,6 +55,7 @@ typedef struct {
ngx_flag_t active;
ngx_uint_t method;
ngx_msec_t update_timeout;
ngx_flag_t update_strict;
} ngx_rtmp_notify_app_conf_t;


Expand Down Expand Up @@ -138,6 +139,13 @@ static ngx_command_t ngx_rtmp_notify_commands[] = {
offsetof(ngx_rtmp_notify_app_conf_t, update_timeout),
NULL },

{ ngx_string("notify_update_strict"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
ngx_conf_set_flag_slot,
NGX_RTMP_APP_CONF_OFFSET,
offsetof(ngx_rtmp_notify_app_conf_t, update_strict),
NULL },

ngx_null_command
};

Expand Down Expand Up @@ -187,6 +195,7 @@ ngx_rtmp_notify_create_app_conf(ngx_conf_t *cf)

nacf->method = NGX_CONF_UNSET;
nacf->update_timeout = NGX_CONF_UNSET;
nacf->update_strict = NGX_CONF_UNSET;

return nacf;
}
Expand Down Expand Up @@ -214,6 +223,7 @@ ngx_rtmp_notify_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
NGX_RTMP_NETCALL_HTTP_POST);
ngx_conf_merge_msec_value(conf->update_timeout, prev->update_timeout,
30000);
ngx_conf_merge_value(conf->update_strict, prev->update_strict, 0);

return NGX_CONF_OK;
}
Expand Down Expand Up @@ -596,21 +606,21 @@ ngx_rtmp_notify_update_handle(ngx_rtmp_session_t *s,
{
ngx_rtmp_notify_app_conf_t *nacf;
ngx_rtmp_notify_ctx_t *ctx;
ngx_int_t rc;

/*
* check only for NGX_ERROR;
* empty or broken reply is not an error in this case
*/
nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module);

if (ngx_rtmp_notify_parse_http_retcode(s, in) == NGX_ERROR) {
rc = ngx_rtmp_notify_parse_http_retcode(s, in);

if ((!nacf->update_strict && rc == NGX_ERROR) ||
(nacf->update_strict && rc != NGX_OK))
{
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"notify: update failed");

return NGX_ERROR;
}

nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module);

ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_notify_module);

ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
Expand Down

0 comments on commit 1ee8979

Please sign in to comment.