add additional mutex lock on node acls func

This commit is contained in:
abhishek9686 2024-03-23 12:59:07 +07:00
parent 3152c678e0
commit 5325f0e7d7

View file

@ -3,12 +3,17 @@ package nodeacls
import (
"encoding/json"
"fmt"
"sync"
"github.com/gravitl/netmaker/logic/acls"
)
var NodesAllowedACLMutex = &sync.Mutex{}
// AreNodesAllowed - checks if nodes are allowed to communicate in their network ACL
func AreNodesAllowed(networkID NetworkID, node1, node2 NodeID) bool {
NodesAllowedACLMutex.Lock()
defer NodesAllowedACLMutex.Unlock()
var currentNetworkACL, err = FetchAllACLs(networkID)
if err != nil {
return false