Revert "centralize handling of channel's default authority (#27544)" (#27616)

This reverts commit f0a0628795.
pull/27624/head
Mark D. Roth 3 years ago committed by GitHub
parent aea060b530
commit 0611f7c9b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      BUILD
  2. 4
      CMakeLists.txt
  3. 4
      Makefile
  4. 8
      build_autogenerated.yaml
  5. 2
      config.m4
  6. 2
      config.w32
  7. 4
      gRPC-C++.podspec
  8. 6
      gRPC-Core.podspec
  9. 4
      grpc.gemspec
  10. 4
      grpc.gyp
  11. 4
      package.xml
  12. 88
      src/core/ext/filters/client_channel/client_channel.cc
  13. 4
      src/core/ext/filters/client_channel/client_channel.h
  14. 3
      src/core/ext/filters/client_channel/lb_policy.h
  15. 4
      src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc
  16. 5
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  17. 21
      src/core/ext/filters/client_channel/lb_policy/priority/priority.cc
  18. 6
      src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
  19. 5
      src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
  20. 5
      src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc
  21. 7
      src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc
  22. 5
      src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
  23. 5
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  24. 42
      src/core/ext/transport/chttp2/client/authority.cc
  25. 36
      src/core/ext/transport/chttp2/client/authority.h
  26. 8
      src/core/ext/transport/chttp2/client/insecure/channel_create.cc
  27. 38
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
  28. 40
      src/core/lib/transport/authority_override.cc
  29. 37
      src/core/lib/transport/authority_override.h
  30. 2
      src/python/grpcio/grpc_core_dependencies.py
  31. 12
      test/core/util/test_lb_policies.cc
  32. 6
      test/cpp/client/client_channel_stress_test.cc
  33. 6
      test/cpp/end2end/grpclb_end2end_test.cc
  34. 4
      tools/doxygen/Doxyfile.c++.internal
  35. 4
      tools/doxygen/Doxyfile.core.internal

@ -1588,6 +1588,7 @@ grpc_cc_library(
"src/core/lib/surface/server.cc",
"src/core/lib/surface/validate_metadata.cc",
"src/core/lib/surface/version.cc",
"src/core/lib/transport/authority_override.cc",
"src/core/lib/transport/bdp_estimator.cc",
"src/core/lib/transport/byte_stream.cc",
"src/core/lib/transport/connectivity_state.cc",
@ -1723,6 +1724,7 @@ grpc_cc_library(
"src/core/lib/surface/lame_client.h",
"src/core/lib/surface/server.h",
"src/core/lib/surface/validate_metadata.h",
"src/core/lib/transport/authority_override.h",
"src/core/lib/transport/bdp_estimator.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
@ -3259,9 +3261,11 @@ grpc_cc_library(
grpc_cc_library(
name = "grpc_transport_chttp2_client_connector",
srcs = [
"src/core/ext/transport/chttp2/client/authority.cc",
"src/core/ext/transport/chttp2/client/chttp2_connector.cc",
],
hdrs = [
"src/core/ext/transport/chttp2/client/authority.h",
"src/core/ext/transport/chttp2/client/chttp2_connector.h",
],
language = "c++",

4
CMakeLists.txt generated

@ -1564,6 +1564,7 @@ add_library(grpc
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
src/core/ext/filters/workarounds/workaround_utils.cc
src/core/ext/transport/chttp2/alpn/alpn.cc
src/core/ext/transport/chttp2/client/authority.cc
src/core/ext/transport/chttp2/client/chttp2_connector.cc
src/core/ext/transport/chttp2/client/insecure/channel_create.cc
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@ -2013,6 +2014,7 @@ add_library(grpc
src/core/lib/surface/server.cc
src/core/lib/surface/validate_metadata.cc
src/core/lib/surface/version.cc
src/core/lib/transport/authority_override.cc
src/core/lib/transport/bdp_estimator.cc
src/core/lib/transport/byte_stream.cc
src/core/lib/transport/connectivity_state.cc
@ -2397,6 +2399,7 @@ add_library(grpc_unsecure
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
src/core/ext/filters/workarounds/workaround_utils.cc
src/core/ext/transport/chttp2/alpn/alpn.cc
src/core/ext/transport/chttp2/client/authority.cc
src/core/ext/transport/chttp2/client/chttp2_connector.cc
src/core/ext/transport/chttp2/client/insecure/channel_create.cc
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@ -2597,6 +2600,7 @@ add_library(grpc_unsecure
src/core/lib/surface/server.cc
src/core/lib/surface/validate_metadata.cc
src/core/lib/surface/version.cc
src/core/lib/transport/authority_override.cc
src/core/lib/transport/bdp_estimator.cc
src/core/lib/transport/byte_stream.cc
src/core/lib/transport/connectivity_state.cc

4
Makefile generated

@ -1121,6 +1121,7 @@ LIBGRPC_SRC = \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
src/core/ext/transport/chttp2/client/authority.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \
@ -1570,6 +1571,7 @@ LIBGRPC_SRC = \
src/core/lib/surface/server.cc \
src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/version.cc \
src/core/lib/transport/authority_override.cc \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/byte_stream.cc \
src/core/lib/transport/connectivity_state.cc \
@ -1801,6 +1803,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
src/core/ext/transport/chttp2/client/authority.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \
@ -2001,6 +2004,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/surface/server.cc \
src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/version.cc \
src/core/lib/transport/authority_override.cc \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/byte_stream.cc \
src/core/lib/transport/connectivity_state.cc \

@ -496,6 +496,7 @@ libs:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
- src/core/ext/filters/workarounds/workaround_utils.h
- src/core/ext/transport/chttp2/alpn/alpn.h
- src/core/ext/transport/chttp2/client/authority.h
- src/core/ext/transport/chttp2/client/chttp2_connector.h
- src/core/ext/transport/chttp2/server/chttp2_server.h
- src/core/ext/transport/chttp2/transport/bin_decoder.h
@ -915,6 +916,7 @@ libs:
- src/core/lib/surface/lame_client.h
- src/core/lib/surface/server.h
- src/core/lib/surface/validate_metadata.h
- src/core/lib/transport/authority_override.h
- src/core/lib/transport/bdp_estimator.h
- src/core/lib/transport/byte_stream.h
- src/core/lib/transport/connectivity_state.h
@ -1035,6 +1037,7 @@ libs:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
- src/core/ext/filters/workarounds/workaround_utils.cc
- src/core/ext/transport/chttp2/alpn/alpn.cc
- src/core/ext/transport/chttp2/client/authority.cc
- src/core/ext/transport/chttp2/client/chttp2_connector.cc
- src/core/ext/transport/chttp2/client/insecure/channel_create.cc
- src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@ -1484,6 +1487,7 @@ libs:
- src/core/lib/surface/server.cc
- src/core/lib/surface/validate_metadata.cc
- src/core/lib/surface/version.cc
- src/core/lib/transport/authority_override.cc
- src/core/lib/transport/bdp_estimator.cc
- src/core/lib/transport/byte_stream.cc
- src/core/lib/transport/connectivity_state.cc
@ -1740,6 +1744,7 @@ libs:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
- src/core/ext/filters/workarounds/workaround_utils.h
- src/core/ext/transport/chttp2/alpn/alpn.h
- src/core/ext/transport/chttp2/client/authority.h
- src/core/ext/transport/chttp2/client/chttp2_connector.h
- src/core/ext/transport/chttp2/server/chttp2_server.h
- src/core/ext/transport/chttp2/transport/bin_decoder.h
@ -1919,6 +1924,7 @@ libs:
- src/core/lib/surface/lame_client.h
- src/core/lib/surface/server.h
- src/core/lib/surface/validate_metadata.h
- src/core/lib/transport/authority_override.h
- src/core/lib/transport/bdp_estimator.h
- src/core/lib/transport/byte_stream.h
- src/core/lib/transport/connectivity_state.h
@ -2006,6 +2012,7 @@ libs:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
- src/core/ext/filters/workarounds/workaround_utils.cc
- src/core/ext/transport/chttp2/alpn/alpn.cc
- src/core/ext/transport/chttp2/client/authority.cc
- src/core/ext/transport/chttp2/client/chttp2_connector.cc
- src/core/ext/transport/chttp2/client/insecure/channel_create.cc
- src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@ -2206,6 +2213,7 @@ libs:
- src/core/lib/surface/server.cc
- src/core/lib/surface/validate_metadata.cc
- src/core/lib/surface/version.cc
- src/core/lib/transport/authority_override.cc
- src/core/lib/transport/bdp_estimator.cc
- src/core/lib/transport/byte_stream.cc
- src/core/lib/transport/connectivity_state.cc

2
config.m4 generated

@ -116,6 +116,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
src/core/ext/transport/chttp2/client/authority.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \
@ -623,6 +624,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/surface/server.cc \
src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/version.cc \
src/core/lib/transport/authority_override.cc \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/byte_stream.cc \
src/core/lib/transport/connectivity_state.cc \

2
config.w32 generated

@ -82,6 +82,7 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\filters\\workarounds\\workaround_cronet_compression_filter.cc " +
"src\\core\\ext\\filters\\workarounds\\workaround_utils.cc " +
"src\\core\\ext\\transport\\chttp2\\alpn\\alpn.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\authority.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\chttp2_connector.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create_posix.cc " +
@ -589,6 +590,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\surface\\server.cc " +
"src\\core\\lib\\surface\\validate_metadata.cc " +
"src\\core\\lib\\surface\\version.cc " +
"src\\core\\lib\\transport\\authority_override.cc " +
"src\\core\\lib\\transport\\bdp_estimator.cc " +
"src\\core\\lib\\transport\\byte_stream.cc " +
"src\\core\\lib\\transport\\connectivity_state.cc " +

4
gRPC-C++.podspec generated

@ -267,6 +267,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
'src/core/ext/transport/chttp2/transport/bin_decoder.h',
@ -728,6 +729,7 @@ Pod::Spec.new do |s|
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/validate_metadata.h',
'src/core/lib/transport/authority_override.h',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
@ -938,6 +940,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
'src/core/ext/transport/chttp2/transport/bin_decoder.h',
@ -1399,6 +1402,7 @@ Pod::Spec.new do |s|
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/validate_metadata.h',
'src/core/lib/transport/authority_override.h',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',

6
gRPC-Core.podspec generated

@ -334,6 +334,8 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/transport/chttp2/client/authority.cc',
'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
@ -1302,6 +1304,8 @@ Pod::Spec.new do |s|
'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/validate_metadata.h',
'src/core/lib/surface/version.cc',
'src/core/lib/transport/authority_override.cc',
'src/core/lib/transport/authority_override.h',
'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.cc',
@ -1524,6 +1528,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
'src/core/ext/transport/chttp2/transport/bin_decoder.h',
@ -1985,6 +1990,7 @@ Pod::Spec.new do |s|
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/validate_metadata.h',
'src/core/lib/transport/authority_override.h',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',

4
grpc.gemspec generated

@ -246,6 +246,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h )
s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.cc )
s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.h )
s.files += %w( src/core/ext/transport/chttp2/client/authority.cc )
s.files += %w( src/core/ext/transport/chttp2/client/authority.h )
s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.cc )
s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h )
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.cc )
@ -1214,6 +1216,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/surface/validate_metadata.cc )
s.files += %w( src/core/lib/surface/validate_metadata.h )
s.files += %w( src/core/lib/surface/version.cc )
s.files += %w( src/core/lib/transport/authority_override.cc )
s.files += %w( src/core/lib/transport/authority_override.h )
s.files += %w( src/core/lib/transport/bdp_estimator.cc )
s.files += %w( src/core/lib/transport/bdp_estimator.h )
s.files += %w( src/core/lib/transport/byte_stream.cc )

4
grpc.gyp generated

@ -563,6 +563,7 @@
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
'src/core/ext/transport/chttp2/client/authority.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc',
@ -1012,6 +1013,7 @@
'src/core/lib/surface/server.cc',
'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/version.cc',
'src/core/lib/transport/authority_override.cc',
'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/byte_stream.cc',
'src/core/lib/transport/connectivity_state.cc',
@ -1219,6 +1221,7 @@
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
'src/core/ext/transport/chttp2/client/authority.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc',
@ -1419,6 +1422,7 @@
'src/core/lib/surface/server.cc',
'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/version.cc',
'src/core/lib/transport/authority_override.cc',
'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/byte_stream.cc',
'src/core/lib/transport/connectivity_state.cc',

4
package.xml generated

@ -226,6 +226,8 @@
<file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/alpn/alpn.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/alpn/alpn.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/authority.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/authority.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/chttp2_connector.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/chttp2_connector.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/insecure/channel_create.cc" role="src" />
@ -1194,6 +1196,8 @@
<file baseinstalldir="/" name="src/core/lib/surface/validate_metadata.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/validate_metadata.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/version.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/authority_override.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/authority_override.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/bdp_estimator.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/bdp_estimator.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/byte_stream.cc" role="src" />

@ -952,47 +952,24 @@ class ClientChannel::ClientChannelControlHelper
if (!inhibit_health_checking) {
health_check_service_name = chand_->health_check_service_name_;
}
// Construct channel args for subchannel.
// Remove channel args that should not affect subchannel uniqueness.
absl::InlinedVector<const char*, 3> args_to_remove = {
static const char* args_to_remove[] = {
GRPC_ARG_INHIBIT_HEALTH_CHECKING,
GRPC_ARG_CHANNELZ_CHANNEL_NODE,
};
// Add channel args needed for the subchannel.
absl::InlinedVector<grpc_arg, 2> args_to_add = {
absl::InlinedVector<grpc_arg, 3> args_to_add = {
SubchannelPoolInterface::CreateChannelArg(
chand_->subchannel_pool_.get()),
};
// Check if default authority arg is already set.
const char* default_authority =
grpc_channel_args_find_string(&args, GRPC_ARG_DEFAULT_AUTHORITY);
// Add args from subchannel address.
if (address.args() != nullptr) {
for (size_t j = 0; j < address.args()->num_args; ++j) {
grpc_arg& arg = address.args()->args[j];
if (strcmp(arg.key, GRPC_ARG_DEFAULT_AUTHORITY) == 0) {
// Don't add default authority arg from subchannel address if
// it's already set at the channel level -- the value from the
// application should take precedence over what is set by the
// resolver.
if (default_authority != nullptr) continue;
default_authority = arg.value.string;
}
args_to_add.emplace_back(arg);
args_to_add.emplace_back(address.args()->args[j]);
}
}
// If we haven't already set the default authority arg, add it from
// the channel.
if (default_authority == nullptr) {
// Remove it, just in case it's actually present but is the wrong type.
args_to_remove.push_back(GRPC_ARG_DEFAULT_AUTHORITY);
args_to_add.push_back(grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>(chand_->default_authority_.c_str())));
}
grpc_channel_args* new_args = grpc_channel_args_copy_and_add_and_remove(
&args, args_to_remove.data(), args_to_remove.size(), args_to_add.data(),
args_to_add.size());
&args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove),
args_to_add.data(), args_to_add.size());
// Create subchannel.
RefCountedPtr<Subchannel> subchannel =
chand_->client_channel_factory_->CreateSubchannel(address.address(),
@ -1035,10 +1012,6 @@ class ClientChannel::ClientChannelControlHelper
chand_->resolver_->RequestReresolutionLocked();
}
absl::string_view GetAuthority() override {
return chand_->default_authority_;
}
void AddTraceEvent(TraceSeverity severity, absl::string_view message) override
ABSL_EXCLUSIVE_LOCKS_REQUIRED(chand_->work_serializer_) {
if (chand_->resolver_ == nullptr) return; // Shutting down.
@ -1128,6 +1101,15 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
"Missing client channel factory in args for client channel filter");
return;
}
// Get server name to resolve, using proxy mapper if needed.
const char* server_uri =
grpc_channel_args_find_string(args->channel_args, GRPC_ARG_SERVER_URI);
if (server_uri == nullptr) {
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"server URI channel arg missing or wrong type in client channel "
"filter");
return;
}
// Get default service config. If none is specified via the client API,
// we use an empty config.
const char* service_config_json = grpc_channel_args_find_string(
@ -1140,50 +1122,30 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
default_service_config_.reset();
return;
}
// Get URI to resolve, using proxy mapper if needed.
const char* server_uri =
grpc_channel_args_find_string(args->channel_args, GRPC_ARG_SERVER_URI);
if (server_uri == nullptr) {
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"target URI channel arg missing or wrong type in client channel "
"filter");
return;
absl::StatusOr<URI> uri = URI::Parse(server_uri);
if (uri.ok() && !uri->path().empty()) {
server_name_ = std::string(absl::StripPrefix(uri->path(), "/"));
}
uri_to_resolve_ = server_uri;
char* proxy_name = nullptr;
grpc_channel_args* new_args = nullptr;
ProxyMapperRegistry::MapName(server_uri, args->channel_args, &proxy_name,
&new_args);
if (proxy_name != nullptr) {
uri_to_resolve_ = proxy_name;
gpr_free(proxy_name);
}
// Make sure the URI to resolve is valid, so that we know that
// resolver creation will succeed later.
if (!ResolverRegistry::IsValidTarget(uri_to_resolve_)) {
*error = GRPC_ERROR_CREATE_FROM_CPP_STRING(
absl::StrCat("the target uri is not valid: ", uri_to_resolve_.c_str()));
return;
}
target_uri_.reset(proxy_name != nullptr ? proxy_name
: gpr_strdup(server_uri));
// Strip out service config channel arg, so that it doesn't affect
// subchannel uniqueness when the args flow down to that layer.
const char* arg_to_remove = GRPC_ARG_SERVICE_CONFIG;
channel_args_ = grpc_channel_args_copy_and_remove(
new_args != nullptr ? new_args : args->channel_args, &arg_to_remove, 1);
grpc_channel_args_destroy(new_args);
// Set initial keepalive time.
keepalive_time_ = grpc_channel_args_find_integer(
channel_args_, GRPC_ARG_KEEPALIVE_TIME_MS,
{-1 /* default value, unset */, 1, INT_MAX});
// Set default authority.
const char* default_authority =
grpc_channel_args_find_string(channel_args_, GRPC_ARG_DEFAULT_AUTHORITY);
if (default_authority == nullptr) {
default_authority_ = ResolverRegistry::GetDefaultAuthority(server_uri);
} else {
default_authority_ = default_authority;
if (!ResolverRegistry::IsValidTarget(target_uri_.get())) {
*error = GRPC_ERROR_CREATE_FROM_CPP_STRING(
absl::StrCat("the target uri is not valid: ", target_uri_.get()));
return;
}
// Success.
*error = GRPC_ERROR_NONE;
}
@ -1609,8 +1571,8 @@ void ClientChannel::CreateResolverLocked() {
gpr_log(GPR_INFO, "chand=%p: starting name resolution", this);
}
resolver_ = ResolverRegistry::CreateResolver(
uri_to_resolve_.c_str(), channel_args_, interested_parties_,
work_serializer_, absl::make_unique<ResolverResultHandler>(this));
target_uri_.get(), channel_args_, interested_parties_, work_serializer_,
absl::make_unique<ResolverResultHandler>(this));
// Since the validity of the args was checked when the channel was created,
// CreateResolver() must return a non-null result.
GPR_ASSERT(resolver_ != nullptr);

@ -275,8 +275,8 @@ class ClientChannel {
ClientChannelFactory* client_channel_factory_;
const grpc_channel_args* channel_args_;
RefCountedPtr<ServiceConfig> default_service_config_;
std::string uri_to_resolve_;
std::string default_authority_;
std::string server_name_;
UniquePtr<char> target_uri_;
channelz::ChannelNode* channelz_node_;
grpc_pollset_set* interested_parties_;

@ -282,9 +282,6 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
/// Requests that the resolver re-resolve.
virtual void RequestReresolution() = 0;
/// Returns the channel authority.
virtual absl::string_view GetAuthority() = 0;
/// Adds a trace message associated with the channel.
enum TraceSeverity { TRACE_INFO, TRACE_WARNING, TRACE_ERROR };
virtual void AddTraceEvent(TraceSeverity severity,

@ -90,10 +90,6 @@ class ChildPolicyHandler::Helper
parent_->channel_control_helper()->RequestReresolution();
}
absl::string_view GetAuthority() override {
return parent_->channel_control_helper()->GetAuthority();
}
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override {
if (parent_->shutting_down_) return;

@ -352,7 +352,6 @@ class GrpcLb : public LoadBalancingPolicy {
void UpdateState(grpc_connectivity_state state, const absl::Status& status,
std::unique_ptr<SubchannelPicker> picker) override;
void RequestReresolution() override;
absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@ -731,10 +730,6 @@ void GrpcLb::Helper::RequestReresolution() {
}
}
absl::string_view GrpcLb::Helper::GetAuthority() {
return parent_->channel_control_helper()->GetAuthority();
}
void GrpcLb::Helper::AddTraceEvent(TraceSeverity severity,
absl::string_view message) {
if (parent_->shutting_down_) return;

@ -162,7 +162,6 @@ class PriorityLb : public LoadBalancingPolicy {
const absl::Status& status,
std::unique_ptr<SubchannelPicker> picker) override;
void RequestReresolution() override;
absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@ -741,6 +740,14 @@ void PriorityLb::ChildPriority::OnDeactivationTimerLocked(
// PriorityLb::ChildPriority::Helper
//
void PriorityLb::ChildPriority::Helper::RequestReresolution() {
if (priority_->priority_policy_->shutting_down_) return;
if (priority_->ignore_reresolution_requests_) {
return;
}
priority_->priority_policy_->channel_control_helper()->RequestReresolution();
}
RefCountedPtr<SubchannelInterface>
PriorityLb::ChildPriority::Helper::CreateSubchannel(
ServerAddress address, const grpc_channel_args& args) {
@ -757,18 +764,6 @@ void PriorityLb::ChildPriority::Helper::UpdateState(
priority_->OnConnectivityStateUpdateLocked(state, status, std::move(picker));
}
void PriorityLb::ChildPriority::Helper::RequestReresolution() {
if (priority_->priority_policy_->shutting_down_) return;
if (priority_->ignore_reresolution_requests_) {
return;
}
priority_->priority_policy_->channel_control_helper()->RequestReresolution();
}
absl::string_view PriorityLb::ChildPriority::Helper::GetAuthority() {
return priority_->priority_policy_->channel_control_helper()->GetAuthority();
}
void PriorityLb::ChildPriority::Helper::AddTraceEvent(
TraceSeverity severity, absl::string_view message) {
if (priority_->priority_policy_->shutting_down_) return;

@ -150,7 +150,6 @@ class WeightedTargetLb : public LoadBalancingPolicy {
const absl::Status& status,
std::unique_ptr<SubchannelPicker> picker) override;
void RequestReresolution() override;
absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@ -608,11 +607,6 @@ void WeightedTargetLb::WeightedChild::Helper::RequestReresolution() {
->RequestReresolution();
}
absl::string_view WeightedTargetLb::WeightedChild::Helper::GetAuthority() {
return weighted_child_->weighted_target_policy_->channel_control_helper()
->GetAuthority();
}
void WeightedTargetLb::WeightedChild::Helper::AddTraceEvent(
TraceSeverity severity, absl::string_view message) {
if (weighted_child_->weighted_target_policy_->shutting_down_) return;

@ -123,7 +123,6 @@ class CdsLb : public LoadBalancingPolicy {
void UpdateState(grpc_connectivity_state state, const absl::Status& status,
std::unique_ptr<SubchannelPicker> picker) override;
void RequestReresolution() override;
absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@ -262,10 +261,6 @@ void CdsLb::Helper::RequestReresolution() {
parent_->channel_control_helper()->RequestReresolution();
}
absl::string_view CdsLb::Helper::GetAuthority() {
return parent_->channel_control_helper()->GetAuthority();
}
void CdsLb::Helper::AddTraceEvent(TraceSeverity severity,
absl::string_view message) {
if (parent_->shutting_down_) return;

@ -222,7 +222,6 @@ class XdsClusterImplLb : public LoadBalancingPolicy {
void UpdateState(grpc_connectivity_state state, const absl::Status& status,
std::unique_ptr<SubchannelPicker> picker) override;
void RequestReresolution() override;
absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@ -577,10 +576,6 @@ void XdsClusterImplLb::Helper::RequestReresolution() {
xds_cluster_impl_policy_->channel_control_helper()->RequestReresolution();
}
absl::string_view XdsClusterImplLb::Helper::GetAuthority() {
return xds_cluster_impl_policy_->channel_control_helper()->GetAuthority();
}
void XdsClusterImplLb::Helper::AddTraceEvent(TraceSeverity severity,
absl::string_view message) {
if (xds_cluster_impl_policy_->shutting_down_) return;

@ -151,7 +151,6 @@ class XdsClusterManagerLb : public LoadBalancingPolicy {
const absl::Status& status,
std::unique_ptr<SubchannelPicker> picker) override;
void RequestReresolution() override;
absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@ -571,12 +570,6 @@ void XdsClusterManagerLb::ClusterChild::Helper::RequestReresolution() {
->RequestReresolution();
}
absl::string_view XdsClusterManagerLb::ClusterChild::Helper::GetAuthority() {
return xds_cluster_manager_child_->xds_cluster_manager_policy_
->channel_control_helper()
->GetAuthority();
}
void XdsClusterManagerLb::ClusterChild::Helper::AddTraceEvent(
TraceSeverity severity, absl::string_view message) {
if (xds_cluster_manager_child_->xds_cluster_manager_policy_->shutting_down_) {

@ -299,7 +299,6 @@ class XdsClusterResolverLb : public LoadBalancingPolicy {
// This is a no-op, because we get the addresses from the xds
// client, which is a watch-based API.
void RequestReresolution() override {}
absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@ -381,10 +380,6 @@ void XdsClusterResolverLb::Helper::UpdateState(
state, status, std::move(picker));
}
absl::string_view XdsClusterResolverLb::Helper::GetAuthority() {
return xds_cluster_resolver_policy_->channel_control_helper()->GetAuthority();
}
void XdsClusterResolverLb::Helper::AddTraceEvent(TraceSeverity severity,
absl::string_view message) {
if (xds_cluster_resolver_policy_->shutting_down_) return;

@ -47,6 +47,7 @@
#include "src/core/lib/iomgr/nameser.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/transport/authority_override.h"
using grpc_core::ServerAddress;
using grpc_core::ServerAddressList;
@ -669,8 +670,8 @@ static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/,
for (size_t i = 0; hostent->h_addr_list[i] != nullptr; ++i) {
absl::InlinedVector<grpc_arg, 1> args_to_add;
if (hr->is_balancer) {
args_to_add.emplace_back(grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY), hr->host));
args_to_add.emplace_back(
grpc_core::CreateAuthorityOverrideChannelArg(hr->host));
}
grpc_channel_args* args = grpc_channel_args_copy_and_add(
nullptr, args_to_add.data(), args_to_add.size());

@ -0,0 +1,42 @@
/*
*
* 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 <grpc/support/port_platform.h>
#include "src/core/ext/transport/chttp2/client/authority.h"
grpc_channel_args* grpc_default_authority_add_if_not_present(
const grpc_channel_args* args) {
const bool has_default_authority =
grpc_channel_args_find(args, GRPC_ARG_DEFAULT_AUTHORITY) != nullptr;
grpc_arg new_args[1];
size_t num_new_args = 0;
std::string default_authority;
if (!has_default_authority) {
const grpc_arg* server_uri_arg =
grpc_channel_args_find(args, GRPC_ARG_SERVER_URI);
const char* server_uri_str = grpc_channel_arg_get_string(server_uri_arg);
GPR_ASSERT(server_uri_str != nullptr);
default_authority =
grpc_core::ResolverRegistry::GetDefaultAuthority(server_uri_str);
new_args[num_new_args++] = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>(default_authority.c_str()));
}
return grpc_channel_args_copy_and_add(args, new_args, num_new_args);
}

@ -0,0 +1,36 @@
/*
*
* 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.
*
*/
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H
#include <grpc/support/port_platform.h>
#include <grpc/grpc.h>
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/memory.h"
/// Returns a copy of \a args with the default authority channel arg set if it
/// wasn't already present.
grpc_channel_args* grpc_default_authority_add_if_not_present(
const grpc_channel_args* args);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H */

@ -24,6 +24,7 @@
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/transport/chttp2/client/authority.h"
#include "src/core/ext/transport/chttp2/client/chttp2_connector.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/surface/api_trace.h"
@ -36,7 +37,12 @@ class Chttp2InsecureClientChannelFactory : public ClientChannelFactory {
RefCountedPtr<Subchannel> CreateSubchannel(
const grpc_resolved_address& address,
const grpc_channel_args* args) override {
return Subchannel::Create(MakeOrphanable<Chttp2Connector>(), address, args);
grpc_channel_args* new_args =
grpc_default_authority_add_if_not_present(args);
RefCountedPtr<Subchannel> s = Subchannel::Create(
MakeOrphanable<Chttp2Connector>(), address, new_args);
grpc_channel_args_destroy(new_args);
return s;
}
};

@ -33,6 +33,7 @@
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/authority_override.h"
#include "src/core/lib/uri/uri_parser.h"
namespace grpc_core {
@ -73,29 +74,52 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
return nullptr;
}
// Find the authority to use in the security connector.
const char* authority =
grpc_channel_args_find_string(args, GRPC_ARG_DEFAULT_AUTHORITY);
GPR_ASSERT(authority != nullptr);
// First, check the authority override channel arg.
// Otherwise, get it from the server name used to construct the
// channel.
std::string authority(FindAuthorityOverrideInArgs(args));
if (authority.empty()) {
const char* server_uri_str =
grpc_channel_args_find_string(args, GRPC_ARG_SERVER_URI);
GPR_ASSERT(server_uri_str != nullptr);
authority = ResolverRegistry::GetDefaultAuthority(server_uri_str);
}
grpc_arg args_to_add[2];
size_t num_args_to_add = 0;
if (grpc_channel_args_find(args, GRPC_ARG_DEFAULT_AUTHORITY) == nullptr) {
// If the channel args don't already contain GRPC_ARG_DEFAULT_AUTHORITY,
// add the arg, setting it to the value just obtained.
args_to_add[num_args_to_add++] = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>(authority.c_str()));
}
grpc_channel_args* args_with_authority =
grpc_channel_args_copy_and_add(args, args_to_add, num_args_to_add);
// Create the security connector using the credentials and target name.
grpc_channel_args* new_args_from_connector = nullptr;
RefCountedPtr<grpc_channel_security_connector>
subchannel_security_connector =
channel_credentials->create_security_connector(
/*call_creds=*/nullptr, authority, args,
/*call_creds=*/nullptr, authority.c_str(), args_with_authority,
&new_args_from_connector);
if (subchannel_security_connector == nullptr) {
gpr_log(GPR_ERROR,
"Failed to create secure subchannel for secure name '%s'",
authority);
authority.c_str());
grpc_channel_args_destroy(args_with_authority);
return nullptr;
}
grpc_arg new_security_connector_arg =
grpc_security_connector_to_arg(subchannel_security_connector.get());
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(
new_args_from_connector != nullptr ? new_args_from_connector : args,
new_args_from_connector != nullptr ? new_args_from_connector
: args_with_authority,
&new_security_connector_arg, 1);
subchannel_security_connector.reset(DEBUG_LOCATION, "lb_channel_create");
grpc_channel_args_destroy(new_args_from_connector);
if (new_args_from_connector != nullptr) {
grpc_channel_args_destroy(new_args_from_connector);
}
grpc_channel_args_destroy(args_with_authority);
return new_args;
}
};

@ -0,0 +1,40 @@
//
// Copyright 2020 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 <grpc/support/port_platform.h>
#include "absl/strings/string_view.h"
#include "src/core/lib/channel/channel_args.h"
// Channel arg key for the authority override.
#define GRPC_ARG_AUTHORITY_OVERRIDE "grpc.authority_override"
namespace grpc_core {
grpc_arg CreateAuthorityOverrideChannelArg(const char* authority) {
return grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_AUTHORITY_OVERRIDE),
const_cast<char*>(authority));
}
absl::string_view FindAuthorityOverrideInArgs(const grpc_channel_args* args) {
const char* found =
grpc_channel_args_find_string(args, GRPC_ARG_AUTHORITY_OVERRIDE);
return found == nullptr ? "" : found;
}
} // namespace grpc_core

@ -0,0 +1,37 @@
//
// Copyright 2020 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.
//
#ifndef GRPC_CORE_LIB_TRANSPORT_AUTHORITY_OVERRIDE_H
#define GRPC_CORE_LIB_TRANSPORT_AUTHORITY_OVERRIDE_H
#include <grpc/support/port_platform.h>
#include "absl/strings/string_view.h"
#include <grpc/grpc.h>
namespace grpc_core {
/// Returns a channel argument containing \a authority.
grpc_arg CreateAuthorityOverrideChannelArg(const char* authority);
/// Returns the authority override from \a args or the empty string. The return
/// value is a string_view into the `args` data structure.
absl::string_view FindAuthorityOverrideInArgs(const grpc_channel_args* args);
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_TRANSPORT_AUTHORITY_OVERRIDE_H */

@ -91,6 +91,7 @@ CORE_SOURCE_FILES = [
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
'src/core/ext/transport/chttp2/client/authority.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc',
@ -598,6 +599,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/surface/server.cc',
'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/version.cc',
'src/core/lib/transport/authority_override.cc',
'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/byte_stream.cc',
'src/core/lib/transport/connectivity_state.cc',

@ -138,10 +138,6 @@ class TestPickArgsLb : public ForwardingLoadBalancingPolicy {
parent_->channel_control_helper()->RequestReresolution();
}
absl::string_view GetAuthority() override {
return parent_->channel_control_helper()->GetAuthority();
}
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override {
parent_->channel_control_helper()->AddTraceEvent(severity, message);
@ -256,10 +252,6 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy
parent_->channel_control_helper()->RequestReresolution();
}
absl::string_view GetAuthority() override {
return parent_->channel_control_helper()->GetAuthority();
}
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override {
parent_->channel_control_helper()->AddTraceEvent(severity, message);
@ -373,10 +365,6 @@ class AddressTestLoadBalancingPolicy : public ForwardingLoadBalancingPolicy {
parent_->channel_control_helper()->RequestReresolution();
}
absl::string_view GetAuthority() override {
return parent_->channel_control_helper()->GetAuthority();
}
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override {
parent_->channel_control_helper()->AddTraceEvent(severity, message);

@ -45,6 +45,7 @@
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/transport/authority_override.h"
#include "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
@ -227,9 +228,8 @@ class ClientChannelStressTest {
GPR_ASSERT(lb_uri.ok());
grpc_resolved_address address;
GPR_ASSERT(grpc_parse_uri(*lb_uri, &address));
grpc_arg arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>(addr.balancer_name.c_str()));
grpc_arg arg = grpc_core::CreateAuthorityOverrideChannelArg(
addr.balancer_name.c_str());
grpc_channel_args* args =
grpc_channel_args_copy_and_add(nullptr, &arg, 1);
addresses.emplace_back(address.addr, address.len, args);

@ -52,6 +52,7 @@
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/security/credentials/fake/fake_credentials.h"
#include "src/core/lib/transport/authority_override.h"
#include "src/cpp/client/secure_credentials.h"
#include "src/cpp/server/secure_server_credentials.h"
#include "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h"
@ -545,9 +546,8 @@ class GrpclbEnd2endTest : public ::testing::Test {
GPR_ASSERT(lb_uri.ok());
grpc_resolved_address address;
GPR_ASSERT(grpc_parse_uri(*lb_uri, &address));
grpc_arg arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>(addr.balancer_name.c_str()));
grpc_arg arg = grpc_core::CreateAuthorityOverrideChannelArg(
addr.balancer_name.c_str());
grpc_channel_args* args =
grpc_channel_args_copy_and_add(nullptr, &arg, 1);
addresses.emplace_back(address.addr, address.len, args);

@ -1183,6 +1183,8 @@ src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/filters/workarounds/workaround_utils.h \
src/core/ext/transport/chttp2/alpn/alpn.cc \
src/core/ext/transport/chttp2/alpn/alpn.h \
src/core/ext/transport/chttp2/client/authority.cc \
src/core/ext/transport/chttp2/client/authority.h \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.h \
src/core/ext/transport/chttp2/client/insecure/channel_create.cc \
@ -2147,6 +2149,8 @@ src/core/lib/surface/server.h \
src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/validate_metadata.h \
src/core/lib/surface/version.cc \
src/core/lib/transport/authority_override.cc \
src/core/lib/transport/authority_override.h \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/bdp_estimator.h \
src/core/lib/transport/byte_stream.cc \

@ -1013,6 +1013,8 @@ src/core/ext/transport/binder/README.md \
src/core/ext/transport/chttp2/README.md \
src/core/ext/transport/chttp2/alpn/alpn.cc \
src/core/ext/transport/chttp2/alpn/alpn.h \
src/core/ext/transport/chttp2/client/authority.cc \
src/core/ext/transport/chttp2/client/authority.h \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.h \
src/core/ext/transport/chttp2/client/insecure/README.md \
@ -1989,6 +1991,8 @@ src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/validate_metadata.h \
src/core/lib/surface/version.cc \
src/core/lib/transport/README.md \
src/core/lib/transport/authority_override.cc \
src/core/lib/transport/authority_override.h \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/bdp_estimator.h \
src/core/lib/transport/byte_stream.cc \

Loading…
Cancel
Save