Skip to content

Commit b1a15ac

Browse files
authored
server: fix leaked net.Conn (#4644)
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
1 parent 00edd8c commit b1a15ac

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) {
863863
// Finish handshaking (HTTP2)
864864
st := s.newHTTP2Transport(conn, authInfo)
865865
if st == nil {
866+
conn.Close()
866867
return
867868
}
868869

0 commit comments

Comments
 (0)