Skip to content

Commit 3c5a0ea

Browse files
committed
[fix] fix logic error of log.
1 parent a74d000 commit 3c5a0ea

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

ngx_rtmp_relay_module.c

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
/*
3-
* Copyright (C) Roman Arutyunyan
3+
* Copyright (C) Roman Arutyunyan
4+
* Copyright (C) Winshining
45
*/
56

67

@@ -337,6 +338,9 @@ ngx_rtmp_relay_create_connection(ngx_rtmp_conf_ctx_t *cctx, ngx_str_t* name,
337338
ngx_int_t rc;
338339
ngx_str_t v, *uri;
339340
u_char *first, *last, *p;
341+
#if (NGX_HAVE_UNIX_DOMAIN)
342+
u_char *client;
343+
#endif
340344

341345
racf = ngx_rtmp_get_module_app_conf(cctx, ngx_rtmp_relay_module);
342346

@@ -461,7 +465,25 @@ ngx_rtmp_relay_create_connection(ngx_rtmp_conf_ctx_t *cctx, ngx_str_t* name,
461465
}
462466
c = pc->connection;
463467
c->pool = pool;
464-
c->addr_text = rctx->url;
468+
469+
#if (NGX_HAVE_UNIX_DOMAIN)
470+
if (addr->sockaddr->sa_family == AF_UNIX) {
471+
client = ngx_pcalloc(pool, rctx->url.len + 8);
472+
if (client == NULL) {
473+
return NULL;
474+
}
475+
476+
*ngx_cpymem(client, rctx->url.data,
477+
ngx_strlen(rctx->url.data)) = 0;
478+
479+
p = (u_char *) ngx_strchr(client, '.');
480+
*ngx_snprintf(p + 1, client + rctx->url.len + 8 - (p + 1), "%i",
481+
ngx_process_slot) = 0;
482+
483+
c->addr_text.data = client;
484+
c->addr_text.len = ngx_strlen(client);
485+
}
486+
#endif
465487

466488
addr_conf = ngx_pcalloc(pool, sizeof(ngx_rtmp_addr_conf_t));
467489
if (addr_conf == NULL) {

0 commit comments

Comments
 (0)