Skip to content

Commit

Permalink
[mesh]: Use mutex pointer to copy
Browse files Browse the repository at this point in the history
  • Loading branch information
xxx7xxxx committed Aug 24, 2021
1 parent 9a68fb5 commit 2683d88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/object/trafficcontroller/trafficcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ type (
superSpec *supervisor.Spec
spec *Spec

mutex sync.Mutex
// Pointer aims to safely transform it to next generation.
mutex *sync.Mutex
namespaces map[string]*Namespace
}

Expand Down Expand Up @@ -134,6 +135,7 @@ func (tc *TrafficController) DefaultSpec() interface{} {
func (tc *TrafficController) Init(superSpec *supervisor.Spec) {
tc.superSpec, tc.spec, tc.super = superSpec, superSpec.ObjectSpec().(*Spec), superSpec.Super()

tc.mutex = &sync.Mutex{}
tc.namespaces = make(map[string]*Namespace)

tc.reload(nil)
Expand Down

0 comments on commit 2683d88

Please sign in to comment.