Deprecate GenericStub()::Call for multi-threaded use
diff --git a/include/grpc++/generic/generic_stub.h b/include/grpc++/generic/generic_stub.h
index d506431..e72826b 100644
--- a/include/grpc++/generic/generic_stub.h
+++ b/include/grpc++/generic/generic_stub.h
@@ -37,15 +37,6 @@
explicit GenericStub(std::shared_ptr<ChannelInterface> channel)
: channel_(channel) {}
- /// Begin a call to a named method \a method using \a context.
- /// A tag \a tag will be delivered to \a cq when the call has been started
- /// (i.e, initial metadata has been sent).
- /// The return value only indicates whether or not registration of the call
- /// succeeded (i.e. the call won't proceed if the return value is nullptr).
- std::unique_ptr<GenericClientAsyncReaderWriter> Call(
- ClientContext* context, const grpc::string& method, CompletionQueue* cq,
- void* tag);
-
/// Setup a call to a named method \a method using \a context, but don't
/// start it. Let it be started explicitly with StartCall and a tag.
/// The return value only indicates whether or not registration of the call
@@ -61,6 +52,16 @@
ClientContext* context, const grpc::string& method,
const ByteBuffer& request, CompletionQueue* cq);
+ /// DEPRECATED for multi-threaded use
+ /// Begin a call to a named method \a method using \a context.
+ /// A tag \a tag will be delivered to \a cq when the call has been started
+ /// (i.e, initial metadata has been sent).
+ /// The return value only indicates whether or not registration of the call
+ /// succeeded (i.e. the call won't proceed if the return value is nullptr).
+ std::unique_ptr<GenericClientAsyncReaderWriter> Call(
+ ClientContext* context, const grpc::string& method, CompletionQueue* cq,
+ void* tag);
+
private:
std::shared_ptr<ChannelInterface> channel_;
};
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index bf43284..ba26089 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -125,7 +125,8 @@
}
std::unique_ptr<GenericClientAsyncReaderWriter> call =
- generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1));
+ generic_stub_->PrepareCall(&cli_ctx, kMethodName, &cli_cq_);
+ call->StartCall(tag(1));
client_ok(1);
std::unique_ptr<ByteBuffer> send_buffer =
SerializeToByteBuffer(&send_request);
@@ -271,7 +272,8 @@
cli_ctx.set_compression_algorithm(GRPC_COMPRESS_MESSAGE_GZIP);
send_request.set_message("Hello");
std::unique_ptr<GenericClientAsyncReaderWriter> cli_stream =
- generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1));
+ generic_stub_->PrepareCall(&cli_ctx, kMethodName, &cli_cq_);
+ cli_stream->StartCall(tag(1));
client_ok(1);
generic_service_.RequestCall(&srv_ctx, &srv_stream, srv_cq_.get(),