]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
satip,webui: add client extra ports to the status page, fixes #4881
authorJaroslav Kysela <perex@perex.cz>
Mon, 12 Feb 2018 19:56:29 +0000 (20:56 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 12 Feb 2018 19:56:29 +0000 (20:56 +0100)
src/satip/rtsp.c
src/webui/static/app/status.js

index 1ed0191303db54763e31f47e62567ddb7bddd7bf..6bc98dad4dd392e4c3f5875e36b5c894616382f6 100644 (file)
@@ -1658,6 +1658,9 @@ rtsp_stream_status ( void *opaque, htsmsg_t *m )
 {
   http_connection_t *hc = opaque;
   char buf[128];
+  struct session *rs = NULL;
+  htsmsg_t *c, *l;
+  int udpport, s32;
 
   htsmsg_add_str(m, "type", "SAT>IP");
   if (hc->hc_proxy_ip) {
@@ -1666,6 +1669,31 @@ rtsp_stream_status ( void *opaque, htsmsg_t *m )
   }
   if (hc->hc_username)
     htsmsg_add_str(m, "user", hc->hc_username);
+
+  TAILQ_FOREACH(rs, &rtsp_sessions, link) {
+    if (hc->hc_session &&
+        strcmp(rs->session, hc->hc_session) == 0 &&
+        strcmp(rs->peer_ipstr, hc->hc_peer_ipstr) == 0 &&
+        (udpport = rs->rtp_peer_port) > 0) {
+      if (udpport == RTSP_TCP_DATA) {
+        if (rs->tcp_data == hc) {
+          c = htsmsg_create_map();
+          l = htsmsg_create_list();
+          s32 = htsmsg_get_s32_or_default(m, "peer_port", -1);
+          htsmsg_add_s32(l, NULL, s32);
+          htsmsg_add_msg(c, "tcp", l);
+          htsmsg_add_msg(m, "peer_extra_ports", c);
+        }
+      } else {
+        c = htsmsg_create_map();
+        l = htsmsg_create_list();
+        htsmsg_add_s32(l, NULL, udpport);
+        htsmsg_add_s32(l, NULL, udpport+1);
+        htsmsg_add_msg(c, "udp", l);
+        htsmsg_add_msg(m, "peer_extra_ports", c);
+      }
+    }
+  }
 }
 
 /*
index 0ac4b78e93dd91cf57669bf1c52dc09f46f67331..62e3b67b434d3263017f48489b563865b8ad218d 100644 (file)
@@ -607,6 +607,7 @@ tvheadend.status_conns = function(panel, index) {
                 { name: 'server_port' },
                 { name: 'peer', sortType: stype },
                 { name: 'peer_port' },
+                { name: 'peer_extra_ports' },
                 { name: 'proxy' },
                 { name: 'user', sortType: stype },
                 {
@@ -648,6 +649,23 @@ tvheadend.status_conns = function(panel, index) {
                 header: _("Client Port"),
                 dataIndex: 'peer_port',
                 sortable: true
+            }, {
+                width: 50,
+                id: 'peer_extra_ports',
+                header: _("Client Data Ports"),
+                dataIndex: 'peer_extra_ports',
+                sortable: false,
+                renderer: function(v) {
+                    if (!v) return '';
+                    var o = '';
+                    if ('tcp' in v)
+                        o += _("TCP") + v.tcp.join(',');
+                    if ('udp' in v) {
+                        if (o) o += ';';
+                        o += _("UDP") + v.udp.join(',');
+                    }
+                    return o;
+                }
             }, {
                 width: 50,
                 id: 'user',