Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SAT>IP Server: export active connection for webui
  • Loading branch information
perexg committed Apr 2, 2015
1 parent 1c885f1 commit e4f034a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/satip/rtsp.c
Expand Up @@ -1412,6 +1412,18 @@ rtsp_flush_requests(http_connection_t *hc)
pthread_mutex_unlock(&rtsp_lock);
}

/*
*
*/
static void
rtsp_stream_status ( void *opaque, htsmsg_t *m )
{
http_connection_t *hc = opaque;
htsmsg_add_str(m, "type", "SAT>IP");
if (hc->hc_username)
htsmsg_add_str(m, "user", hc->hc_username);
}

/*
*
*/
Expand All @@ -1420,9 +1432,20 @@ rtsp_serve(int fd, void **opaque, struct sockaddr_storage *peer,
struct sockaddr_storage *self)
{
http_connection_t hc;
access_t aa;
char buf[128];
void *tcp;

memset(&hc, 0, sizeof(http_connection_t));
*opaque = &hc;

memset(&aa, 0, sizeof(aa));
strcpy(buf, "SAT>IP Client ");
tcp_get_ip_str((struct sockaddr *)peer, buf + strlen(buf), sizeof(buf) - strlen(buf));
aa.aa_representative = buf;

tcp = tcp_connection_launch(fd, rtsp_stream_status, &aa);

/* Note: global_lock held on entry */
pthread_mutex_unlock(&global_lock);

Expand All @@ -1441,6 +1464,8 @@ rtsp_serve(int fd, void **opaque, struct sockaddr_storage *peer,
/* Note: leave global_lock held for parent */
pthread_mutex_lock(&global_lock);
*opaque = NULL;

tcp_connection_land(tcp);
}

/*
Expand Down

0 comments on commit e4f034a

Please sign in to comment.