createTransport: check for SHUTDOWN before assigning TransientFailure to ac.state (#1979)

This commit is contained in:
lyuxuan 2018-04-10 12:48:04 -07:00 committed by GitHub
parent e8d9fec333
commit cf3bf7f774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1252,6 +1252,10 @@ func (ac *addrConn) createTransport(connectRetryNum, ridx int, backoffDeadline,
return true, nil
}
ac.mu.Lock()
if ac.state == connectivity.Shutdown {
ac.mu.Unlock()
return false, errConnClosing
}
ac.state = connectivity.TransientFailure
ac.cc.handleSubConnStateChange(ac.acbw, ac.state)
ac.cc.resolveNow(resolver.ResolveNowOption{})