【问题标题】:c++ gRPC CompletionQueue is FILO?c++ gRPC CompletionQueue是FILO吗?
【发布时间】:2018-03-17 07:25:27
【问题描述】:

我在我的程序中使用grpc::CompletionQueue,您也可以在 “grpc/examples/cpp/helloword/greeter_async_clients.cc”。 问题代码如下!

    // stub_->PrepareAsyncSayHello() creates an RPC object, returning
    // an instance to store in "call" but does not actually start the RPC
    // Because we are using the asynchronous API, we need to hold on to
    // the "call" instance in order to get updates on the ongoing RPC.
    call->response_reader =
        stub_->PrepareAsyncSayHello(&call->context, request, &cq_);

    // StartCall initiates the RPC call
    call->response_reader->StartCall();

    // Request that, upon completion of the RPC, "reply" be updated with the
    // server's response; "status" with the indication of whether the operation
    // was successful. Tag the request with the memory address of the call object.
    call->response_reader->Finish(&call->reply, &call->status, (void*)call);

Client向Server发送1,2,3...100,但是Server得到的号码列表是“100,99,98...2,1”。为什么?我找不到任何有关此的源代码...非常感谢您

并且是用于 gRPC 的 Nagle 算法吗?

【问题讨论】:

    标签: asynchronous grpc stub


    【解决方案1】:

    CompletionQueue 有点用词不当。他们将按照完成的顺序(而不是发出的顺序)返回事件。

    gRPC C++ 默认会禁用 Nagle 算法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-20
      • 1970-01-01
      • 2022-10-20
      • 1970-01-01
      • 1970-01-01
      • 2022-10-05
      • 1970-01-01
      • 2020-02-04
      相关资源
      最近更新 更多