Skip to content

Commit b62de75

Browse files
committed
[dev] merged branch 'MultimediaLearn-nrm-bugfix-autopush-240107'.
2 parents 3274d53 + 6a871e3 commit b62de75

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

ngx_rtmp_auto_push_module.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle)
141141
ngx_socket_t s;
142142
size_t n;
143143
ngx_file_info_t fi;
144+
ngx_pid_t pid;
144145

145146
if (ngx_process != NGX_PROCESS_WORKER) {
146147
return NGX_OK;
@@ -197,9 +198,10 @@ ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle)
197198
return NGX_ERROR;
198199
}
199200
saun->sun_family = AF_UNIX;
201+
pid = ngx_getpid();
200202
*ngx_snprintf((u_char *) saun->sun_path, sizeof(saun->sun_path),
201-
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
202-
&apcf->socket_dir, ngx_process_slot)
203+
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%P",
204+
&apcf->socket_dir, pid)
203205
= 0;
204206

205207
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, cycle->log, 0,
@@ -352,6 +354,7 @@ ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle)
352354
ngx_listening_t *ls;
353355
ngx_connection_t *c;
354356
size_t n;
357+
ngx_pid_t pid;
355358

356359
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(cycle->conf_ctx,
357360
ngx_rtmp_auto_push_module);
@@ -398,9 +401,10 @@ ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle)
398401
}
399402
}
400403

404+
pid = ngx_getpid();
401405
*ngx_snprintf(path, sizeof(path),
402-
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
403-
&apcf->socket_dir, ngx_process_slot)
406+
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%P",
407+
&apcf->socket_dir, pid)
404408
= 0;
405409

406410
ngx_delete_file(path);
@@ -512,8 +516,8 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
512516
ngx_memzero(&at.url, sizeof(at.url));
513517
u = &at.url.url;
514518
p = ngx_snprintf(path, sizeof(path) - 1,
515-
"unix:%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
516-
&apcf->socket_dir, n);
519+
"unix:%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%P",
520+
&apcf->socket_dir, pid);
517521
*p = 0;
518522

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

0 commit comments

Comments
 (0)