From 8d56ace2edb80778379526bfe8add3b093c7618d Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sat, 25 Aug 2012 22:12:29 +0200 Subject: [PATCH] read locking --- zone.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zone.go b/zone.go index 077c77a8..eaa244e9 100644 --- a/zone.go +++ b/zone.go @@ -154,6 +154,8 @@ func (z *Zone) Remove(r RR) error { // Find looks up the ownername s in the zone and returns the // data when found or nil when nothing is found. func (z *Zone) Find(s string) *ZoneData { + z.mutex.RLock() + defer z.mutex.RUnlock() zd := z.Radix.Find(toRadixName(s)) if zd == nil { return nil @@ -163,6 +165,8 @@ func (z *Zone) Find(s string) *ZoneData { // Predecessor searches the zone for a name shorter than s. func (z *Zone) Predecessor(s string) *ZoneData { + z.mutex.RLock() + defer z.mutex.RUnlock() zd := z.Radix.Predecessor(toRadixName(s)) if zd == nil { return nil