aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/client
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-07-23 02:41:33 +0200
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-07-23 02:41:33 +0200
commitebb514066e38cfc8cfd769b05443d282ba6c3b67 (patch)
treef344dcf25cdca1088b9a4422a4443d4a6d894811 /src/cpp/client
parent77446adeb7c6d2038eddca5dca9e0331b8c55811 (diff)
Changing the library's code to adapt with the new API.
Diffstat (limited to 'src/cpp/client')
-rw-r--r--src/cpp/client/channel.cc10
-rw-r--r--src/cpp/client/client_context.cc16
-rw-r--r--src/cpp/client/insecure_credentials.cc2
3 files changed, 16 insertions, 12 deletions
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index da31d000b3..83733fdaae 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -63,12 +63,13 @@ Call Channel::CreateCall(const RpcMethod& method, ClientContext* context,
method.channel_tag() && context->authority().empty()
? grpc_channel_create_registered_call(c_channel_, cq->cq(),
method.channel_tag(),
- context->raw_deadline())
+ context->raw_deadline(),
+ nullptr)
: grpc_channel_create_call(c_channel_, cq->cq(), method.name(),
context->authority().empty()
? target_.c_str()
: context->authority().c_str(),
- context->raw_deadline());
+ context->raw_deadline(), nullptr);
grpc_census_call_set_context(c_call, context->get_census_context());
GRPC_TIMER_MARK(GRPC_PTAG_CPP_CALL_CREATED, c_call);
context->set_call(c_call, shared_from_this());
@@ -82,12 +83,13 @@ void Channel::PerformOpsOnCall(CallOpSetInterface* ops, Call* call) {
GRPC_TIMER_BEGIN(GRPC_PTAG_CPP_PERFORM_OPS, call->call());
ops->FillOps(cops, &nops);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(call->call(), cops, nops, ops));
+ grpc_call_start_batch(call->call(), cops, nops, ops, nullptr));
GRPC_TIMER_END(GRPC_PTAG_CPP_PERFORM_OPS, call->call());
}
void* Channel::RegisterMethod(const char* method) {
- return grpc_channel_register_call(c_channel_, method, target_.c_str());
+ return grpc_channel_register_call(c_channel_, method, target_.c_str(),
+ nullptr);
}
} // namespace grpc
diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc
index 14ab772e50..d8e6fcbf52 100644
--- a/src/cpp/client/client_context.cc
+++ b/src/cpp/client/client_context.cc
@@ -56,9 +56,11 @@ ClientContext::~ClientContext() {
if (cq_) {
// Drain cq_.
grpc_completion_queue_shutdown(cq_);
- while (grpc_completion_queue_next(cq_, gpr_inf_future(GPR_CLOCK_REALTIME))
- .type != GRPC_QUEUE_SHUTDOWN)
- ;
+ gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_REALTIME);
+ grpc_event event;
+ do {
+ event = grpc_completion_queue_next(cq_, deadline, nullptr);
+ } while (event.type != GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cq_);
}
}
@@ -75,19 +77,19 @@ void ClientContext::set_call(grpc_call* call,
channel_ = channel;
if (creds_ && !creds_->ApplyToCall(call_)) {
grpc_call_cancel_with_status(call, GRPC_STATUS_CANCELLED,
- "Failed to set credentials to rpc.");
+ "Failed to set credentials to rpc.", nullptr);
}
}
void ClientContext::set_compression_algorithm(
grpc_compression_algorithm algorithm) {
- char* algorithm_name = NULL;
+ char* algorithm_name = nullptr;
if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
algorithm);
abort();
}
- GPR_ASSERT(algorithm_name != NULL);
+ GPR_ASSERT(algorithm_name != nullptr);
AddMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name);
}
@@ -100,7 +102,7 @@ std::shared_ptr<const AuthContext> ClientContext::auth_context() const {
void ClientContext::TryCancel() {
if (call_) {
- grpc_call_cancel(call_);
+ grpc_call_cancel(call_, nullptr);
}
}
diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc
index 5ad8784567..cc37c33c7b 100644
--- a/src/cpp/client/insecure_credentials.cc
+++ b/src/cpp/client/insecure_credentials.cc
@@ -49,7 +49,7 @@ class InsecureCredentialsImpl GRPC_FINAL : public Credentials {
grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args);
return std::shared_ptr<ChannelInterface>(new Channel(
- target, grpc_channel_create(target.c_str(), &channel_args)));
+ target, grpc_channel_create(target.c_str(), &channel_args, nullptr)));
}
// InsecureCredentials should not be applied to a call.