diff --git a/node/debug.go b/node/debug.go index fe59f70c4dcd8e9208fdb09189737af88490a715..b39b80e419bbde04f2bc0db61f45afb7176fa84f 100644 --- a/node/debug.go +++ b/node/debug.go @@ -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