Fix data race in xfr.go (#8039)

Signed-off-by: Ryan Brewster <rpb@anthropic.com>
This commit is contained in:
rpb-ant
2026-04-11 04:39:31 -04:00
committed by GitHub
parent c0e6e7cef3
commit 0ed3aae547
3 changed files with 14 additions and 5 deletions

View File

@@ -146,6 +146,11 @@ func (z *Zone) SetFile(path string) {
func (z *Zone) ApexIfDefined() ([]dns.RR, error) {
z.RLock()
defer z.RUnlock()
return z.apexIfDefinedLocked()
}
// apexIfDefinedLocked is ApexIfDefined without locking; caller must hold z's read lock.
func (z *Zone) apexIfDefinedLocked() ([]dns.RR, error) {
if z.SOA == nil {
return nil, fmt.Errorf("no SOA")
}