From d6f3debd73a533470e9b92ccbe66f55a0ca41c1d Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sat, 24 Jan 2026 14:50:19 -0800 Subject: [PATCH] Fix duplicate node creation from pre-joined DisplayName --- dante.go | 19 +++++++++++-------- log | 2 ++ 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 log diff --git a/dante.go b/dante.go index fb77b24..32c3dba 100644 --- a/dante.go +++ b/dante.go @@ -99,22 +99,22 @@ func (n *Nodes) UpdateDanteTxChannels(name string, ip net.IP, channels string) { node.DanteTxChannels = channels } -func (n *Nodes) GetDanteTxDeviceInGroup(groupIP net.IP) string { +func (n *Nodes) GetDanteTxDeviceInGroup(groupIP net.IP) *Node { n.mu.RLock() defer n.mu.RUnlock() groupKey := groupIP.String() gm := n.multicastGroups[groupKey] if gm == nil { - return "" + return nil } for _, membership := range gm.Members { if membership.Node != nil && membership.Node.DanteTxChannels != "" { - return membership.Node.DisplayName() + return membership.Node } } - return "" + return nil } var danteSeqID uint32 @@ -881,14 +881,17 @@ func (t *Tendrils) probeDanteDeviceWithPort(ip net.IP, port int) { if needIGMPFallback { groups := t.nodes.GetDanteMulticastGroups(ip) for _, groupIP := range groups { - sourceName := t.nodes.GetDanteTxDeviceInGroup(groupIP) + sourceNode := t.nodes.GetDanteTxDeviceInGroup(groupIP) if t.DebugDante { + sourceName := "" + if sourceNode != nil { + sourceName = sourceNode.DisplayName() + } log.Printf("[dante] %s: multicast group %s -> tx device %q", ip, groupIP, sourceName) } - if sourceName == "" { - sourceName = multicastGroupName(groupIP) + if sourceNode == nil { + sourceNode = t.nodes.GetOrCreateByName(multicastGroupName(groupIP)) } - sourceNode := t.nodes.GetOrCreateByName(sourceName) subscriberNode := t.nodes.GetOrCreateByName(info.Name) t.danteFlows.Update(sourceNode, subscriberNode, "", DanteFlowActive) } diff --git a/log b/log new file mode 100644 index 0000000..a040808 --- /dev/null +++ b/log @@ -0,0 +1,2 @@ +2026/01/24 14:49:57 [http] listening on :80 +2026/01/24 14:49:57 [iface] add: en0