Sort channel status channels by name

This commit is contained in:
Jake Nelson 2021-06-29 11:03:14 -04:00 committed by Simon Ser
parent acde97ca37
commit fc841b0ba2

View File

@ -834,9 +834,17 @@ func handleServiceChannelStatus(dc *downstreamConn, params []string) error {
n := 0 n := 0
sendNetwork := func(net *network) { sendNetwork := func(net *network) {
var channels []*Channel
for _, entry := range net.channels.innerMap { for _, entry := range net.channels.innerMap {
ch := entry.value.(*Channel) channels = append(channels, entry.value.(*Channel))
}
sort.Slice(channels, func(i, j int) bool {
return strings.ReplaceAll(channels[i].Name, "#", "") <
strings.ReplaceAll(channels[j].Name, "#", "")
})
for _, ch := range channels {
var uch *upstreamChannel var uch *upstreamChannel
if net.conn != nil { if net.conn != nil {
uch = net.conn.channels.Value(ch.Name) uch = net.conn.channels.Value(ch.Name)