Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clientconn: go idle if conn closed after preface received #5714

Merged
merged 1 commit into from Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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