grpclb balancer.Close() should not panic if called more than once (#1250)

This commit is contained in:
Menghan Li
2017-05-19 15:44:37 -07:00
committed by GitHub
parent 074dbfbc52
commit c7379be7b6

View File

@ -745,6 +745,9 @@ func (b *balancer) Notify() <-chan []Address {
func (b *balancer) Close() error {
b.mu.Lock()
defer b.mu.Unlock()
if b.done {
return errBalancerClosed
}
b.done = true
if b.expTimer != nil {
b.expTimer.Stop()