1、去除只能订阅一次的问题

This commit is contained in:
wangjian 2023-03-07 17:48:26 +08:00
parent 37f7ba99ea
commit 753c4fe9c8
1 changed files with 11 additions and 12 deletions

View File

@ -3,7 +3,6 @@ package hpds_node
import ( import (
"fmt" "fmt"
"git.hpds.cc/Component/network" "git.hpds.cc/Component/network"
"git.hpds.cc/Component/network/hpds_err"
"git.hpds.cc/pavement/hpds_node/config" "git.hpds.cc/pavement/hpds_node/config"
"sync" "sync"
) )
@ -51,17 +50,17 @@ func (r *route) Add(connId string, name string, observeDataTags []byte) (err err
if !ok { if !ok {
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 _, connects := range r.data { //for _, connects := range r.data {
for connKey, n := range connects { // for connKey, n := range connects {
if n == name { // if n == name {
err = hpds_err.NewDuplicateNameError(connKey, fmt.Errorf("node:Stream Function[%s] is already linked to another connection", name)) // err = hpds_err.NewDuplicateNameError(connKey, fmt.Errorf("node:Stream Function[%s] is already linked to another connection", name))
delete(connects, connKey) // delete(connects, connKey)
break LOOP // break LOOP
} // }
} // }
} //}
for _, tag := range observeDataTags { for _, tag := range observeDataTags {
connects := r.data[tag] connects := r.data[tag]