mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-08 05:41:08 +02:00
fixed auto-pushing to non-worker child processes (cache loader & cache manager)
This commit is contained in:
parent
709b173bdc
commit
76f433fb45
|
@ -309,6 +309,7 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
|
|||
u_char *p;
|
||||
ngx_str_t *u;
|
||||
ngx_pid_t pid;
|
||||
char *pname;
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||
"auto_push: reconnect");
|
||||
|
@ -346,6 +347,20 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
|
|||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a dirty way to skip "cache manager" and
|
||||
* "cache loader" processes when pushing streams.
|
||||
*/
|
||||
|
||||
pname = ngx_processes[n].name;
|
||||
if (ngx_strstr(pname, "cache")) {
|
||||
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||
"auto_push: skip process slot=%i pid=%i "
|
||||
"name='%s' pname='%s'",
|
||||
n, (ngx_int_t) pid, ctx->name, pname);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (*slot) {
|
||||
continue;
|
||||
}
|
||||
|
@ -373,10 +388,10 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
|
|||
at.flash_ver.data = flash_ver;
|
||||
at.flash_ver.len = p - flash_ver;
|
||||
|
||||
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||
ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||
"auto_push: connect slot=%i pid=%i socket='%s' "
|
||||
"name='%s'",
|
||||
n, (ngx_int_t) pid, path, ctx->name);
|
||||
"name='%s' pname='%s'",
|
||||
n, (ngx_int_t) pid, path, ctx->name, pname);
|
||||
|
||||
if (ngx_rtmp_relay_push(s, &name, &at) == NGX_OK) {
|
||||
*slot = 1;
|
||||
|
@ -385,8 +400,8 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
|
|||
|
||||
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
|
||||
"auto_push: connect failed: slot=%i pid=%i socket='%s'"
|
||||
"url='%V' name='%s'",
|
||||
n, (ngx_int_t) pid, path, u, ctx->name);
|
||||
"url='%V' name='%s' pname='%s'",
|
||||
n, (ngx_int_t) pid, path, u, ctx->name, pname);
|
||||
|
||||
if (!ctx->push_evt.timer_set) {
|
||||
ngx_add_timer(&ctx->push_evt, apcf->push_reconnect);
|
||||
|
|
Loading…
Reference in a new issue