Skip to content

Commit

Permalink
server: fix leaked net.Conn (grpc#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 grpc#4633
  • Loading branch information
menghanl authored 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
Original file line number Diff line number Diff line change
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.