mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-29 13:09:34 +02:00
Fix getting client connection port
This commit is contained in:
parent
dc0b3df1b7
commit
3170037e74
|
@ -329,9 +329,7 @@ ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll,
|
||||||
ngx_rtmp_session_t *s)
|
ngx_rtmp_session_t *s)
|
||||||
{
|
{
|
||||||
u_char buf[NGX_INT_T_LEN];
|
u_char buf[NGX_INT_T_LEN];
|
||||||
struct sockaddr_in *tmp;
|
struct sockaddr_in *sa;
|
||||||
struct sockaddr_in sa;
|
|
||||||
socklen_t len = sizeof(struct sockaddr);
|
|
||||||
|
|
||||||
#ifdef NGX_RTMP_POOL_DEBUG
|
#ifdef NGX_RTMP_POOL_DEBUG
|
||||||
ngx_rtmp_stat_dump_pool(r, lll, s->connection->pool);
|
ngx_rtmp_stat_dump_pool(r, lll, s->connection->pool);
|
||||||
|
@ -349,13 +347,9 @@ ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll,
|
||||||
** Displays socket port number
|
** Displays socket port number
|
||||||
*/
|
*/
|
||||||
NGX_RTMP_STAT_L("<port>");
|
NGX_RTMP_STAT_L("<port>");
|
||||||
if (getsockname(s->connection->fd, (struct sockaddr *) &sa, &len) != -1) {
|
sa = (struct sockaddr_in *) s->connection->sockaddr;
|
||||||
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 {
|
|
||||||
// Something not going well?
|
|
||||||
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