Skip to content
Snippets Groups Projects
Commit fad9ebed authored by ale's avatar ale
Browse files

Do not list streams with zero listeners on the debug page

parent 13214073
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,14 @@ type mountStatus struct {
TransMounts []*mountStatus
}
func (m *mountStatus) totalListeners() int {
l := m.Listeners
for _, ms := range m.TransMounts {
l += ms.Listeners
}
return l
}
func newMountStatus(m *pb.Mount, nodes []*nodeInfo, icecastMounts map[string]*pb.IcecastMount) *mountStatus {
var listeners int
for _, n := range nodes {
......@@ -118,6 +126,16 @@ func mountsToStatus(mounts []*pb.Mount, nodes []*nodeInfo, icecastMounts map[str
return msl
}
func filterActiveMountStatus(mounts []*mountStatus) []*mountStatus {
out := make([]*mountStatus, 0, len(mounts))
for _, ms := range mounts {
if ms.totalListeners() > 0 {
out = append(out, ms)
}
}
return out
}
type statusPageHandler struct {
n *Node
domain string
......@@ -144,7 +162,8 @@ func (s *statusPageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
sort.Sort(statusList(statuses))
ms := mountsToStatus(s.n.mounts.GetMounts(), nodes, exemplary)
ms := filterActiveMountStatus(
mountsToStatus(s.n.mounts.GetMounts(), nodes, exemplary))
vars := struct {
Domain string
Nodes []*pb.Status
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment