diff options
author | Vijay Pai <vpai@google.com> | 2017-09-19 15:30:11 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2017-09-21 22:23:44 -0700 |
commit | 2046d0b3c50e555f339062b4fba298e8af8b3a1f (patch) | |
tree | c63e745b39791a542c75bd03e47837b35b26fbb9 /src/cpp | |
parent | 87973ea3981af6b73dfc8c08bcb6d3ebf01ce4a0 (diff) |
Add unary call mode to GenericStub to allow generic RPC with 1 CQ trip
Diffstat (limited to 'src/cpp')
-rw-r--r-- | src/cpp/client/generic_stub.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cpp/client/generic_stub.cc b/src/cpp/client/generic_stub.cc index de2e449fe8..693b8bea56 100644 --- a/src/cpp/client/generic_stub.cc +++ b/src/cpp/client/generic_stub.cc @@ -47,4 +47,14 @@ std::unique_ptr<GenericClientAsyncReaderWriter> GenericStub::PrepareCall( return CallInternal(channel_.get(), context, method, cq, false, nullptr); } +// setup a unary call to a named method +std::unique_ptr<GenericClientAsyncResponseReader> GenericStub::PrepareUnaryCall( + ClientContext* context, const grpc::string& method, + const ByteBuffer& request, CompletionQueue* cq) { + return std::unique_ptr<GenericClientAsyncResponseReader>( + GenericClientAsyncResponseReader::Create( + channel_.get(), cq, RpcMethod(method.c_str(), RpcMethod::NORMAL_RPC), + context, request, false)); +} + } // namespace grpc |