Incorrectly but handle wildcards in topicNames

This commit is contained in:
bad 2021-10-17 00:03:23 +02:00
parent 272d5e505e
commit a4b5af256d

View file

@ -123,12 +123,9 @@ func (s *SubscriptionTreeNode) matchSubscriptions(fields []string) []*Subscripti
} }
field := fields[0] field := fields[0]
if field == "#" || field == "+" {
// TODO handle gracefully
panic("Wildcard in topic")
}
if child, exists := s.children[field]; exists { // this goes against the spec but I'm lazy so let's just be sane but not really correct
if child, exists := s.children[field]; exists && field != "+" && field != "#" {
sub = append(sub, child.matchSubscriptions(fields[1:])...) sub = append(sub, child.matchSubscriptions(fields[1:])...)
} }
s.NodeLock.RUnlock() s.NodeLock.RUnlock()