mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-06-14 11:05:07 +02:00
Connection info not always available. Show zero port if not.
This commit is contained in:
parent
8c5139650d
commit
63c87e8070
|
@ -349,8 +349,12 @@ ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll,
|
||||||
*/
|
*/
|
||||||
NGX_RTMP_STAT_L("<port>");
|
NGX_RTMP_STAT_L("<port>");
|
||||||
sa = (struct sockaddr_in *) s->connection->sockaddr;
|
sa = (struct sockaddr_in *) s->connection->sockaddr;
|
||||||
|
if (sa) {
|
||||||
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui",
|
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui",
|
||||||
(ngx_uint_t) ntohs(sa->sin_port)) - buf);
|
(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("</port>");
|
NGX_RTMP_STAT_L("</port>");
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue