您正在使用什么版本的gRPC和使用什么语言? 1.29
什么操作系统(Linux,Windows等)和版本? 红帽企业版Linux服务器7.6(Maipo)
您使用的是什么运行时/编译器(例如python版本或gcc版本) gcc(GCC)4.8.5 20150623(Red Hat 4.8.5-36) 版权所有(C)2015 Free Software Foundation,Inc. 这是免费软件;请参阅复制条件的来源。没有 保证;甚至不是出于适销性或针对特定目的的适用性。
您做了什么? 创建客户端SslCredentialsOptions 如果我在简单的应用程序中使用相同的代码,则效果很好。 当集成在共享库中并在多线程应用程序中使用该库时。频道未创建。 何时进行调试,我发现grpc :: SslCredentials()方法未返回。
您期望看到什么? 创建通道并建立连接。 启用的日志 导出GRPC_TRACE = all 导出GRPC_VERBOSITY = DEBUG 控制台中没有生成日志。
您看到了什么? grpc :: SslCredentials()方法未返回,并且未创建通道。 我尝试了共享库和静态库。
答案 0 :(得分:0)
Used the following code
grpc::SslCredentialsOptions sslops;
{
std::string client = "";
std::string key = "";
std::string root = "";
std::string clientcert = "/cert/client.crt";
std::string keycert = "/cert/client.key";
std::string rootcert = "/cert/ca.crt";
SCMSSLCPPContext::read( clientcert, client);
SCMSSLCPPContext::read( keycert, key);
SCMSSLCPPContext::read( rootcert, root);
sslops = { root, key, cert };
//std::shared_ptr<grpc::ChannelCredentials> creds = grpc::SslCredentials(sslops);
auto channel_creds = grpc::SslCredentials(sslops);
auto channel = grpc::CreateChannel("localhost:14021", channel_creds );
}