pull/17797/head
Nicolas "Pixel" Noble 6 years ago
parent b0e6cc9b5f
commit cabbd35014
  1. 29
      include/grpcpp/channel_impl.h
  2. 4
      include/grpcpp/impl/codegen/client_context.h
  3. 1
      include/grpcpp/impl/codegen/client_interceptor.h
  4. 1
      include/grpcpp/impl/codegen/completion_queue.h
  5. 1
      include/grpcpp/security/credentials.h
  6. 30
      src/cpp/client/channel_cc.cc
  7. 5
      src/cpp/client/client_context.cc
  8. 6
      src/cpp/client/create_channel_internal.cc
  9. 6
      src/cpp/client/create_channel_internal.h
  10. 1
      src/cpp/client/secure_credentials.h
  11. 1
      test/cpp/util/create_test_channel.h

@ -65,33 +65,33 @@ class Channel final : public ::grpc::ChannelInterface,
friend void experimental::ChannelResetConnectionBackoff(Channel* channel);
friend std::shared_ptr<Channel> CreateChannelInternal(
const grpc::string& host, grpc_channel* c_channel,
std::vector<
std::unique_ptr<::grpc::experimental::ClientInterceptorFactoryInterface>>
std::vector<std::unique_ptr<
::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
friend class ::grpc::internal::InterceptedChannel;
Channel(const grpc::string& host, grpc_channel* c_channel,
std::vector<
std::unique_ptr<::grpc::experimental::ClientInterceptorFactoryInterface>>
std::vector<std::unique_ptr<
::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
::grpc::internal::Call CreateCall(const ::grpc::internal::RpcMethod& method,
::grpc::ClientContext* context,
::grpc::CompletionQueue* cq) override;
::grpc::ClientContext* context,
::grpc::CompletionQueue* cq) override;
void PerformOpsOnCall(::grpc::internal::CallOpSetInterface* ops,
::grpc::internal::Call* call) override;
void* RegisterMethod(const char* method) override;
void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline, ::grpc::CompletionQueue* cq,
void* tag) override;
gpr_timespec deadline,
::grpc::CompletionQueue* cq, void* tag) override;
bool WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) override;
::grpc::CompletionQueue* CallbackCQ() override;
::grpc::internal::Call CreateCallInternal(const ::grpc::internal::RpcMethod& method,
::grpc::ClientContext* context, ::grpc::CompletionQueue* cq,
size_t interceptor_pos) override;
::grpc::internal::Call CreateCallInternal(
const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
::grpc::CompletionQueue* cq, size_t interceptor_pos) override;
const grpc::string host_;
grpc_channel* const c_channel_; // owned
@ -105,10 +105,11 @@ class Channel final : public ::grpc::ChannelInterface,
// shutdown callback tag (invoked when the CQ is fully shutdown).
::grpc::CompletionQueue* callback_cq_ = nullptr;
std::vector<std::unique_ptr<::grpc::experimental::ClientInterceptorFactoryInterface>>
std::vector<
std::unique_ptr<::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators_;
};
} // namespace grpc
} // namespace grpc_impl
#endif // GRPCPP_CHANNEL_H
#endif // GRPCPP_CHANNEL_IMPL_H

@ -59,7 +59,6 @@ struct grpc_call;
namespace grpc_impl {
class Channel;
}
namespace grpc {
@ -428,7 +427,8 @@ class ClientContext {
}
grpc_call* call() const { return call_; }
void set_call(grpc_call* call, const std::shared_ptr<::grpc_impl::Channel>& channel);
void set_call(grpc_call* call,
const std::shared_ptr<::grpc_impl::Channel>& channel);
experimental::ClientRpcInfo* set_client_rpc_info(
const char* method, internal::RpcMethod::RpcType type,

@ -29,7 +29,6 @@
namespace grpc_impl {
class Channel;
}
namespace grpc {

@ -44,7 +44,6 @@ struct grpc_completion_queue;
namespace grpc_impl {
class Channel;
}
namespace grpc {

@ -35,7 +35,6 @@ struct grpc_call;
namespace grpc_impl {
class Channel;
}
namespace grpc {

@ -49,18 +49,18 @@
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/surface/completion_queue.h"
void grpc::experimental::ChannelResetConnectionBackoff(::grpc::Channel* channel) {
void grpc::experimental::ChannelResetConnectionBackoff(
::grpc::Channel* channel) {
ChannelResetConnectionBackoff(channel);
}
namespace grpc_impl {
static ::grpc::internal::GrpcLibraryInitializer g_gli_initializer;
Channel::Channel(
const grpc::string& host, grpc_channel* channel,
std::vector<
std::unique_ptr<::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators)
Channel::Channel(const grpc::string& host, grpc_channel* channel,
std::vector<std::unique_ptr<
::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators)
: host_(host), c_channel_(channel) {
interceptor_creators_ = std::move(interceptor_creators);
g_gli_initializer.summon();
@ -76,7 +76,8 @@ Channel::~Channel() {
namespace {
inline grpc_slice SliceFromArray(const char* arr, size_t len) {
return ::grpc::g_core_codegen_interface->grpc_slice_from_copied_buffer(arr, len);
return ::grpc::g_core_codegen_interface->grpc_slice_from_copied_buffer(arr,
len);
}
grpc::string GetChannelInfoField(grpc_channel* channel,
@ -114,10 +115,9 @@ void ChannelResetConnectionBackoff(Channel* channel) {
} // namespace experimental
::grpc::internal::Call Channel::CreateCallInternal(const ::grpc::internal::RpcMethod& method,
::grpc::ClientContext* context,
::grpc::CompletionQueue* cq,
size_t interceptor_pos) {
::grpc::internal::Call Channel::CreateCallInternal(
const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
::grpc::CompletionQueue* cq, size_t interceptor_pos) {
const bool kRegistered = method.channel_tag() && context->authority().empty();
grpc_call* c_call = nullptr;
if (kRegistered) {
@ -161,9 +161,9 @@ void ChannelResetConnectionBackoff(Channel* channel) {
return ::grpc::internal::Call(c_call, this, cq, info);
}
::grpc::internal::Call Channel::CreateCall(const ::grpc::internal::RpcMethod& method,
::grpc::ClientContext* context,
::grpc::CompletionQueue* cq) {
::grpc::internal::Call Channel::CreateCall(
const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
::grpc::CompletionQueue* cq) {
return CreateCallInternal(method, context, cq, 0);
}
@ -256,4 +256,4 @@ class ShutdownCallback : public grpc_experimental_completion_queue_functor {
return callback_cq_;
}
} // namespace grpc
} // namespace grpc_impl

@ -33,7 +33,6 @@
namespace grpc_impl {
class Channel;
}
namespace grpc {
@ -88,8 +87,8 @@ void ClientContext::AddMetadata(const grpc::string& meta_key,
send_initial_metadata_.insert(std::make_pair(meta_key, meta_value));
}
void ClientContext::set_call(grpc_call* call,
const std::shared_ptr<::grpc_impl::Channel>& channel) {
void ClientContext::set_call(
grpc_call* call, const std::shared_ptr<::grpc_impl::Channel>& channel) {
std::unique_lock<std::mutex> lock(mu_);
GPR_ASSERT(call_ == nullptr);
call_ = call;

@ -26,11 +26,11 @@ namespace grpc_impl {
std::shared_ptr<Channel> CreateChannelInternal(
const grpc::string& host, grpc_channel* c_channel,
std::vector<
std::unique_ptr<::grpc::experimental::ClientInterceptorFactoryInterface>>
std::vector<std::unique_ptr<
::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) {
return std::shared_ptr<Channel>(
new Channel(host, c_channel, std::move(interceptor_creators)));
}
}
} // namespace grpc_impl

@ -32,10 +32,10 @@ class Channel;
std::shared_ptr<Channel> CreateChannelInternal(
const grpc::string& host, grpc_channel* c_channel,
std::vector<
std::unique_ptr<::grpc::experimental::ClientInterceptorFactoryInterface>>
std::vector<std::unique_ptr<
::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
} // namespace grpc
} // namespace grpc_impl
#endif // GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H

@ -30,7 +30,6 @@
namespace grpc_impl {
class Channel;
}
namespace grpc {

@ -26,7 +26,6 @@
namespace grpc_impl {
class Channel;
}
namespace grpc {

Loading…
Cancel
Save