Commit 36025686 authored by Marten Seemann's avatar Marten Seemann

make sure to close the connection if the context is already canceled

parent 7852cb4c
......@@ -57,6 +57,11 @@ func (t *Transport) handshake(ctx context.Context, tlsConn *tls.Conn,
// There's no way to pass a context to tls.Conn.Handshake().
// See https://github.com/golang/go/issues/18482.
// Close the connection instead.
select {
case <-ctx.Done():
tlsConn.Close()
default:
}
done := make(chan struct{})
defer close(done)
go func() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment