From 63c87e80706b371c751151d34ed2bb3875d01c8e Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: Sun, 31 Jan 2016 18:29:02 +0300 Subject: [PATCH] Connection info not always available. Show zero port if not. --- ngx_rtmp_stat_module.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ngx_rtmp_stat_module.c b/ngx_rtmp_stat_module.c index e0509fb..ba1c646 100644 --- a/ngx_rtmp_stat_module.c +++ b/ngx_rtmp_stat_module.c @@ -349,8 +349,12 @@ ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll, */ NGX_RTMP_STAT_L(""); sa = (struct sockaddr_in *) s->connection->sockaddr; - NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui", + if (sa) { + NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui", (ngx_uint_t) ntohs(sa->sin_port)) - buf); + } else { + NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui", 0) - buf); + } NGX_RTMP_STAT_L("");