From 32bc9f23570c01df1fb580d8cf7ea563528daa71 Mon Sep 17 00:00:00 2001 From: Alex Mullins Date: Mon, 8 Aug 2016 07:11:07 -0500 Subject: [PATCH] Remove conn.Close() in tlsCred.ServerHandshake() Removes the responsibility from tlsCred.ServerHandshake() of calling Close() on the underlying connection. Returning an error is enough to close the connection: https://github.com/grpc/grpc-go/blob/master/server.go#L370. --- credentials/credentials.go | 1 - 1 file changed, 1 deletion(-) diff --git a/credentials/credentials.go b/credentials/credentials.go index b6277bf804a9..3f17b70628ed 100644 --- a/credentials/credentials.go +++ b/credentials/credentials.go @@ -167,7 +167,6 @@ func (c *tlsCreds) ClientHandshake(ctx context.Context, addr string, rawConn net func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { conn := tls.Server(rawConn, c.config) if err := conn.Handshake(); err != nil { - rawConn.Close() return nil, nil, err } return conn, TLSInfo{conn.ConnectionState()}, nil