diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/cpp_generator.cc | 16 | ||||
-rw-r--r-- | src/cpp/client/generic_stub.cc | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index defb44aae9..ff3758ccfa 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -359,7 +359,7 @@ void PrintHeaderService(grpc::protobuf::io::Printer *printer, "class Stub GRPC_FINAL : public ::grpc::InternalStub {\n" " public:\n"); printer->Indent(); - printer->Print("Stub();\n"); + printer->Print("Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);\n"); for (int i = 0; i < service->method_count(); ++i) { PrintHeaderClientMethod(printer, service->method(i), vars); } @@ -744,15 +744,14 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, *vars, "std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub(" "const std::shared_ptr< ::grpc::ChannelInterface>& channel) {\n" - " std::unique_ptr< $ns$$Service$::Stub> stub(new $ns$$Service$::Stub());\n" - " stub->set_channel(channel);\n" + " std::unique_ptr< $ns$$Service$::Stub> stub(new $ns$$Service$::Stub(channel));\n" " return stub;\n" "}\n\n"); - printer->Print(*vars, "$ns$$Service$::Stub::Stub()"); + printer->Print(*vars, "$ns$$Service$::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)\n"); printer->Indent(); + printer->Print(": ::grpc::InternalStub(channel)"); for (int i = 0; i < service->method_count(); ++i) { const grpc::protobuf::MethodDescriptor *method = service->method(i); - (*vars)["Sep"] = (i==0) ? ":" : ","; (*vars)["Method"] = method->name(); (*vars)["Idx"] = as_string(i); if (NoStreaming(method)) { @@ -764,12 +763,13 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, } else { (*vars)["StreamingType"] = "BIDI_STREAMING"; } - printer->Print(*vars, "$Sep$ rpcmethod_$Method$_(" + printer->Print(*vars, ", rpcmethod_$Method$_(" "$prefix$$Service$_method_names[$Idx$], " - "::grpc::RpcMethod::$StreamingType$" + "::grpc::RpcMethod::$StreamingType$, " + "channel->RegisterMethod($prefix$$Service$_method_names[$Idx$])" ")\n"); } - printer->Print("{}\n"); + printer->Print("{}\n\n"); printer->Outdent(); for (int i = 0; i < service->method_count(); ++i) { diff --git a/src/cpp/client/generic_stub.cc b/src/cpp/client/generic_stub.cc index 751f98f1b0..53084b33cc 100644 --- a/src/cpp/client/generic_stub.cc +++ b/src/cpp/client/generic_stub.cc @@ -43,7 +43,7 @@ std::unique_ptr<GenericClientAsyncReaderWriter> GenericStub::Call( CompletionQueue* cq, void* tag) { return std::unique_ptr<GenericClientAsyncReaderWriter>( new GenericClientAsyncReaderWriter( - channel_.get(), cq, RpcMethod(method.c_str(), RpcMethod::BIDI_STREAMING), context, tag)); + channel_.get(), cq, RpcMethod(method.c_str(), RpcMethod::BIDI_STREAMING, nullptr), context, tag)); } |