Skip to content

Commit

Permalink
Fix connection leak in case client cannot initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
jbreich committed Jun 21, 2023
1 parent 8d9b3ed commit 1d3bce5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ func newClientConnWithSetup(c net.Conn, config *ConnConfig) (*ClientConn, error)
if err := handshake.HandshakeWithServer(conn.rwc, conn.rwc, &handshake.Config{
SkipHandshakeVerification: conn.config.SkipHandshakeVerification,
}); err != nil {
_ = conn.Close()
return nil, errors.Wrap(err, "Failed to handshake")
}

ctrlStream, err := conn.streams.Create(ControlStreamID)
if err != nil {
_ = conn.Close()
return nil, errors.Wrap(err, "Failed to create control stream")
}
ctrlStream.handler.ChangeState(streamStateClientNotConnected)
Expand Down

0 comments on commit 1d3bce5

Please sign in to comment.