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 a4b7d73 commit cc4cae6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rpc/client/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ func (c *Client) openGRPCConn(ctx context.Context, extraDialOpts ...grpcstd.Dial
if extraDialOpts != nil {
extraDialOpts = append([]grpcstd.DialOption{
grpcstd.WithTransportCredentials(creds),
grpcstd.WithBlock(),
grpcstd.WithReturnConnectionError(),
}, extraDialOpts...)
} else {
extraDialOpts = []grpcstd.DialOption{
grpcstd.WithTransportCredentials(creds),
grpcstd.WithBlock(),
grpcstd.WithReturnConnectionError(),
}
}

Expand Down

0 comments on commit cc4cae6

Please sign in to comment.