fix: Create DaeNetns instance strictly once on reload (#446)

This commit is contained in:
/gray 2024-01-29 18:56:11 +08:00 committed by GitHub
parent 5f3249bcb3
commit 4d6d98c9d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,6 +24,7 @@ const (
var (
daeNetns *DaeNetns
once sync.Once
)
type DaeNetns struct {
@ -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 {