mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-19 01:31:09 +02:00
Display socket port number for each rtmp connection
This commit is contained in:
parent
f62a083806
commit
70c90bbac5
|
@ -329,7 +329,10 @@ ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll,
|
|||
ngx_rtmp_session_t *s)
|
||||
{
|
||||
u_char buf[NGX_INT_T_LEN];
|
||||
|
||||
struct sockaddr_in *tmp;
|
||||
struct sockaddr_in sa;
|
||||
socklen_t len = sizeof(struct sockaddr);
|
||||
|
||||
#ifdef NGX_RTMP_POOL_DEBUG
|
||||
ngx_rtmp_stat_dump_pool(r, lll, s->connection->pool);
|
||||
#endif
|
||||
|
@ -342,6 +345,24 @@ ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll,
|
|||
NGX_RTMP_STAT_ES(&s->connection->addr_text);
|
||||
NGX_RTMP_STAT_L("</address>");
|
||||
|
||||
/*
|
||||
** Displays socket port number
|
||||
*/
|
||||
NGX_RTMP_STAT_L("<port>");
|
||||
if (s->connection->listening)
|
||||
{
|
||||
tmp = (struct sockaddr_in *) s->connection->listening->sockaddr;
|
||||
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui",
|
||||
(ngx_uint_t) ntohs(tmp->sin_port)) - buf);
|
||||
}
|
||||
else if (getsockname(s->connection->fd, (struct sockaddr *) &sa, &len) != -1)
|
||||
{
|
||||
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui",
|
||||
(ngx_uint_t) ntohs(sa.sin_port)) - buf);
|
||||
}
|
||||
NGX_RTMP_STAT_L("</port>");
|
||||
|
||||
|
||||
NGX_RTMP_STAT_L("<time>");
|
||||
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%i",
|
||||
(ngx_int_t) (ngx_current_msec - s->epoch)) - buf);
|
||||
|
|
Loading…
Reference in a new issue