|
@@ -868,17 +868,16 @@ func AddTagMapWithStaticNodes(netID models.NetworkID,
|
|
if extclient.Tags == nil || extclient.RemoteAccessClientID != "" {
|
|
if extclient.Tags == nil || extclient.RemoteAccessClientID != "" {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
+ if extclient.Mutex != nil {
|
|
|
|
+ extclient.Mutex.Lock()
|
|
|
|
+ }
|
|
for tagID := range extclient.Tags {
|
|
for tagID := range extclient.Tags {
|
|
- tagNodesMap[tagID] = append(tagNodesMap[tagID], models.Node{
|
|
|
|
- IsStatic: true,
|
|
|
|
- StaticNode: extclient,
|
|
|
|
- })
|
|
|
|
- tagNodesMap["*"] = append(tagNodesMap["*"], models.Node{
|
|
|
|
- IsStatic: true,
|
|
|
|
- StaticNode: extclient,
|
|
|
|
- })
|
|
|
|
|
|
+ tagNodesMap[tagID] = append(tagNodesMap[tagID], extclient.ConvertToStaticNode())
|
|
|
|
+ tagNodesMap["*"] = append(tagNodesMap["*"], extclient.ConvertToStaticNode())
|
|
|
|
+ }
|
|
|
|
+ if extclient.Mutex != nil {
|
|
|
|
+ extclient.Mutex.Unlock()
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
return tagNodesMap
|
|
return tagNodesMap
|
|
}
|
|
}
|
|
@@ -893,11 +892,14 @@ func AddTagMapWithStaticNodesWithUsers(netID models.NetworkID,
|
|
if extclient.Tags == nil {
|
|
if extclient.Tags == nil {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
+ if extclient.Mutex != nil {
|
|
|
|
+ extclient.Mutex.Lock()
|
|
|
|
+ }
|
|
for tagID := range extclient.Tags {
|
|
for tagID := range extclient.Tags {
|
|
- tagNodesMap[tagID] = append(tagNodesMap[tagID], models.Node{
|
|
|
|
- IsStatic: true,
|
|
|
|
- StaticNode: extclient,
|
|
|
|
- })
|
|
|
|
|
|
+ tagNodesMap[tagID] = append(tagNodesMap[tagID], extclient.ConvertToStaticNode())
|
|
|
|
+ }
|
|
|
|
+ if extclient.Mutex != nil {
|
|
|
|
+ extclient.Mutex.Unlock()
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -915,9 +917,15 @@ func GetNodesWithTag(tagID models.TagID) map[string]models.Node {
|
|
if nodeI.Tags == nil {
|
|
if nodeI.Tags == nil {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
+ if nodeI.Mutex != nil {
|
|
|
|
+ nodeI.Mutex.Lock()
|
|
|
|
+ }
|
|
if _, ok := nodeI.Tags[tagID]; ok {
|
|
if _, ok := nodeI.Tags[tagID]; ok {
|
|
nMap[nodeI.ID.String()] = nodeI
|
|
nMap[nodeI.ID.String()] = nodeI
|
|
}
|
|
}
|
|
|
|
+ if nodeI.Mutex != nil {
|
|
|
|
+ nodeI.Mutex.Unlock()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return AddStaticNodesWithTag(tag, nMap)
|
|
return AddStaticNodesWithTag(tag, nMap)
|
|
}
|
|
}
|
|
@@ -931,13 +939,15 @@ func AddStaticNodesWithTag(tag models.Tag, nMap map[string]models.Node) map[stri
|
|
if extclient.RemoteAccessClientID != "" {
|
|
if extclient.RemoteAccessClientID != "" {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
+ if extclient.Mutex != nil {
|
|
|
|
+ extclient.Mutex.Lock()
|
|
|
|
+ }
|
|
if _, ok := extclient.Tags[tag.ID]; ok {
|
|
if _, ok := extclient.Tags[tag.ID]; ok {
|
|
- nMap[extclient.ClientID] = models.Node{
|
|
|
|
- IsStatic: true,
|
|
|
|
- StaticNode: extclient,
|
|
|
|
- }
|
|
|
|
|
|
+ nMap[extclient.ClientID] = extclient.ConvertToStaticNode()
|
|
|
|
+ }
|
|
|
|
+ if extclient.Mutex != nil {
|
|
|
|
+ extclient.Mutex.Unlock()
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
return nMap
|
|
return nMap
|
|
}
|
|
}
|
|
@@ -953,10 +963,7 @@ func GetStaticNodeWithTag(tagID models.TagID) map[string]models.Node {
|
|
return nMap
|
|
return nMap
|
|
}
|
|
}
|
|
for _, extclient := range extclients {
|
|
for _, extclient := range extclients {
|
|
- nMap[extclient.ClientID] = models.Node{
|
|
|
|
- IsStatic: true,
|
|
|
|
- StaticNode: extclient,
|
|
|
|
- }
|
|
|
|
|
|
+ nMap[extclient.ClientID] = extclient.ConvertToStaticNode()
|
|
}
|
|
}
|
|
return nMap
|
|
return nMap
|
|
}
|
|
}
|