diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-11-02 08:56:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-02 08:56:16 -0700 |
commit | 3ac7f2d24c24c80b2e93b0e905f2cf6c92b6ff29 (patch) | |
tree | 0c19aa38531b51864f24e9bd71de340cdafac8c0 /src/cpp | |
parent | 53657b5de385ffc54e33899b3f2a87ff78d2952b (diff) | |
parent | 857e79ce005870332f0e44347e7c933747bd5d72 (diff) |
Merge pull request #17053 from yashykt/global_interceptor
Add global client interceptor factory
Diffstat (limited to 'src/cpp')
-rw-r--r-- | src/cpp/client/channel_cc.cc | 2 | ||||
-rw-r--r-- | src/cpp/codegen/client_interceptor.cc | 34 |
2 files changed, 35 insertions, 1 deletions
diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc index f5c1b4e2c5..6ef7df4ea0 100644 --- a/src/cpp/client/channel_cc.cc +++ b/src/cpp/client/channel_cc.cc @@ -115,7 +115,7 @@ void ChannelResetConnectionBackoff(Channel* channel) { internal::Call Channel::CreateCallInternal(const internal::RpcMethod& method, ClientContext* context, CompletionQueue* cq, - int interceptor_pos) { + size_t interceptor_pos) { const bool kRegistered = method.channel_tag() && context->authority().empty(); grpc_call* c_call = nullptr; if (kRegistered) { diff --git a/src/cpp/codegen/client_interceptor.cc b/src/cpp/codegen/client_interceptor.cc new file mode 100644 index 0000000000..3a5cac9830 --- /dev/null +++ b/src/cpp/codegen/client_interceptor.cc @@ -0,0 +1,34 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <grpcpp/impl/codegen/client_interceptor.h> + +namespace grpc { + +namespace internal { +experimental::ClientInterceptorFactoryInterface* + g_global_client_interceptor_factory = nullptr; +} + +namespace experimental { +void RegisterGlobalClientInterceptorFactory( + ClientInterceptorFactoryInterface* factory) { + internal::g_global_client_interceptor_factory = factory; +} +} // namespace experimental +} // namespace grpc |