Skip to content

Commit

Permalink
fix: Create DaeNetns instance strictly once on reload (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwinger233 authored Jan 29, 2024
1 parent 5f3249b commit 4d6d98c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions control/netns_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const (

var (
daeNetns *DaeNetns
once sync.Once
)

type DaeNetns struct {
Expand All @@ -37,9 +38,10 @@ type DaeNetns struct {
}

func InitDaeNetns(log *logrus.Logger) {
daeNetns = &DaeNetns{
log: log,
}
once.Do(func() {
daeNetns = &DaeNetns{}
})
daeNetns.log = log
}

func GetDaeNetns() *DaeNetns {
Expand Down

0 comments on commit 4d6d98c

Please sign in to comment.