From 05ac62ed2585c055ced8f04fa493128e71a52118 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 28 Feb 2024 15:25:30 +0400 Subject: [PATCH] rpc/client: Dial with `grpc.WithReturnConnectionError` option Since 2b89b7e7982cd13f61489d526c4ecf6f811beedb, RPC client used `grpc.WithBlock` option to dial the server. This option make dialer to return either `nil` or `context.DeadlineExceeded` errors, with any connection error resulting in the latter. In particular, TLS handshake failures were shadowed by deadline error. Now `WithReturnConnectionError` option is used instead: * it still blocks similar to `WithBlock`; * it adds connection failure to the deadline error. As a result, TLS unit test passes now. This should fix the problem originally posted in https://github.com/nspcc-dev/neofs-node/issues/2561. Signed-off-by: Leonard Lyubich --- rpc/client/connect.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc/client/connect.go b/rpc/client/connect.go index 5ddca4de..9272c9b6 100644 --- a/rpc/client/connect.go +++ b/rpc/client/connect.go @@ -54,7 +54,7 @@ func (c *Client) openGRPCConn(ctx context.Context, extraDialOpts ...grpcstd.Dial dialOpts := make([]grpcstd.DialOption, 0, 2+len(extraDialOpts)) dialOpts = append(dialOpts, grpcstd.WithTransportCredentials(creds), - grpcstd.WithBlock(), + grpcstd.WithReturnConnectionError(), ) if extraDialOpts != nil { dialOpts = append(dialOpts, extraDialOpts...)