1.客户端的队列添加问题:
参阅博客:
[StackOverflow] C++ gRPC 异步 API 实例与优势 | Miigon's blog
上文博客解析:
问题集锦:
1.cq_.Next如何触发?
void ImageClientAsyncImpl::asyncCompleRpc()
{
void* got_tag;
bool ok = false;
// Block until the next result is available in the completion queue "cq".
while (cq_.Next(&got_tag, &ok)) {
//GPR_ASSERT(ok);//Failed Maybe, Please Check Status of Network Status and Server Process
AsyncGrpcBase* tmpcall = static_cast<AsyncGrpcBase*>(got_tag);
if (tmpcall !=nullptr){
if (!ok) {
std::cout<<tmpcall->status.error_code()<<std::endl;
std::cout << "Error message: " << tmpcall->status.error_message() << std::endl;
//tmpcall->status = Status::OK;//事件异常断开,强行终止。 不可修改状态
}
tmpcall->Proceed();
}
}
}
2.GRPC 异步原理
3.