addressed some comments
This commit is contained in:
@ -76,7 +76,7 @@ type TransportAuthenticator interface {
|
||||
// authentication protocol.
|
||||
Dial(network, addr string) (net.Conn, error)
|
||||
// DialWithDialer connects to the given network address using
|
||||
// dialer.Dialand does the authentication handshake specified by the
|
||||
// dialer.Dial does the authentication handshake specified by the
|
||||
// corresponding authentication protocol. Any timeout or deadline
|
||||
// given in the dialer apply to connection and handshake as a whole.
|
||||
DialWithDialer(dialer *net.Dialer, network, addr string) (net.Conn, error)
|
||||
|
@ -102,7 +102,6 @@ func newHTTP2Client(addr string, opts *DialOptions) (_ ClientTransport, err erro
|
||||
conn net.Conn
|
||||
)
|
||||
scheme := "http"
|
||||
// TODO(zhaoq): Use DialTimeout instead.
|
||||
for _, c := range opts.AuthOptions {
|
||||
if ccreds, ok := c.(credentials.TransportAuthenticator); ok {
|
||||
scheme = "https"
|
||||
@ -110,12 +109,8 @@ func newHTTP2Client(addr string, opts *DialOptions) (_ ClientTransport, err erro
|
||||
// multiple ones provided. Revisit this if it is not appropriate. Probably
|
||||
// place the ClientTransport construction into a separate function to make
|
||||
// things clear.
|
||||
if opts.Timeout > 0 {
|
||||
dialer := &net.Dialer{Timeout: opts.Timeout}
|
||||
conn, connErr = ccreds.DialWithDialer(dialer, "tcp", addr)
|
||||
} else {
|
||||
conn, connErr = ccreds.Dial("tcp", addr)
|
||||
}
|
||||
dialer := &net.Dialer{Timeout: opts.Timeout}
|
||||
conn, connErr = ccreds.DialWithDialer(dialer, "tcp", addr)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user