I don't know what's going wrong :(

This commit is contained in:
hmol233 2021-06-13 14:16:08 +08:00
parent 1e3d739a5b
commit ba4aa2896d
No known key found for this signature in database
GPG Key ID: D617A9DAB0C992D5
1 changed files with 8 additions and 8 deletions

View File

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