Commit cf706531 authored by Ted Yu's avatar Ted Yu Committed by Ted Yu

Use read lock for ServiceHasEndpoints

parent 0889c3e4
......@@ -122,8 +122,8 @@ func isSessionAffinity(affinity *affinityPolicy) bool {
// ServiceHasEndpoints checks whether a service entry has endpoints.
func (lb *LoadBalancerRR) ServiceHasEndpoints(svcPort proxy.ServicePortName) bool {
lb.lock.Lock()
defer lb.lock.Unlock()
lb.lock.RLock()
defer lb.lock.RUnlock()
state, exists := lb.services[svcPort]
// TODO: while nothing ever assigns nil to the map, *some* of the code using the map
// checks for it. The code should all follow the same convention.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment