From ba4aa2896d740372049d566ec0c13c09bb46c046 Mon Sep 17 00:00:00 2001 From: hmol233 <82594500+hmol233@users.noreply.github.com> Date: Sun, 13 Jun 2021 14:16:08 +0800 Subject: [PATCH] I don't know what's going wrong :( --- transport/internet/grpc/dial.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/transport/internet/grpc/dial.go b/transport/internet/grpc/dial.go index 99c483be..f1927178 100644 --- a/transport/internet/grpc/dial.go +++ b/transport/internet/grpc/dial.go @@ -52,7 +52,7 @@ func dialgRPC(ctx context.Context, dest net.Destination, streamSettings *interne conn, err := getGrpcClient(ctx, dest, tlsConfig, streamSettings.SocketSettings) if err != nil { - return nil, newError("Cannot dial gRPC").Base(err) + return nil, newError("failed to dial gRPC").Base(err) } client := encoding.NewGRPCServiceClient(conn) if grpcSettings.MultiMode { @@ -113,12 +113,6 @@ func getGrpcClient(ctx context.Context, dest net.Destination, tlsConfig *tls.Con gctx = session.ContextWithOutbound(gctx, session.OutboundFromContext(ctx)) rawHost, rawPort, err := net.SplitHostPort(s) - select { - case <-gctx.Done(): - return nil, gctx.Err() - default: - } - if err != nil { return nil, err } @@ -130,8 +124,14 @@ func getGrpcClient(ctx context.Context, dest net.Destination, tlsConfig *tls.Con return nil, err } address := net.ParseAddress(rawHost) - return internet.DialSystem(gctx, net.TCPDestination(address, port), sockopt) + conn, err := internet.DialSystem(gctx, net.TCPDestination(address, port), sockopt) + if err != nil { + newError("failed to dial connection for gRPC").Base(err).WriteToLog() + } + return conn, err }), + grpc.WithBlock(), + grpc.WithReturnConnectionError(), ) globalDialerMap[dialerConf{dest, sockopt, tlsConfig}] = conn return conn, err