Skip to content

Commit

Permalink
clientconn: go idle if conn closed after preface received (#5714)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuweid committed Oct 18, 2022
1 parent 778860e commit 79ccdd8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion clientconn.go
Expand Up @@ -1325,9 +1325,15 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne
return nil
case <-connClosed.Done():
// 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 {
case <-prefaceReceived.Done():
ac.mu.Lock()
defer ac.mu.Unlock()

if ac.state != connectivity.Shutdown {
ac.updateConnectivityState(connectivity.Idle, nil)
}
return nil
default:
return errors.New("connection closed before server preface received")
Expand Down

0 comments on commit 79ccdd8

Please sign in to comment.