From 4f9bfd216fa905aac56d6b9da4964511af11045c Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Fri, 26 Dec 2025 09:18:11 +0800 Subject: [PATCH] chore: add some comments for the finalizer --- component/ca/keypair.go | 2 +- component/ech/key.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/component/ca/keypair.go b/component/ca/keypair.go index ff9086d1..d0488572 100644 --- a/component/ca/keypair.go +++ b/component/ca/keypair.go @@ -52,7 +52,7 @@ func NewTLSKeyPairLoader(certificate, privateKey string) (func() (*tls.Certifica if loadErr != nil { return nil, fmt.Errorf("parse certificate failed, maybe format error:%s, or path error: %s", painTextErr.Error(), loadErr.Error()) } - gcFlag := new(os.File) + gcFlag := new(os.File) // tiny (on the order of 16 bytes or less) and pointer-free objects may never run the finalizer, so we choose new an os.File updateMutex := sync.RWMutex{} if watcher, err := fswatch.NewWatcher(fswatch.Options{Path: []string{certificate, privateKey}, Callback: func(path string) { updateMutex.Lock() diff --git a/component/ech/key.go b/component/ech/key.go index 4911b90f..3f74a75e 100644 --- a/component/ech/key.go +++ b/component/ech/key.go @@ -132,7 +132,7 @@ func LoadECHKey(key string, tlsConfig *tls.Config) error { if loadErr != nil { return fmt.Errorf("parse ECH keys failed, maybe format error:%s, or path error: %s", painTextErr.Error(), loadErr.Error()) } - gcFlag := new(os.File) + gcFlag := new(os.File) // tiny (on the order of 16 bytes or less) and pointer-free objects may never run the finalizer, so we choose new an os.File updateMutex := sync.RWMutex{} if watcher, err := fswatch.NewWatcher(fswatch.Options{Path: []string{key}, Callback: func(path string) { updateMutex.Lock()