Skip to content

Commit

Permalink
rpc/client: Dial with grpc.WithReturnConnectionError option
Browse files Browse the repository at this point in the history
Since 2b89b7e, 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 nspcc-dev/neofs-node#2561.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
  • Loading branch information
cthulhu-rider committed Feb 28, 2024
1 parent 2d1f747 commit 1d860f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rpc/client/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *Client) openGRPCConn(ctx context.Context, extraDialOpts ...grpcstd.Dial

dialOpts := []grpcstd.DialOption{
grpcstd.WithTransportCredentials(creds),
grpcstd.WithBlock(),
grpcstd.WithReturnConnectionError(),
}
if extraDialOpts != nil {
dialOpts = append(dialOpts, extraDialOpts...)
Expand Down

0 comments on commit 1d860f2

Please sign in to comment.