Skip to content

Commit 8772040

Browse files
committed
[fix] fixed bad status of stop request for record.
If record is set as manual and nginx is run in multi-processes mode, record requests may be distributed to a non-publisher. Previously, if stop request for record was sent to a non-publisher, ngx_rtmp_record_init was called without checking if record context was already initialized, that led to a bad status (204) replied.
1 parent 93496d0 commit 8772040

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ngx_rtmp_record_module.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,10 @@ ngx_rtmp_record_init(ngx_rtmp_session_t *s)
612612

613613
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_record_module);
614614

615+
if (ctx->rec.nelts) {
616+
return NGX_OK;
617+
}
618+
615619
if (ngx_array_init(&ctx->rec, s->connection->pool, racf->rec.nelts,
616620
sizeof(ngx_rtmp_record_rec_ctx_t))
617621
!= NGX_OK)

ngx_rtmp_stat_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ ngx_rtmp_stat_application_recorders(ngx_http_request_t *r, ngx_chain_t ***lll,
11711171
NGX_RTMP_STAT_L("\"count\":");
11721172
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
11731173
"%ui", racf->rec.nelts) - buf);
1174-
NGX_RTMP_STAT_L(",\"lists\":[");
1174+
NGX_RTMP_STAT_L(",\"lists\":[");
11751175
}
11761176

11771177
rracf = racf->rec.elts;

0 commit comments

Comments
 (0)