From c7379be7b69c4d45a9f313838b1baa2da55b2064 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Fri, 19 May 2017 15:44:37 -0700 Subject: [PATCH] grpclb balancer.Close() should not panic if called more than once (#1250) --- grpclb.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grpclb.go b/grpclb.go index 0e4d269b7..8638fc92a 100644 --- a/grpclb.go +++ b/grpclb.go @@ -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()