Skip to content

Commit

Permalink
Remove conn.Close() in tlsCred.ServerHandshake()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexmullins committed Aug 8, 2016
1 parent efa105d commit 32bc9f2
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion credentials/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 32bc9f2

Please sign in to comment.