mirror of https://github.com/grpc/grpc-go.git
grpclb balancer.Close() should not panic if called more than once (#1250)
This commit is contained in:
parent
074dbfbc52
commit
c7379be7b6
|
|
@ -745,6 +745,9 @@ func (b *balancer) Notify() <-chan []Address {
|
||||||
func (b *balancer) Close() error {
|
func (b *balancer) Close() error {
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
defer b.mu.Unlock()
|
defer b.mu.Unlock()
|
||||||
|
if b.done {
|
||||||
|
return errBalancerClosed
|
||||||
|
}
|
||||||
b.done = true
|
b.done = true
|
||||||
if b.expTimer != nil {
|
if b.expTimer != nil {
|
||||||
b.expTimer.Stop()
|
b.expTimer.Stop()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue