diff --git a/grpc_client.go b/grpc_client.go index fadc044..c6ce1fd 100644 --- a/grpc_client.go +++ b/grpc_client.go @@ -17,6 +17,8 @@ import ( "google.golang.org/grpc/health/grpc_health_v1" ) +const maxGRPCMessageSize = math.MaxInt + func dialGRPCConn(tls *tls.Config, dialer func(context.Context, string) (net.Conn, error), dialOpts ...grpc.DialOption) (*grpc.ClientConn, error) { // Build dialing options. opts := make([]grpc.DialOption, 0) @@ -37,8 +39,8 @@ func dialGRPCConn(tls *tls.Config, dialer func(context.Context, string) (net.Con } opts = append(opts, - grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt32)), - grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(math.MaxInt32))) + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxGRPCMessageSize)), + grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(maxGRPCMessageSize))) // Add our custom options if we have any opts = append(opts, dialOpts...) diff --git a/grpc_client_test.go b/grpc_client_test.go index 68057f5..62e9b67 100644 --- a/grpc_client_test.go +++ b/grpc_client_test.go @@ -13,6 +13,12 @@ import ( "google.golang.org/grpc" ) +func TestGRPCMaxMessageSize(t *testing.T) { + if maxGRPCMessageSize != int(^uint(0)>>1) { + t.Fatalf("expected gRPC message size limit %d, got %d", int(^uint(0)>>1), maxGRPCMessageSize) + } +} + func TestGRPC_App(t *testing.T) { t.Run("default", func(t *testing.T) { testGRPCClientApp(t, false)