Stop generating 1-phase deprecated async code

pull/24343/head
Vijay Pai 4 years ago
parent 82726e2c97
commit e1798799e2
  1. 45
      src/compiler/cpp_generator.cc

@ -276,7 +276,7 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
"($Method$Raw(context, request));\n"); "($Method$Raw(context, request));\n");
printer->Outdent(); printer->Outdent();
printer->Print("}\n"); printer->Print("}\n");
for (auto async_prefix : async_prefixes) { for (auto& async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix; (*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params; (*vars)["AsyncMethodParams"] = async_prefix.method_params;
(*vars)["AsyncRawArgs"] = async_prefix.raw_args; (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
@ -1959,24 +1959,31 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
"(stub_->channel_.get(), stub_->rpcmethod_$Method$_, " "(stub_->channel_.get(), stub_->rpcmethod_$Method$_, "
"context, request, response, reactor);\n}\n\n"); "context, request, response, reactor);\n}\n\n");
for (auto async_prefix : async_prefixes) { printer->Print(*vars,
(*vars)["AsyncPrefix"] = async_prefix.prefix; "::grpc::ClientAsyncResponseReader< $Response$>* "
(*vars)["AsyncStart"] = async_prefix.start; "$ns$$Service$::Stub::PrepareAsync$Method$Raw(::grpc::"
printer->Print(*vars, "ClientContext* context, "
"::grpc::ClientAsyncResponseReader< $Response$>* " "const $Request$& request, "
"$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw(::grpc::" "::grpc::CompletionQueue* cq) {\n");
"ClientContext* context, " printer->Print(*vars,
"const $Request$& request, " " return "
"::grpc::CompletionQueue* cq) {\n"); "::grpc::internal::ClientAsyncResponseReaderFactory"
printer->Print( "< $Response$>::Create(channel_.get(), cq, "
*vars, "rpcmethod_$Method$_, "
" return " "context, request, false);\n"
"::grpc::internal::ClientAsyncResponseReaderFactory< $Response$>" "}\n\n");
"::Create(channel_.get(), cq, " printer->Print(*vars,
"rpcmethod_$Method$_, " "::grpc::ClientAsyncResponseReader< $Response$>* "
"context, request, $AsyncStart$);\n" "$ns$$Service$::Stub::Async$Method$Raw(::grpc::"
"}\n\n"); "ClientContext* context, "
} "const $Request$& request, "
"::grpc::CompletionQueue* cq) {\n");
printer->Print(*vars,
" auto* result =\n"
" this->PrepareAsync$Method$Raw(context, request, cq);\n"
" result->StartCall();\n"
" return result;\n"
"}\n\n");
} else if (ClientOnlyStreaming(method)) { } else if (ClientOnlyStreaming(method)) {
printer->Print(*vars, printer->Print(*vars,
"::grpc::ClientWriter< $Request$>* " "::grpc::ClientWriter< $Request$>* "

Loading…
Cancel
Save