Skip to content

Commit

Permalink
Don't wrap conn with a TLS Client if it's already a TLS Conn
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdubbelboer committed May 12, 2020
1 parent dc6b9db commit 9507d7c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,8 @@ func dialAddr(addr string, dial DialFunc, dialDualStack, isTLS bool, tlsConfig *
if conn == nil {
panic("BUG: DialFunc returned (nil, nil)")
}
if isTLS {
_, isTLSAlready := conn.(*tls.Conn)
if isTLS && !isTLSAlready {
if timeout == 0 {
return tls.Client(conn, tlsConfig), nil
}
Expand Down

0 comments on commit 9507d7c

Please sign in to comment.