修改重复的订阅报错的bug

This commit is contained in:
wangjian 2023-04-05 21:57:41 +08:00
parent abb93c020f
commit a4ea724bab
1 changed files with 10 additions and 11 deletions

View File

@ -6,7 +6,6 @@ import (
"sync" "sync"
"git.hpds.cc/Component/network/frame" "git.hpds.cc/Component/network/frame"
herr "git.hpds.cc/Component/network/hpds_err"
"git.hpds.cc/Component/network/metadata" "git.hpds.cc/Component/network/metadata"
) )
@ -64,16 +63,16 @@ func (r *defaultRoute) Add(connId string, name string, observeDataTags []frame.T
return fmt.Errorf("SFN[%s] does not exist in config functions", name) return fmt.Errorf("SFN[%s] does not exist in config functions", name)
} }
LOOP: //LOOP:
for _, conn := range r.data { //for _, conn := range r.data {
for connId, n := range conn { // for connId, n := range conn {
if n == name { // if n == name {
err = herr.NewDuplicateNameError(connId, fmt.Errorf("SFN[%s] is already linked to another connection", name)) // err = herr.NewDuplicateNameError(connId, fmt.Errorf("SFN[%s] is already linked to another connection", name))
delete(conn, connId) // delete(conn, connId)
break LOOP // break LOOP
} // }
} // }
} //}
for _, tag := range observeDataTags { for _, tag := range observeDataTags {
conn := r.data[tag] conn := r.data[tag]