Skip to content

Commit

Permalink
server: fix leaked net.Conn (#4644)
Browse files Browse the repository at this point in the history
This happens when NewServerTransport() returns nil, nil. The rawConn is
closed when the transport is closed, which will never happen in this
case (since the returned transport is nil).

This is a backport of #4633
  • Loading branch information
menghanl committed Aug 3, 2021
1 parent 00edd8c commit b1a15ac
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions server.go
Expand Up @@ -863,6 +863,7 @@ func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) {
// Finish handshaking (HTTP2)
st := s.newHTTP2Transport(conn, authInfo)
if st == nil {
conn.Close()
return
}

Expand Down

0 comments on commit b1a15ac

Please sign in to comment.