Skip to content

Commit

Permalink
[dev] merged branch 'MultimediaLearn-nrm-bugfix-autopush-240107'.
Browse files Browse the repository at this point in the history
  • Loading branch information
winshining committed Jan 7, 2024
2 parents 3274d53 + 6a871e3 commit b62de75
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ngx_rtmp_auto_push_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle)
ngx_socket_t s;
size_t n;
ngx_file_info_t fi;
ngx_pid_t pid;

if (ngx_process != NGX_PROCESS_WORKER) {
return NGX_OK;
Expand Down Expand Up @@ -197,9 +198,10 @@ ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle)
return NGX_ERROR;
}
saun->sun_family = AF_UNIX;
pid = ngx_getpid();
*ngx_snprintf((u_char *) saun->sun_path, sizeof(saun->sun_path),
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
&apcf->socket_dir, ngx_process_slot)
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%P",
&apcf->socket_dir, pid)
= 0;

ngx_log_debug1(NGX_LOG_DEBUG_RTMP, cycle->log, 0,
Expand Down Expand Up @@ -352,6 +354,7 @@ ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle)
ngx_listening_t *ls;
ngx_connection_t *c;
size_t n;
ngx_pid_t pid;

apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(cycle->conf_ctx,
ngx_rtmp_auto_push_module);
Expand Down Expand Up @@ -398,9 +401,10 @@ ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle)
}
}

pid = ngx_getpid();
*ngx_snprintf(path, sizeof(path),
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
&apcf->socket_dir, ngx_process_slot)
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%P",
&apcf->socket_dir, pid)
= 0;

ngx_delete_file(path);
Expand Down Expand Up @@ -512,8 +516,8 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
ngx_memzero(&at.url, sizeof(at.url));
u = &at.url.url;
p = ngx_snprintf(path, sizeof(path) - 1,
"unix:%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
&apcf->socket_dir, n);
"unix:%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%P",
&apcf->socket_dir, pid);
*p = 0;

if (ngx_file_info(path + sizeof("unix:") - 1, &fi) != NGX_OK) {
Expand Down

0 comments on commit b62de75

Please sign in to comment.