diff options
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go index 9c160e8b..d6aad66c 100644 --- a/server/server.go +++ b/server/server.go @@ -30,6 +30,7 @@ import ( "os" "strconv" "strings" + "sync" "time" ) @@ -37,6 +38,8 @@ const ( GLOBAL_RIB_NAME = "global" ) +var policyMutex sync.RWMutex + type SenderMsg struct { messages []*bgp.BGPMessage sendCh chan *bgp.BGPMessage @@ -2000,6 +2003,8 @@ func (server *BgpServer) policyInUse(x *table.Policy) bool { } func (server *BgpServer) handleGrpcModPolicy(grpcReq *GrpcRequest) error { + policyMutex.Lock() + defer policyMutex.Unlock() arg := grpcReq.Data.(*api.ModPolicyArguments) x, err := table.NewPolicyFromApiStruct(arg.Policy, server.policy.DefinedSetMap) if err != nil { @@ -2121,6 +2126,8 @@ func (server *BgpServer) handleGrpcModPolicyAssignment(grpcReq *GrpcRequest) err var err error var dir table.PolicyDirection var i policyPoint + policyMutex.Lock() + defer policyMutex.Unlock() arg := grpcReq.Data.(*api.ModPolicyAssignmentArguments) assignment := arg.Assignment i, dir, err = server.getPolicyInfo(assignment) |