clientconn: fix potential deadlock caused by ResetConnectBackoff (#3051)

This commit is contained in:
Doug Fawley 2019-09-27 10:51:22 -07:00 committed by GitHub
parent 1950dc9db9
commit e351044388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -875,8 +875,9 @@ func (cc *ClientConn) resolveNow(o resolver.ResolveNowOption) {
// This API is EXPERIMENTAL.
func (cc *ClientConn) ResetConnectBackoff() {
cc.mu.Lock()
defer cc.mu.Unlock()
for ac := range cc.conns {
conns := cc.conns
cc.mu.Unlock()
for ac := range conns {
ac.resetConnectBackoff()
}
}