diff --git a/credentials/credentials.go b/credentials/credentials.go index e7ffc709..e876bb5e 100644 --- a/credentials/credentials.go +++ b/credentials/credentials.go @@ -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) diff --git a/transport/http2_client.go b/transport/http2_client.go index 9740edb5..5a3c1939 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -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 } }