mirror of https://github.com/grpc/grpc-go.git
clientconn: go idle if conn closed after preface received (#5714)
This commit is contained in:
parent
778860e606
commit
79ccdd8f8e
|
@ -1325,9 +1325,15 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne
|
||||||
return nil
|
return nil
|
||||||
case <-connClosed.Done():
|
case <-connClosed.Done():
|
||||||
// The transport has already closed. If we received the preface, too,
|
// The transport has already closed. If we received the preface, too,
|
||||||
// this is not an error.
|
// this is not an error and go idle.
|
||||||
select {
|
select {
|
||||||
case <-prefaceReceived.Done():
|
case <-prefaceReceived.Done():
|
||||||
|
ac.mu.Lock()
|
||||||
|
defer ac.mu.Unlock()
|
||||||
|
|
||||||
|
if ac.state != connectivity.Shutdown {
|
||||||
|
ac.updateConnectivityState(connectivity.Idle, nil)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
return errors.New("connection closed before server preface received")
|
return errors.New("connection closed before server preface received")
|
||||||
|
|
Loading…
Reference in New Issue