aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-02-05 21:28:59 -0800
committerGravatar GitHub <noreply@github.com>2018-02-05 21:28:59 -0800
commit007f1197ac6376cd6a77dca141966ba3aceec9aa (patch)
tree7a77a7629d1a01283eb59dad2404ebf76af18672
parentd1b6062894dd8b4e2000a80aff64481dc17fc32b (diff)
parent3b7ae55f77c61b3e787543c72b9ccb978900d529 (diff)
Merge pull request #14322 from vjpai/generic_deprecate
Deprecate GenericStub()::Call for multi-threaded use
-rw-r--r--include/grpc++/generic/generic_stub.h19
-rw-r--r--test/cpp/end2end/filter_end2end_test.cc6
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc6
-rw-r--r--test/cpp/util/cli_call.cc3
4 files changed, 20 insertions, 14 deletions
diff --git a/include/grpc++/generic/generic_stub.h b/include/grpc++/generic/generic_stub.h
index d5064318cf..e72826bdc1 100644
--- a/include/grpc++/generic/generic_stub.h
+++ b/include/grpc++/generic/generic_stub.h
@@ -37,15 +37,6 @@ class GenericStub final {
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 @@ class GenericStub final {
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/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc
index be99a1aea4..b843a5b4e8 100644
--- a/test/cpp/end2end/filter_end2end_test.cc
+++ b/test/cpp/end2end/filter_end2end_test.cc
@@ -175,7 +175,8 @@ class FilterEnd2endTest : public ::testing::Test {
// The string needs to be long enough to test heap-based slice.
send_request.set_message("Hello world. Hello world. Hello world.");
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);
@@ -268,7 +269,8 @@ TEST_F(FilterEnd2endTest, SimpleBidiStreaming) {
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(),
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index bf432844cb..ba2608982a 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -125,7 +125,8 @@ class GenericEnd2endTest : public ::testing::Test {
}
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 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) {
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(),
diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc
index 4f1a20c727..3b0bb9eeba 100644
--- a/test/cpp/util/cli_call.cc
+++ b/test/cpp/util/cli_call.cc
@@ -60,7 +60,8 @@ CliCall::CliCall(std::shared_ptr<grpc::Channel> channel,
ctx_.AddMetadata(iter->first, iter->second);
}
}
- call_ = stub_->Call(&ctx_, method, &cq_, tag(1));
+ call_ = stub_->PrepareCall(&ctx_, method, &cq_);
+ call_->StartCall(tag(1));
void* got_tag;
bool ok;
cq_.Next(&got_tag, &ok);