grpc 1.13.0 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +403 -153
- data/include/grpc/grpc.h +0 -8
- data/include/grpc/grpc_security.h +59 -2
- data/include/grpc/impl/codegen/grpc_types.h +8 -2
- data/include/grpc/impl/codegen/log.h +112 -0
- data/include/grpc/module.modulemap +2 -0
- data/include/grpc/support/log.h +2 -88
- data/include/grpc/support/string_util.h +2 -0
- data/src/boringssl/err_data.c +597 -593
- data/src/core/ext/filters/client_channel/client_channel.cc +715 -770
- data/src/core/ext/filters/client_channel/client_channel.h +5 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +111 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +69 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +9 -0
- data/src/core/ext/filters/client_channel/http_proxy.cc +22 -5
- data/src/core/ext/filters/client_channel/lb_policy.h +15 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +3 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +19 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +19 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +4 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +37 -63
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +79 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +5 -2
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +8 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +4 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +317 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +48 -9
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +40 -293
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +106 -84
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +6 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +6 -5
- data/src/core/ext/filters/client_channel/subchannel.cc +36 -6
- data/src/core/ext/filters/client_channel/subchannel.h +4 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +18 -15
- data/src/core/ext/filters/deadline/deadline_filter.h +5 -5
- data/src/core/ext/filters/http/client/http_client_filter.cc +10 -9
- data/src/core/ext/filters/http/server/http_server_filter.h +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +33 -22
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +10 -3
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +17 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +21 -16
- data/src/core/ext/transport/inproc/inproc_transport.cc +46 -6
- data/src/core/lib/channel/channel_stack.cc +22 -24
- data/src/core/lib/channel/channel_trace.cc +28 -63
- data/src/core/lib/channel/channel_trace.h +13 -17
- data/src/core/lib/channel/channelz.cc +143 -0
- data/src/core/lib/channel/channelz.h +124 -0
- data/src/core/lib/channel/channelz_registry.cc +7 -24
- data/src/core/lib/channel/channelz_registry.h +12 -8
- data/src/core/lib/channel/connected_channel.cc +8 -1
- data/src/core/{ext/filters/load_reporting/server_load_reporting_filter.h → lib/gpr/alloc.h} +7 -9
- data/src/core/lib/gpr/arena.cc +8 -8
- data/src/core/lib/gpr/string.cc +28 -0
- data/src/core/lib/gpr/string.h +10 -0
- data/src/core/lib/gprpp/abstract.h +5 -2
- data/src/core/lib/gprpp/inlined_vector.h +57 -3
- data/src/core/lib/gprpp/memory.h +2 -2
- data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
- data/src/core/lib/gprpp/thd_posix.cc +1 -1
- data/src/core/lib/iomgr/call_combiner.h +80 -0
- data/src/core/lib/iomgr/closure.h +3 -2
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/error.cc +12 -0
- data/src/core/lib/iomgr/error.h +5 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +36 -9
- data/src/core/lib/iomgr/ev_epollex_linux.cc +172 -46
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +47 -21
- data/src/core/lib/iomgr/ev_poll_posix.cc +10 -4
- data/src/core/lib/iomgr/ev_posix.cc +17 -9
- data/src/core/lib/iomgr/ev_posix.h +20 -4
- data/src/core/lib/iomgr/executor.cc +196 -140
- data/src/core/lib/iomgr/executor.h +47 -14
- data/src/core/lib/iomgr/iomgr.cc +2 -0
- data/src/core/lib/iomgr/iomgr.h +5 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +1 -0
- data/src/core/lib/iomgr/socket_utils.h +9 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -0
- data/src/core/lib/iomgr/socket_utils_uv.cc +4 -0
- data/src/core/lib/iomgr/socket_utils_windows.cc +4 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -5
- data/src/core/lib/iomgr/tcp_posix.cc +6 -1
- data/src/core/lib/iomgr/tcp_server_posix.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -1
- data/src/core/lib/iomgr/timer_manager.cc +0 -1
- data/src/core/lib/iomgr/udp_server.cc +2 -3
- data/src/core/lib/json/json.cc +10 -0
- data/src/core/lib/json/json.h +5 -0
- data/src/core/lib/security/context/security_context.cc +8 -8
- data/src/core/lib/security/context/security_context.h +6 -2
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -1
- data/src/core/lib/security/credentials/local/local_credentials.cc +77 -0
- data/src/core/lib/security/credentials/local/local_credentials.h +40 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +17 -3
- data/src/core/lib/security/security_connector/local_security_connector.cc +245 -0
- data/src/core/lib/security/security_connector/local_security_connector.h +58 -0
- data/src/core/lib/security/security_connector/security_connector.cc +30 -5
- data/src/core/lib/security/security_connector/security_connector.h +1 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +5 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +4 -5
- data/src/core/lib/surface/call.cc +75 -32
- data/src/core/lib/surface/call.h +2 -0
- data/src/core/lib/surface/channel.cc +32 -13
- data/src/core/lib/surface/channel.h +4 -0
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/transport.cc +20 -9
- data/src/core/lib/transport/transport.h +12 -10
- data/src/core/lib/transport/transport_op_string.cc +0 -7
- data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -4
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -1
- data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/altscontext.pb.h +1 -2
- data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/handshaker.pb.h +1 -2
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +2 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +47 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +3 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +12 -11
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +7 -2
- data/src/core/tsi/local_transport_security.cc +209 -0
- data/src/core/tsi/local_transport_security.h +51 -0
- data/src/core/tsi/ssl_transport_security.cc +2 -3
- data/src/{core/ext → cpp/ext/filters}/census/grpc_context.cc +0 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +18 -18
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +29 -29
- data/src/ruby/lib/grpc/generic/active_call.rb +19 -23
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/call_credentials_spec.rb +1 -1
- data/src/ruby/spec/call_spec.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +1 -1
- data/src/ruby/spec/client_auth_spec.rb +1 -12
- data/src/ruby/spec/client_server_spec.rb +1 -1
- data/src/ruby/spec/compression_options_spec.rb +1 -1
- data/src/ruby/spec/error_sanity_spec.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +13 -1
- data/src/ruby/spec/generic/rpc_desc_spec.rb +1 -1
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +1 -1
- data/src/ruby/spec/generic/service_spec.rb +1 -1
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +1 -12
- data/src/ruby/spec/pb/duplicate/codegen_spec.rb +1 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
- data/src/ruby/spec/server_credentials_spec.rb +1 -1
- data/src/ruby/spec/server_spec.rb +1 -1
- data/src/ruby/spec/spec_helper.rb +1 -0
- data/src/ruby/spec/support/services.rb +1 -1
- data/src/ruby/spec/time_consts_spec.rb +1 -1
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +40 -19
- data/third_party/boringssl/crypto/bytestring/cbs.c +1 -0
- data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +47 -15
- data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +9 -10
- data/third_party/boringssl/crypto/ecdh/ecdh.c +4 -3
- data/third_party/boringssl/crypto/fipsmodule/bn/add.c +30 -54
- data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +7 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +8 -8
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +97 -11
- data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +274 -218
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +111 -34
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +2 -2
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +24 -6
- data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +324 -63
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +74 -21
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +128 -86
- data/third_party/boringssl/crypto/fipsmodule/bn/sqrt.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +67 -112
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +8 -1
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +5 -5
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +9 -17
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +5378 -5418
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +32 -32
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +5 -11
- data/third_party/boringssl/crypto/fipsmodule/rsa/blinding.c +16 -40
- data/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +1 -6
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +41 -29
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +63 -49
- data/third_party/boringssl/crypto/x509/vpm_int.h +1 -0
- data/third_party/boringssl/crypto/x509/x509_vfy.c +4 -0
- data/third_party/boringssl/crypto/x509/x509_vpm.c +44 -22
- data/third_party/boringssl/include/openssl/aead.h +8 -2
- data/third_party/boringssl/include/openssl/asn1.h +1 -0
- data/third_party/boringssl/include/openssl/base.h +4 -0
- data/third_party/boringssl/include/openssl/bn.h +13 -3
- data/third_party/boringssl/include/openssl/bytestring.h +4 -4
- data/third_party/boringssl/include/openssl/ec.h +10 -4
- data/third_party/boringssl/include/openssl/ec_key.h +0 -3
- data/third_party/boringssl/include/openssl/rsa.h +1 -0
- data/third_party/boringssl/include/openssl/ssl.h +8 -3
- data/third_party/boringssl/include/openssl/ssl3.h +0 -1
- data/third_party/boringssl/include/openssl/x509.h +1 -0
- data/third_party/boringssl/include/openssl/x509v3.h +1 -0
- data/third_party/boringssl/ssl/handshake_client.cc +36 -64
- data/third_party/boringssl/ssl/ssl_cipher.cc +4 -0
- data/third_party/boringssl/ssl/ssl_lib.cc +1 -1
- metadata +45 -38
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +0 -222
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +0 -71
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +0 -61
- data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +0 -51
- data/src/ruby/spec/pb/package_with_underscore/data.proto +0 -23
- data/src/ruby/spec/pb/package_with_underscore/service.proto +0 -23
@@ -21,6 +21,7 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
+
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
|
24
25
|
#include "src/core/ext/filters/client_channel/client_channel_factory.h"
|
25
26
|
#include "src/core/ext/filters/client_channel/resolver.h"
|
26
27
|
#include "src/core/lib/channel/channel_stack.h"
|
@@ -39,6 +40,10 @@ extern grpc_core::TraceFlag grpc_client_channel_trace;
|
|
39
40
|
|
40
41
|
extern const grpc_channel_filter grpc_client_channel_filter;
|
41
42
|
|
43
|
+
void grpc_client_channel_populate_child_refs(
|
44
|
+
grpc_channel_element* elem, grpc_core::ChildRefsList* child_subchannels,
|
45
|
+
grpc_core::ChildRefsList* child_channels);
|
46
|
+
|
42
47
|
grpc_connectivity_state grpc_client_channel_check_connectivity_state(
|
43
48
|
grpc_channel_element* elem, int try_to_connect);
|
44
49
|
|
@@ -0,0 +1,111 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2018 gRPC authors.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include <grpc/support/port_platform.h>
|
20
|
+
|
21
|
+
#include "src/core/ext/filters/client_channel/client_channel.h"
|
22
|
+
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
|
23
|
+
#include "src/core/lib/gpr/useful.h"
|
24
|
+
#include "src/core/lib/surface/channel.h"
|
25
|
+
#include "src/core/lib/transport/connectivity_state.h"
|
26
|
+
|
27
|
+
namespace grpc_core {
|
28
|
+
namespace channelz {
|
29
|
+
namespace {
|
30
|
+
|
31
|
+
void* client_channel_channelz_copy(void* p) { return p; }
|
32
|
+
|
33
|
+
void client_channel_channelz_destroy(void* p) {}
|
34
|
+
|
35
|
+
int client_channel_channelz_cmp(void* a, void* b) { return GPR_ICMP(a, b); }
|
36
|
+
|
37
|
+
} // namespace
|
38
|
+
|
39
|
+
static const grpc_arg_pointer_vtable client_channel_channelz_vtable = {
|
40
|
+
client_channel_channelz_copy, client_channel_channelz_destroy,
|
41
|
+
client_channel_channelz_cmp};
|
42
|
+
|
43
|
+
ClientChannelNode::ClientChannelNode(grpc_channel* channel,
|
44
|
+
size_t channel_tracer_max_nodes)
|
45
|
+
: ChannelNode(channel, channel_tracer_max_nodes) {
|
46
|
+
client_channel_ =
|
47
|
+
grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel));
|
48
|
+
GPR_ASSERT(client_channel_->filter == &grpc_client_channel_filter);
|
49
|
+
}
|
50
|
+
|
51
|
+
void ClientChannelNode::PopulateConnectivityState(grpc_json* json) {
|
52
|
+
grpc_connectivity_state state;
|
53
|
+
if (ChannelIsDestroyed()) {
|
54
|
+
state = GRPC_CHANNEL_SHUTDOWN;
|
55
|
+
} else {
|
56
|
+
state =
|
57
|
+
grpc_client_channel_check_connectivity_state(client_channel_, false);
|
58
|
+
}
|
59
|
+
json = grpc_json_create_child(nullptr, json, "state", nullptr,
|
60
|
+
GRPC_JSON_OBJECT, false);
|
61
|
+
grpc_json_create_child(nullptr, json, "state",
|
62
|
+
grpc_connectivity_state_name(state), GRPC_JSON_STRING,
|
63
|
+
false);
|
64
|
+
}
|
65
|
+
|
66
|
+
void ClientChannelNode::PopulateChildRefs(grpc_json* json) {
|
67
|
+
ChildRefsList child_subchannels;
|
68
|
+
ChildRefsList child_channels;
|
69
|
+
grpc_json* json_iterator = nullptr;
|
70
|
+
grpc_client_channel_populate_child_refs(client_channel_, &child_subchannels,
|
71
|
+
&child_channels);
|
72
|
+
if (child_subchannels.size() > 0) {
|
73
|
+
grpc_json* array_parent = grpc_json_create_child(
|
74
|
+
nullptr, json, "subchannelRef", nullptr, GRPC_JSON_ARRAY, false);
|
75
|
+
for (size_t i = 0; i < child_subchannels.size(); ++i) {
|
76
|
+
json_iterator =
|
77
|
+
grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr,
|
78
|
+
GRPC_JSON_OBJECT, false);
|
79
|
+
grpc_json_add_number_string_child(json_iterator, nullptr, "subchannelId",
|
80
|
+
child_subchannels[i]);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
if (child_channels.size() > 0) {
|
84
|
+
grpc_json* array_parent = grpc_json_create_child(
|
85
|
+
nullptr, json, "channelRef", nullptr, GRPC_JSON_ARRAY, false);
|
86
|
+
json_iterator = nullptr;
|
87
|
+
for (size_t i = 0; i < child_subchannels.size(); ++i) {
|
88
|
+
json_iterator =
|
89
|
+
grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr,
|
90
|
+
GRPC_JSON_OBJECT, false);
|
91
|
+
grpc_json_add_number_string_child(json_iterator, nullptr, "channelId",
|
92
|
+
child_subchannels[i]);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
grpc_arg ClientChannelNode::CreateChannelArg() {
|
98
|
+
return grpc_channel_arg_pointer_create(
|
99
|
+
const_cast<char*>(GRPC_ARG_CHANNELZ_CHANNEL_NODE_CREATION_FUNC),
|
100
|
+
reinterpret_cast<void*>(MakeClientChannelNode),
|
101
|
+
&client_channel_channelz_vtable);
|
102
|
+
}
|
103
|
+
|
104
|
+
RefCountedPtr<ChannelNode> ClientChannelNode::MakeClientChannelNode(
|
105
|
+
grpc_channel* channel, size_t channel_tracer_max_nodes) {
|
106
|
+
return MakePolymorphicRefCounted<ChannelNode, ClientChannelNode>(
|
107
|
+
channel, channel_tracer_max_nodes);
|
108
|
+
}
|
109
|
+
|
110
|
+
} // namespace channelz
|
111
|
+
} // namespace grpc_core
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2018 gRPC authors.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
|
19
|
+
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_CHANNELZ_H
|
20
|
+
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_CHANNELZ_H
|
21
|
+
|
22
|
+
#include <grpc/support/port_platform.h>
|
23
|
+
|
24
|
+
#include "src/core/lib/channel/channel_args.h"
|
25
|
+
#include "src/core/lib/channel/channel_stack.h"
|
26
|
+
#include "src/core/lib/channel/channelz.h"
|
27
|
+
#include "src/core/lib/gprpp/inlined_vector.h"
|
28
|
+
|
29
|
+
namespace grpc_core {
|
30
|
+
|
31
|
+
// TODO(ncteisen), this only contains the uuids of the children for now,
|
32
|
+
// since that is all that is strictly needed. In a future enhancement we will
|
33
|
+
// add human readable names as in the channelz.proto
|
34
|
+
typedef InlinedVector<intptr_t, 10> ChildRefsList;
|
35
|
+
|
36
|
+
namespace channelz {
|
37
|
+
|
38
|
+
// Subtype of ChannelNode that overrides and provides client_channel specific
|
39
|
+
// functionality like querying for connectivity_state and subchannel data.
|
40
|
+
class ClientChannelNode : public ChannelNode {
|
41
|
+
public:
|
42
|
+
static RefCountedPtr<ChannelNode> MakeClientChannelNode(
|
43
|
+
grpc_channel* channel, size_t channel_tracer_max_nodes);
|
44
|
+
|
45
|
+
// Override this functionality since client_channels have a notion of
|
46
|
+
// channel connectivity.
|
47
|
+
void PopulateConnectivityState(grpc_json* json) override;
|
48
|
+
|
49
|
+
// Override this functionality since client_channels have subchannels
|
50
|
+
void PopulateChildRefs(grpc_json* json) override;
|
51
|
+
|
52
|
+
// Helper to create a channel arg to ensure this type of ChannelNode is
|
53
|
+
// created.
|
54
|
+
static grpc_arg CreateChannelArg();
|
55
|
+
|
56
|
+
protected:
|
57
|
+
GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
|
58
|
+
GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW
|
59
|
+
ClientChannelNode(grpc_channel* channel, size_t channel_tracer_max_nodes);
|
60
|
+
virtual ~ClientChannelNode() {}
|
61
|
+
|
62
|
+
private:
|
63
|
+
grpc_channel_element* client_channel_;
|
64
|
+
};
|
65
|
+
|
66
|
+
} // namespace channelz
|
67
|
+
} // namespace grpc_core
|
68
|
+
|
69
|
+
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_CHANNELZ_H */
|
@@ -25,6 +25,7 @@
|
|
25
25
|
#include <grpc/support/alloc.h>
|
26
26
|
|
27
27
|
#include "src/core/ext/filters/client_channel/client_channel.h"
|
28
|
+
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
|
28
29
|
#include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
|
29
30
|
#include "src/core/ext/filters/client_channel/http_proxy.h"
|
30
31
|
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
|
@@ -35,6 +36,14 @@
|
|
35
36
|
#include "src/core/lib/surface/channel_init.h"
|
36
37
|
|
37
38
|
static bool append_filter(grpc_channel_stack_builder* builder, void* arg) {
|
39
|
+
const grpc_channel_args* args =
|
40
|
+
grpc_channel_stack_builder_get_channel_arguments(builder);
|
41
|
+
grpc_arg args_to_add[] = {
|
42
|
+
grpc_core::channelz::ClientChannelNode::CreateChannelArg()};
|
43
|
+
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(
|
44
|
+
args, args_to_add, GPR_ARRAY_SIZE(args_to_add));
|
45
|
+
grpc_channel_stack_builder_set_channel_arguments(builder, new_args);
|
46
|
+
grpc_channel_args_destroy(new_args);
|
38
47
|
return grpc_channel_stack_builder_append_filter(
|
39
48
|
builder, static_cast<const grpc_channel_filter*>(arg), nullptr, nullptr);
|
40
49
|
}
|
@@ -37,17 +37,21 @@
|
|
37
37
|
#include "src/core/lib/slice/b64.h"
|
38
38
|
|
39
39
|
/**
|
40
|
-
* Parses the '
|
41
|
-
* nullptr on error. Also sets 'user_cred' to user
|
42
|
-
* 'http_proxy' env var, otherwise leaves it
|
43
|
-
* responsibility to gpr_free user_cred.
|
40
|
+
* Parses the 'https_proxy' env var (fallback on 'http_proxy') and returns the
|
41
|
+
* proxy hostname to resolve or nullptr on error. Also sets 'user_cred' to user
|
42
|
+
* credentials if present in the 'http_proxy' env var, otherwise leaves it
|
43
|
+
* unchanged. It is caller's responsibility to gpr_free user_cred.
|
44
44
|
*/
|
45
45
|
static char* get_http_proxy_server(char** user_cred) {
|
46
46
|
GPR_ASSERT(user_cred != nullptr);
|
47
47
|
char* proxy_name = nullptr;
|
48
|
-
char* uri_str = gpr_getenv("http_proxy");
|
49
48
|
char** authority_strs = nullptr;
|
50
49
|
size_t authority_nstrs;
|
50
|
+
/* Prefer using 'https_proxy'. Fallback on 'http_proxy' if it is not set. The
|
51
|
+
* fallback behavior can be removed if there's a demand for it.
|
52
|
+
*/
|
53
|
+
char* uri_str = gpr_getenv("https_proxy");
|
54
|
+
if (uri_str == nullptr) uri_str = gpr_getenv("http_proxy");
|
51
55
|
if (uri_str == nullptr) return nullptr;
|
52
56
|
grpc_uri* uri = grpc_uri_parse(uri_str, false /* suppress_errors */);
|
53
57
|
if (uri == nullptr || uri->authority == nullptr) {
|
@@ -83,11 +87,24 @@ done:
|
|
83
87
|
return proxy_name;
|
84
88
|
}
|
85
89
|
|
90
|
+
/**
|
91
|
+
* Checks the value of GRPC_ARG_ENABLE_HTTP_PROXY to determine if http_proxy
|
92
|
+
* should be used.
|
93
|
+
*/
|
94
|
+
bool http_proxy_enabled(const grpc_channel_args* args) {
|
95
|
+
const grpc_arg* arg =
|
96
|
+
grpc_channel_args_find(args, GRPC_ARG_ENABLE_HTTP_PROXY);
|
97
|
+
return grpc_channel_arg_get_bool(arg, true);
|
98
|
+
}
|
99
|
+
|
86
100
|
static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper,
|
87
101
|
const char* server_uri,
|
88
102
|
const grpc_channel_args* args,
|
89
103
|
char** name_to_resolve,
|
90
104
|
grpc_channel_args** new_args) {
|
105
|
+
if (!http_proxy_enabled(args)) {
|
106
|
+
return false;
|
107
|
+
}
|
91
108
|
char* user_cred = nullptr;
|
92
109
|
*name_to_resolve = get_http_proxy_server(&user_cred);
|
93
110
|
if (*name_to_resolve == nullptr) return false;
|
@@ -21,6 +21,7 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
+
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
|
24
25
|
#include "src/core/ext/filters/client_channel/client_channel_factory.h"
|
25
26
|
#include "src/core/ext/filters/client_channel/subchannel.h"
|
26
27
|
#include "src/core/lib/gprpp/abstract.h"
|
@@ -143,6 +144,14 @@ class LoadBalancingPolicy
|
|
143
144
|
/// consider whether this method is still needed.
|
144
145
|
virtual void ExitIdleLocked() GRPC_ABSTRACT;
|
145
146
|
|
147
|
+
/// populates child_subchannels and child_channels with the uuids of this
|
148
|
+
/// LB policy's referenced children. This is not invoked from the
|
149
|
+
/// client_channel's combiner. The implementation is responsible for
|
150
|
+
/// providing its own synchronization.
|
151
|
+
virtual void FillChildRefsForChannelz(ChildRefsList* child_subchannels,
|
152
|
+
ChildRefsList* child_channels)
|
153
|
+
GRPC_ABSTRACT;
|
154
|
+
|
146
155
|
void Orphan() override {
|
147
156
|
// Invoke ShutdownAndUnrefLocked() inside of the combiner.
|
148
157
|
GRPC_CLOSURE_SCHED(
|
@@ -196,6 +205,12 @@ class LoadBalancingPolicy
|
|
196
205
|
grpc_pollset_set* interested_parties_;
|
197
206
|
/// Callback to force a re-resolution.
|
198
207
|
grpc_closure* request_reresolution_;
|
208
|
+
|
209
|
+
// Dummy classes needed for alignment issues.
|
210
|
+
// See https://github.com/grpc/grpc/issues/16032 for context.
|
211
|
+
// TODO(ncteisen): remove this as soon as the issue is resolved.
|
212
|
+
ChildRefsList dummy_list_foo;
|
213
|
+
ChildRefsList dummy_list_bar;
|
199
214
|
};
|
200
215
|
|
201
216
|
} // namespace grpc_core
|
@@ -135,6 +135,9 @@ class GrpcLb : public LoadBalancingPolicy {
|
|
135
135
|
void HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) override;
|
136
136
|
void PingOneLocked(grpc_closure* on_initiate, grpc_closure* on_ack) override;
|
137
137
|
void ExitIdleLocked() override;
|
138
|
+
// TODO(ncteisen): implement this in a follow up PR
|
139
|
+
void FillChildRefsForChannelz(ChildRefsList* child_subchannels,
|
140
|
+
ChildRefsList* child_channels) override {}
|
138
141
|
|
139
142
|
private:
|
140
143
|
/// Linked list of pending pick requests. It stores all information needed to
|
@@ -18,9 +18,9 @@
|
|
18
18
|
|
19
19
|
#include <grpc/support/port_platform.h>
|
20
20
|
|
21
|
+
#include "pb_decode.h"
|
22
|
+
#include "pb_encode.h"
|
21
23
|
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h"
|
22
|
-
#include "third_party/nanopb/pb_decode.h"
|
23
|
-
#include "third_party/nanopb/pb_encode.h"
|
24
24
|
|
25
25
|
#include <grpc/support/alloc.h>
|
26
26
|
|
@@ -73,7 +73,7 @@ grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name) {
|
|
73
73
|
}
|
74
74
|
|
75
75
|
static void populate_timestamp(gpr_timespec timestamp,
|
76
|
-
|
76
|
+
grpc_grpclb_timestamp* timestamp_pb) {
|
77
77
|
timestamp_pb->has_seconds = true;
|
78
78
|
timestamp_pb->seconds = timestamp.tv_sec;
|
79
79
|
timestamp_pb->has_nanos = true;
|
@@ -33,7 +33,9 @@ typedef grpc_lb_v1_Server_ip_address_t grpc_grpclb_ip_address;
|
|
33
33
|
typedef grpc_lb_v1_LoadBalanceRequest grpc_grpclb_request;
|
34
34
|
typedef grpc_lb_v1_InitialLoadBalanceResponse grpc_grpclb_initial_response;
|
35
35
|
typedef grpc_lb_v1_Server grpc_grpclb_server;
|
36
|
-
typedef
|
36
|
+
typedef google_protobuf_Duration grpc_grpclb_duration;
|
37
|
+
typedef google_protobuf_Timestamp grpc_grpclb_timestamp;
|
38
|
+
|
37
39
|
typedef struct {
|
38
40
|
grpc_grpclb_server** servers;
|
39
41
|
size_t num_servers;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/* Automatically generated nanopb constant definitions */
|
2
|
+
/* Generated by nanopb-0.3.7-dev */
|
3
|
+
|
4
|
+
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h"
|
5
|
+
/* @@protoc_insertion_point(includes) */
|
6
|
+
#if PB_PROTO_HEADER_VERSION != 30
|
7
|
+
#error Regenerate this file with the current version of nanopb generator.
|
8
|
+
#endif
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
const pb_field_t google_protobuf_Duration_fields[3] = {
|
13
|
+
PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, google_protobuf_Duration, seconds, seconds, 0),
|
14
|
+
PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, google_protobuf_Duration, nanos, seconds, 0),
|
15
|
+
PB_LAST_FIELD
|
16
|
+
};
|
17
|
+
|
18
|
+
|
19
|
+
/* @@protoc_insertion_point(eof) */
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/* Automatically generated nanopb header */
|
2
|
+
/* Generated by nanopb-0.3.7-dev */
|
3
|
+
|
4
|
+
#ifndef PB_GOOGLE_PROTOBUF_DURATION_PB_H_INCLUDED
|
5
|
+
#define PB_GOOGLE_PROTOBUF_DURATION_PB_H_INCLUDED
|
6
|
+
#include "pb.h"
|
7
|
+
/* @@protoc_insertion_point(includes) */
|
8
|
+
#if PB_PROTO_HEADER_VERSION != 30
|
9
|
+
#error Regenerate this file with the current version of nanopb generator.
|
10
|
+
#endif
|
11
|
+
|
12
|
+
#ifdef __cplusplus
|
13
|
+
extern "C" {
|
14
|
+
#endif
|
15
|
+
|
16
|
+
/* Struct definitions */
|
17
|
+
typedef struct _google_protobuf_Duration {
|
18
|
+
bool has_seconds;
|
19
|
+
int64_t seconds;
|
20
|
+
bool has_nanos;
|
21
|
+
int32_t nanos;
|
22
|
+
/* @@protoc_insertion_point(struct:google_protobuf_Duration) */
|
23
|
+
} google_protobuf_Duration;
|
24
|
+
|
25
|
+
/* Default values for struct fields */
|
26
|
+
|
27
|
+
/* Initializer values for message structs */
|
28
|
+
#define google_protobuf_Duration_init_default {false, 0, false, 0}
|
29
|
+
#define google_protobuf_Duration_init_zero {false, 0, false, 0}
|
30
|
+
|
31
|
+
/* Field tags (for use in manual encoding/decoding) */
|
32
|
+
#define google_protobuf_Duration_seconds_tag 1
|
33
|
+
#define google_protobuf_Duration_nanos_tag 2
|
34
|
+
|
35
|
+
/* Struct field encoding specification for nanopb */
|
36
|
+
extern const pb_field_t google_protobuf_Duration_fields[3];
|
37
|
+
|
38
|
+
/* Maximum encoded size of messages (where known) */
|
39
|
+
#define google_protobuf_Duration_size 22
|
40
|
+
|
41
|
+
/* Message IDs (where set with "msgid" option) */
|
42
|
+
#ifdef PB_MSGID
|
43
|
+
|
44
|
+
#define DURATION_MESSAGES \
|
45
|
+
|
46
|
+
|
47
|
+
#endif
|
48
|
+
|
49
|
+
#ifdef __cplusplus
|
50
|
+
} /* extern "C" */
|
51
|
+
#endif
|
52
|
+
/* @@protoc_insertion_point(eof) */
|
53
|
+
|
54
|
+
#endif
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/* Automatically generated nanopb constant definitions */
|
2
|
+
/* Generated by nanopb-0.3.7-dev */
|
3
|
+
|
4
|
+
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h"
|
5
|
+
/* @@protoc_insertion_point(includes) */
|
6
|
+
#if PB_PROTO_HEADER_VERSION != 30
|
7
|
+
#error Regenerate this file with the current version of nanopb generator.
|
8
|
+
#endif
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
const pb_field_t google_protobuf_Timestamp_fields[3] = {
|
13
|
+
PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, google_protobuf_Timestamp, seconds, seconds, 0),
|
14
|
+
PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, google_protobuf_Timestamp, nanos, seconds, 0),
|
15
|
+
PB_LAST_FIELD
|
16
|
+
};
|
17
|
+
|
18
|
+
|
19
|
+
/* @@protoc_insertion_point(eof) */
|