简体   繁体   English

客户端 gRPC 连接与 C++ 中的重新连接?

[英]Client gRPC connection with reconnect in C++?

Is it possible to have a client channel that automatically reconnects?是否可以有一个自动重新连接的客户端通道? I tried using wait_for_ready(true) on the context, but that doesn't seem to have any effect.我尝试在上下文中使用wait_for_ready(true) ,但这似乎没有任何效果。

I get this crash when I try to use a client channel with a lost connection:当我尝试使用连接丢失的客户端通道时出现此崩溃:

E0519 12:56:40.239405883    9379 client_context.cc:119]      assertion failed: call_ == nullptr

My problem was attempting to re-use a context.我的问题是试图重用上下文。 Creating a new context for each attempt fixed the issue.为每次尝试创建一个新的上下文解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM