addressed some comments

This commit is contained in:
iamqizhao
2015-03-04 13:20:21 -08:00
parent 28ad38be17
commit 8304bc408e
2 changed files with 3 additions and 8 deletions

View File

@ -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)

View File

@ -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
}
}