From 2ac2d85a1b32871e6d0a0593c47b0e062742dd68 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Wed, 24 Aug 2016 15:24:36 -0700 Subject: [PATCH] context.DeadlineExceeded returned by ClientHandshake should not be fatal error --- transport/http2_client.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/transport/http2_client.go b/transport/http2_client.go index 5819cb8a..5e7c8c25 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -136,8 +136,13 @@ func newHTTP2Client(ctx context.Context, addr string, opts ConnectOptions) (_ Cl } if connErr != nil { // Credentials handshake error is not a temporary error (unless the error - // was the connection closing). - return nil, ConnectionErrorf(connErr == io.EOF, connErr, "transport: %v", connErr) + // was the connection closing or deadline exceeded). + var temp bool + switch connErr { + case io.EOF, context.DeadlineExceeded: + temp = true + } + return nil, ConnectionErrorf(temp, connErr, "transport: %v", connErr) } ua := primaryUA if opts.UserAgent != "" {