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.
This commit is contained in:
Alex Mullins
2016-08-08 07:11:07 -05:00
parent efa105d0d2
commit 32bc9f2357

View File

@ -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