From 2046d0b3c50e555f339062b4fba298e8af8b3a1f Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 19 Sep 2017 15:30:11 -0700 Subject: Add unary call mode to GenericStub to allow generic RPC with 1 CQ trip --- src/cpp/client/generic_stub.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/cpp') 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 GenericStub::PrepareCall( return CallInternal(channel_.get(), context, method, cq, false, nullptr); } +// setup a unary call to a named method +std::unique_ptr GenericStub::PrepareUnaryCall( + ClientContext* context, const grpc::string& method, + const ByteBuffer& request, CompletionQueue* cq) { + return std::unique_ptr( + GenericClientAsyncResponseReader::Create( + channel_.get(), cq, RpcMethod(method.c_str(), RpcMethod::NORMAL_RPC), + context, request, false)); +} + } // namespace grpc -- cgit v1.2.3