Revert "op: low performance code (#102)" (#103)

This reverts commit c2248bed2b.
This commit is contained in:
joy.zhou
2021-01-07 16:24:09 +08:00
committed by GitHub
parent c2248bed2b
commit 8f187157f3
+9 -17
View File
@@ -256,24 +256,16 @@ func (this *snode) smatch(topic []byte, qos byte, subs *[]interface{}, qoss *[]b
return err
}
// If the key is "#", then these subscribers are added to the result set
n, ok := this.snodes[MWC]
if ok {
n.matchQos(qos, subs, qoss)
}
n, ok = this.snodes[SWC]
if ok {
if err := n.smatch(rem, qos, subs, qoss); err != nil {
return err
}
}
level := string(ntl)
n, ok = this.snodes[level]
if ok {
if err := n.smatch(rem, qos, subs, qoss); err != nil {
return err
for k, n := range this.snodes {
// If the key is "#", then these subscribers are added to the result set
if k == MWC {
n.matchQos(qos, subs, qoss)
} else if k == SWC || k == level {
if err := n.smatch(rem, qos, subs, qoss); err != nil {
return err
}
}
}