Channel args preconditioning (#28132)

* Channel args preconditioning

* docs

* fixes

* Automated change: Fix sanity tests

* fix

* fix this again after merge error

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
pull/28181/head
Craig Tiller 3 years ago committed by GitHub
parent 8e0a361cce
commit 672f31c6ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      BUILD
  2. 4
      CMakeLists.txt
  3. 2
      Makefile
  4. 8
      build_autogenerated.yaml
  5. 1
      config.m4
  6. 1
      config.w32
  7. 2
      gRPC-C++.podspec
  8. 3
      gRPC-Core.podspec
  9. 2
      grpc.gemspec
  10. 2
      grpc.gyp
  11. 2
      package.xml
  12. 6
      src/core/ext/transport/chttp2/client/insecure/channel_create.cc
  13. 5
      src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
  14. 9
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
  15. 4
      src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
  16. 7
      src/core/ext/transport/inproc/inproc_transport.cc
  17. 2
      src/core/ext/transport/inproc/inproc_transport.h
  18. 5
      src/core/ext/xds/xds_server_config_fetcher.cc
  19. 34
      src/core/lib/channel/channel_args.cc
  20. 21
      src/core/lib/channel/channel_args.h
  21. 47
      src/core/lib/channel/channel_args_preconditioning.cc
  22. 62
      src/core/lib/channel/channel_args_preconditioning.h
  23. 12
      src/core/lib/compression/compression_args.cc
  24. 10
      src/core/lib/compression/compression_args.h
  25. 4
      src/core/lib/config/core_configuration.cc
  26. 11
      src/core/lib/config/core_configuration.h
  27. 9
      src/core/lib/http/httpcli.cc
  28. 10
      src/core/lib/iomgr/endpoint_pair_posix.cc
  29. 11
      src/core/lib/resource_quota/api.cc
  30. 15
      src/core/lib/resource_quota/api.h
  31. 4
      src/core/lib/surface/lame_client.cc
  32. 7
      src/core/lib/surface/server.cc
  33. 6
      src/core/plugin_registry/grpc_plugin_registry.cc
  34. 2
      src/core/plugin_registry/grpc_unsecure_plugin_registry.cc
  35. 2
      src/cpp/thread_manager/thread_manager.cc
  36. 1
      src/python/grpcio/grpc_core_dependencies.py
  37. 5
      test/core/bad_client/bad_client.cc
  38. 1
      test/core/client_channel/resolvers/binder_resolver_test.cc
  39. 1
      test/core/client_channel/resolvers/dns_resolver_test.cc
  40. 1
      test/core/client_channel/resolvers/sockaddr_resolver_test.cc
  41. 8
      test/core/compression/compression_test.cc
  42. 9
      test/core/end2end/end2end_tests.h
  43. 7
      test/core/end2end/fixtures/h2_census.cc
  44. 15
      test/core/end2end/fixtures/h2_compress.cc
  45. 13
      test/core/end2end/fixtures/h2_fakesec.cc
  46. 11
      test/core/end2end/fixtures/h2_fd.cc
  47. 7
      test/core/end2end/fixtures/h2_full+pipe.cc
  48. 7
      test/core/end2end/fixtures/h2_full+trace.cc
  49. 7
      test/core/end2end/fixtures/h2_full.cc
  50. 7
      test/core/end2end/fixtures/h2_http_proxy.cc
  51. 7
      test/core/end2end/fixtures/h2_insecure.cc
  52. 11
      test/core/end2end/fixtures/h2_local_abstract_uds_percent_encoded.cc
  53. 11
      test/core/end2end/fixtures/h2_local_ipv4.cc
  54. 11
      test/core/end2end/fixtures/h2_local_ipv6.cc
  55. 11
      test/core/end2end/fixtures/h2_local_uds.cc
  56. 11
      test/core/end2end/fixtures/h2_local_uds_percent_encoded.cc
  57. 22
      test/core/end2end/fixtures/h2_oauth2.cc
  58. 11
      test/core/end2end/fixtures/h2_proxy.cc
  59. 23
      test/core/end2end/fixtures/h2_sockpair+trace.cc
  60. 23
      test/core/end2end/fixtures/h2_sockpair.cc
  61. 23
      test/core/end2end/fixtures/h2_sockpair_1byte.cc
  62. 22
      test/core/end2end/fixtures/h2_ssl.cc
  63. 22
      test/core/end2end/fixtures/h2_ssl_cred_reload.cc
  64. 21
      test/core/end2end/fixtures/h2_ssl_proxy.cc
  65. 24
      test/core/end2end/fixtures/h2_tls.cc
  66. 10
      test/core/end2end/fixtures/h2_uds.cc
  67. 13
      test/core/end2end/fixtures/http_proxy_fixture.cc
  68. 2
      test/core/end2end/fixtures/http_proxy_fixture.h
  69. 7
      test/core/end2end/fixtures/inproc.cc
  70. 6
      test/core/end2end/fixtures/local_util.cc
  71. 4
      test/core/end2end/fixtures/local_util.h
  72. 8
      test/core/end2end/fixtures/proxy.cc
  73. 10
      test/core/end2end/fixtures/proxy.h
  74. 5
      test/core/end2end/fuzzers/client_fuzzer.cc
  75. 6
      test/core/end2end/fuzzers/server_fuzzer.cc
  76. 15
      test/core/end2end/inproc_callback_test.cc
  77. 12
      test/core/end2end/tests/binary_metadata.cc
  78. 25
      test/core/end2end/tests/compressed_payload.cc
  79. 16
      test/core/end2end/tests/stream_compression_compressed_payload.cc
  80. 12
      test/core/end2end/tests/stream_compression_payload.cc
  81. 12
      test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
  82. 8
      test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm
  83. 4
      test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm
  84. 5
      test/core/iomgr/tcp_client_posix_test.cc
  85. 26
      test/core/iomgr/tcp_server_posix_test.cc
  86. 5
      test/core/surface/concurrent_connectivity_test.cc
  87. 8
      test/core/transport/chttp2/context_list_test.cc
  88. 4
      test/core/transport/chttp2/settings_timeout_test.cc
  89. 5
      test/core/util/test_tcp_server.cc
  90. 5
      test/cpp/microbenchmarks/bm_chttp2_transport.cc
  91. 2
      tools/doxygen/Doxyfile.c++.internal
  92. 2
      tools/doxygen/Doxyfile.core.internal

41
BUILD

@ -968,6 +968,7 @@ grpc_cc_library(
"src/core/lib/config/core_configuration.h",
],
deps = [
"channel_args_preconditioning",
"channel_init",
"gpr_base",
"handshaker_registry",
@ -1679,13 +1680,47 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "channel_args",
srcs = [
"src/core/lib/channel/channel_args.cc",
],
hdrs = [
"src/core/lib/channel/channel_args.h",
],
external_deps = [
"absl/strings",
"absl/strings:str_format",
],
deps = [
"channel_stack_type",
"gpr_base",
"gpr_codegen",
"grpc_codegen",
"useful",
],
)
grpc_cc_library(
name = "channel_args_preconditioning",
srcs = [
"src/core/lib/channel/channel_args_preconditioning.cc",
],
hdrs = [
"src/core/lib/channel/channel_args_preconditioning.h",
],
deps = [
"channel_args",
"gpr_base",
],
)
grpc_cc_library(
name = "grpc_base",
srcs = [
"src/core/lib/address_utils/parse_address.cc",
"src/core/lib/address_utils/sockaddr_utils.cc",
"src/core/lib/backoff/backoff.cc",
"src/core/lib/channel/channel_args.cc",
"src/core/lib/channel/channel_stack.cc",
"src/core/lib/channel/channel_stack_builder.cc",
"src/core/lib/channel/channel_trace.cc",
@ -1847,7 +1882,6 @@ grpc_cc_library(
"src/core/lib/address_utils/sockaddr_utils.h",
"src/core/lib/backoff/backoff.h",
"src/core/lib/channel/call_tracer.h",
"src/core/lib/channel/channel_args.h",
"src/core/lib/channel/channel_stack.h",
"src/core/lib/channel/channel_stack_builder.h",
"src/core/lib/channel/channel_trace.h",
@ -1980,6 +2014,7 @@ grpc_cc_library(
"src/core/lib/iomgr/executor.h",
"src/core/lib/iomgr/combiner.h",
"src/core/lib/iomgr/iomgr_internal.h",
"src/core/lib/channel/channel_args.h",
] +
# TODO(hork): delete the iomgr glue code when EventEngine is fully
# integrated, or when it becomes obvious the glue code is unnecessary.
@ -2008,6 +2043,7 @@ grpc_cc_library(
deps = [
"avl",
"bitset",
"channel_args",
"channel_stack_type",
"chunked_vector",
"closure",
@ -2660,6 +2696,7 @@ grpc_cc_library(
],
language = "c++",
deps = [
"config",
"gpr_base",
"grpc_base",
"grpc_server_config_selector",

4
CMakeLists.txt generated

@ -1820,6 +1820,7 @@ add_library(grpc
src/core/lib/address_utils/sockaddr_utils.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_args_preconditioning.cc
src/core/lib/channel/channel_stack.cc
src/core/lib/channel/channel_stack_builder.cc
src/core/lib/channel/channel_trace.cc
@ -2465,6 +2466,7 @@ add_library(grpc_unsecure
src/core/lib/address_utils/sockaddr_utils.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_args_preconditioning.cc
src/core/lib/channel/channel_stack.cc
src/core/lib/channel/channel_stack_builder.cc
src/core/lib/channel/channel_trace.cc
@ -9813,6 +9815,8 @@ add_executable(core_configuration_test
src/core/ext/upb-generated/google/protobuf/timestamp.upb.c
src/core/ext/upb-generated/google/protobuf/wrappers.upb.c
src/core/ext/upb-generated/google/rpc/status.upb.c
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_args_preconditioning.cc
src/core/lib/channel/handshaker_registry.cc
src/core/lib/config/core_configuration.cc
src/core/lib/gpr/alloc.cc

2
Makefile generated

@ -1362,6 +1362,7 @@ LIBGRPC_SRC = \
src/core/lib/address_utils/sockaddr_utils.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_args_preconditioning.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
src/core/lib/channel/channel_trace.cc \
@ -1855,6 +1856,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/address_utils/sockaddr_utils.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_args_preconditioning.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
src/core/lib/channel/channel_trace.cc \

@ -732,6 +732,7 @@ libs:
- src/core/lib/backoff/backoff.h
- src/core/lib/channel/call_tracer.h
- src/core/lib/channel/channel_args.h
- src/core/lib/channel/channel_args_preconditioning.h
- src/core/lib/channel/channel_stack.h
- src/core/lib/channel/channel_stack_builder.h
- src/core/lib/channel/channel_trace.h
@ -1299,6 +1300,7 @@ libs:
- src/core/lib/address_utils/sockaddr_utils.cc
- src/core/lib/backoff/backoff.cc
- src/core/lib/channel/channel_args.cc
- src/core/lib/channel/channel_args_preconditioning.cc
- src/core/lib/channel/channel_stack.cc
- src/core/lib/channel/channel_stack_builder.cc
- src/core/lib/channel/channel_trace.cc
@ -1811,6 +1813,7 @@ libs:
- src/core/lib/backoff/backoff.h
- src/core/lib/channel/call_tracer.h
- src/core/lib/channel/channel_args.h
- src/core/lib/channel/channel_args_preconditioning.h
- src/core/lib/channel/channel_stack.h
- src/core/lib/channel/channel_stack_builder.h
- src/core/lib/channel/channel_trace.h
@ -2095,6 +2098,7 @@ libs:
- src/core/lib/address_utils/sockaddr_utils.cc
- src/core/lib/backoff/backoff.cc
- src/core/lib/channel/channel_args.cc
- src/core/lib/channel/channel_args_preconditioning.cc
- src/core/lib/channel/channel_stack.cc
- src/core/lib/channel/channel_stack_builder.cc
- src/core/lib/channel/channel_trace.cc
@ -5424,6 +5428,8 @@ targets:
- src/core/ext/upb-generated/google/protobuf/timestamp.upb.h
- src/core/ext/upb-generated/google/protobuf/wrappers.upb.h
- src/core/ext/upb-generated/google/rpc/status.upb.h
- src/core/lib/channel/channel_args.h
- src/core/lib/channel/channel_args_preconditioning.h
- src/core/lib/channel/handshaker_factory.h
- src/core/lib/channel/handshaker_registry.h
- src/core/lib/config/core_configuration.h
@ -5470,6 +5476,8 @@ targets:
- src/core/ext/upb-generated/google/protobuf/timestamp.upb.c
- src/core/ext/upb-generated/google/protobuf/wrappers.upb.c
- src/core/ext/upb-generated/google/rpc/status.upb.c
- src/core/lib/channel/channel_args.cc
- src/core/lib/channel/channel_args_preconditioning.cc
- src/core/lib/channel/handshaker_registry.cc
- src/core/lib/config/core_configuration.cc
- src/core/lib/gpr/alloc.cc

1
config.m4 generated

@ -370,6 +370,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/address_utils/sockaddr_utils.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_args_preconditioning.cc \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
src/core/lib/channel/channel_trace.cc \

1
config.w32 generated

@ -336,6 +336,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\address_utils\\sockaddr_utils.cc " +
"src\\core\\lib\\backoff\\backoff.cc " +
"src\\core\\lib\\channel\\channel_args.cc " +
"src\\core\\lib\\channel\\channel_args_preconditioning.cc " +
"src\\core\\lib\\channel\\channel_stack.cc " +
"src\\core\\lib\\channel\\channel_stack_builder.cc " +
"src\\core\\lib\\channel\\channel_trace.cc " +

2
gRPC-C++.podspec generated

@ -562,6 +562,7 @@ Pod::Spec.new do |s|
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/call_tracer.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_args_preconditioning.h',
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_trace.h',
@ -1275,6 +1276,7 @@ Pod::Spec.new do |s|
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/call_tracer.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_args_preconditioning.h',
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_trace.h',

3
gRPC-Core.podspec generated

@ -831,6 +831,8 @@ Pod::Spec.new do |s|
'src/core/lib/channel/call_tracer.h',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_args_preconditioning.cc',
'src/core/lib/channel/channel_args_preconditioning.h',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.cc',
@ -1802,6 +1804,7 @@ Pod::Spec.new do |s|
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/call_tracer.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_args_preconditioning.h',
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_trace.h',

2
grpc.gemspec generated

@ -751,6 +751,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/channel/call_tracer.h )
s.files += %w( src/core/lib/channel/channel_args.cc )
s.files += %w( src/core/lib/channel/channel_args.h )
s.files += %w( src/core/lib/channel/channel_args_preconditioning.cc )
s.files += %w( src/core/lib/channel/channel_args_preconditioning.h )
s.files += %w( src/core/lib/channel/channel_stack.cc )
s.files += %w( src/core/lib/channel/channel_stack.h )
s.files += %w( src/core/lib/channel/channel_stack_builder.cc )

2
grpc.gyp generated

@ -803,6 +803,7 @@
'src/core/lib/address_utils/sockaddr_utils.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_args_preconditioning.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',
'src/core/lib/channel/channel_trace.cc',
@ -1268,6 +1269,7 @@
'src/core/lib/address_utils/sockaddr_utils.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_args_preconditioning.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',
'src/core/lib/channel/channel_trace.cc',

2
package.xml generated

@ -731,6 +731,8 @@
<file baseinstalldir="/" name="src/core/lib/channel/call_tracer.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args_preconditioning.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args_preconditioning.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_builder.cc" role="src" />

@ -60,7 +60,9 @@ grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args,
const char* to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args* new_args0 =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
grpc_channel_args* new_args = EnsureResourceQuotaInChannelArgs(new_args0);
const grpc_channel_args* new_args = CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(new_args0);
grpc_channel_args_destroy(new_args0);
grpc_channel* channel = grpc_channel_create(
target, new_args, GRPC_CLIENT_CHANNEL, nullptr, error);
@ -91,7 +93,6 @@ grpc_channel* grpc_insecure_channel_create(const char* target,
const grpc_channel_args* args,
void* reserved) {
grpc_core::ExecCtx exec_ctx;
args = grpc_channel_args_remove_grpc_internal(args);
GRPC_API_TRACE(
"grpc_insecure_channel_create(target=%s, args=%p, reserved=%p)", 3,
(target, args, reserved));
@ -107,7 +108,6 @@ grpc_channel* grpc_insecure_channel_create(const char* target,
grpc_channel* channel = grpc_core::CreateChannel(target, new_args, &error);
// Clean up.
grpc_channel_args_destroy(new_args);
grpc_channel_args_destroy(args);
if (channel == nullptr) {
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;

@ -46,8 +46,9 @@ grpc_channel* grpc_insecure_channel_create_from_fd(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test.authority"));
args = grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
grpc_channel_args* final_args =
grpc_core::EnsureResourceQuotaInChannelArgs(args);
const grpc_channel_args* final_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel_args_destroy(args);
int flags = fcntl(fd, F_GETFL, 0);

@ -155,7 +155,9 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds,
"reserved=%p)",
4, ((void*)creds, target, (void*)args, (void*)reserved));
GPR_ASSERT(reserved == nullptr);
args = grpc_channel_args_remove_grpc_internal(args);
args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel* channel = nullptr;
grpc_error_handle error = GRPC_ERROR_NONE;
if (creds != nullptr) {
@ -167,11 +169,8 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds,
grpc_arg args_to_add[] = {channel_factory_arg,
grpc_channel_credentials_to_arg(creds)};
const char* arg_to_remove = channel_factory_arg.key;
grpc_channel_args* updated_args = grpc_channel_args_copy_and_add_and_remove(
grpc_channel_args* new_args = grpc_channel_args_copy_and_add_and_remove(
args, &arg_to_remove, 1, args_to_add, GPR_ARRAY_SIZE(args_to_add));
grpc_channel_args* new_args =
grpc_core::EnsureResourceQuotaInChannelArgs(updated_args);
grpc_channel_args_destroy(updated_args);
new_args = creds->update_arguments(new_args);
// Create channel.
channel = grpc_core::CreateChannel(target, new_args, &error);

@ -53,7 +53,9 @@ GRPCAPI grpc_channel* grpc_cronet_secure_channel_create(
const_cast<char*>(GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER);
disable_client_authority_filter_arg.type = GRPC_ARG_INTEGER;
disable_client_authority_filter_arg.value.integer = 1;
args = grpc_core::EnsureResourceQuotaInChannelArgs(args);
args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(
args, &disable_client_authority_filter_arg, 1);

@ -1281,7 +1281,7 @@ void grpc_inproc_transport_init(void) {
}
grpc_channel* grpc_inproc_channel_create(grpc_server* server,
grpc_channel_args* args,
const grpc_channel_args* args,
void* /*reserved*/) {
GRPC_API_TRACE("grpc_inproc_channel_create(server=%p, args=%p)", 2,
(server, args));
@ -1302,8 +1302,9 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
default_authority_arg.key = const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY);
default_authority_arg.value.string = const_cast<char*>("inproc.authority");
args = grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
grpc_channel_args* client_args =
grpc_core::EnsureResourceQuotaInChannelArgs(args);
const grpc_channel_args* client_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel_args_destroy(args);
grpc_transport* server_transport;
grpc_transport* client_transport;

@ -24,7 +24,7 @@
#include "src/core/lib/transport/transport_impl.h"
grpc_channel* grpc_inproc_channel_create(grpc_server* server,
grpc_channel_args* args,
const grpc_channel_args* args,
void* reserved);
extern grpc_core::TraceFlag grpc_inproc_trace;

@ -29,6 +29,7 @@
#include "src/core/ext/xds/xds_routing.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h"
@ -1231,7 +1232,9 @@ grpc_server_config_fetcher* grpc_server_config_fetcher_xds_create(
grpc_server_xds_status_notifier notifier, const grpc_channel_args* args) {
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
grpc_core::ExecCtx exec_ctx;
args = grpc_channel_args_remove_grpc_internal(args);
args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
GRPC_API_TRACE("grpc_server_config_fetcher_xds_create()", 0, ());
grpc_error_handle error = GRPC_ERROR_NONE;
grpc_core::RefCountedPtr<grpc_core::XdsClient> xds_client =

@ -29,7 +29,6 @@
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include <grpc/grpc.h>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/codegen/log.h>
#include <grpc/support/alloc.h>
@ -73,22 +72,6 @@ grpc_channel_args* grpc_channel_args_copy_and_remove(
num_to_remove, nullptr, 0);
}
grpc_channel_args* grpc_channel_args_remove_grpc_internal(
const grpc_channel_args* src) {
if (src == nullptr) return nullptr;
// Create result.
grpc_channel_args* dst =
static_cast<grpc_channel_args*>(gpr_malloc(sizeof(grpc_channel_args)));
dst->args =
static_cast<grpc_arg*>(gpr_malloc(sizeof(grpc_arg) * src->num_args));
dst->num_args = 0;
for (size_t i = 0; i < src->num_args; ++i) {
if (absl::StartsWith(src->args[i].key, "grpc.internal.")) continue;
dst->args[dst->num_args++] = copy_arg(&src->args[i]);
}
return dst;
}
static bool should_remove_arg(const grpc_arg* arg, const char** to_remove,
size_t num_to_remove) {
for (size_t i = 0; i < num_to_remove; ++i) {
@ -385,6 +368,23 @@ std::string grpc_channel_args_string(const grpc_channel_args* args) {
return absl::StrJoin(arg_strings, ", ");
}
namespace grpc_core {
const grpc_channel_args* RemoveGrpcInternalArgs(const grpc_channel_args* src) {
if (src == nullptr) return nullptr;
// Create result.
grpc_channel_args* dst =
static_cast<grpc_channel_args*>(gpr_malloc(sizeof(grpc_channel_args)));
dst->args =
static_cast<grpc_arg*>(gpr_malloc(sizeof(grpc_arg) * src->num_args));
dst->num_args = 0;
for (size_t i = 0; i < src->num_args; ++i) {
if (absl::StartsWith(src->args[i].key, "grpc.internal.")) continue;
dst->args[dst->num_args++] = copy_arg(&src->args[i]);
}
return dst;
}
} // namespace grpc_core
namespace {
grpc_channel_args_client_channel_creation_mutator g_mutator = nullptr;
} // namespace

@ -23,7 +23,7 @@
#include <string>
#include <grpc/grpc.h>
#include <grpc/impl/codegen/grpc_types.h>
#include "src/core/lib/surface/channel_stack_type.h"
@ -41,15 +41,6 @@ grpc_channel_args* grpc_channel_args_copy_and_add(const grpc_channel_args* src,
const grpc_arg* to_add,
size_t num_to_add);
/** Remove any channel args prefixed with 'grpc.internal.'
* These are used for internal implementation details and are not intended to
* be exposed to users.
* Returns a new channel args instance.
* Does not take ownership of \a src.
* Should be called by any public API that receives channel args. */
grpc_channel_args* grpc_channel_args_remove_grpc_internal(
const grpc_channel_args* src);
/** Copies the arguments in \a src except for those whose keys are in
\a to_remove. */
grpc_channel_args* grpc_channel_args_copy_and_remove(
@ -128,6 +119,16 @@ grpc_arg grpc_channel_arg_pointer_create(char* name, void* value,
// Returns a string representing channel args in human-readable form.
std::string grpc_channel_args_string(const grpc_channel_args* args);
namespace grpc_core {
/** Remove any channel args prefixed with 'grpc.internal.'
* These are used for internal implementation details and are not intended to
* be exposed to users.
* Returns a new channel args instance.
* Does not take ownership of \a src.
* Should be called by any public API that receives channel args. */
const grpc_channel_args* RemoveGrpcInternalArgs(const grpc_channel_args* src);
} // namespace grpc_core
// Takes ownership of the old_args
typedef grpc_channel_args* (*grpc_channel_args_client_channel_creation_mutator)(
const char* target, grpc_channel_args* old_args,

@ -0,0 +1,47 @@
// Copyright 2021 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/lib/channel/channel_args_preconditioning.h"
#include <grpc/support/alloc.h>
namespace grpc_core {
void ChannelArgsPreconditioning::Builder::RegisterStage(Stage stage) {
stages_.emplace_back(std::move(stage));
}
ChannelArgsPreconditioning ChannelArgsPreconditioning::Builder::Build() {
// TODO(ctiller): should probably make this registered too.
stages_.emplace_back(RemoveGrpcInternalArgs);
ChannelArgsPreconditioning preconditioning;
preconditioning.stages_ = std::move(stages_);
return preconditioning;
}
const grpc_channel_args* ChannelArgsPreconditioning::PreconditionChannelArgs(
const grpc_channel_args* args) const {
const grpc_channel_args* owned_args = nullptr;
for (auto& stage : stages_) {
args = stage(args);
grpc_channel_args_destroy(owned_args);
owned_args = args;
}
return args;
}
} // namespace grpc_core

@ -0,0 +1,62 @@
// Copyright 2021 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_CHANNEL_CHANNEL_ARGS_PRECONDITIONING_H
#define GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_PRECONDITIONING_H
#include <grpc/support/port_platform.h>
#include <functional>
#include <vector>
#include "src/core/lib/channel/channel_args.h"
namespace grpc_core {
// Registry of mutators for channel args.
// Surface APIs should call into this with channel args received from outside
// of gRPC, in order to prepare those channel args for the expections of the
// gRPC internals.
class ChannelArgsPreconditioning {
public:
// Take channel args and mutate them.
// Does not take ownership of the channel args passed in.
// Returns a new channel args object that is owned by the caller.
using Stage =
std::function<const grpc_channel_args*(const grpc_channel_args*)>;
class Builder {
public:
// Register a new channel args preconditioner.
void RegisterStage(Stage stage);
// Build out the preconditioners.
ChannelArgsPreconditioning Build();
private:
std::vector<Stage> stages_;
};
// Take channel args and precondition them.
// Does not take ownership of the channel args passed in.
// Returns a new channel args object that is owned by the caller.
const grpc_channel_args* PreconditionChannelArgs(
const grpc_channel_args* args) const;
private:
std::vector<Stage> stages_;
};
} // namespace grpc_core
#endif // GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_PRECONDITIONING_H

@ -51,8 +51,9 @@ grpc_channel_args_get_channel_default_compression_algorithm(
return GRPC_COMPRESS_NONE;
}
grpc_channel_args* grpc_channel_args_set_channel_default_compression_algorithm(
grpc_channel_args* a, grpc_compression_algorithm algorithm) {
const grpc_channel_args*
grpc_channel_args_set_channel_default_compression_algorithm(
const grpc_channel_args* a, grpc_compression_algorithm algorithm) {
GPR_ASSERT(algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT);
grpc_arg tmp;
tmp.type = GRPC_ARG_INTEGER;
@ -83,10 +84,11 @@ static int find_compression_algorithm_states_bitset(const grpc_channel_args* a,
return 0; /* GPR_FALSE */
}
grpc_channel_args* grpc_channel_args_compression_algorithm_set_state(
grpc_channel_args** a, grpc_compression_algorithm algorithm, int state) {
const grpc_channel_args* grpc_channel_args_compression_algorithm_set_state(
const grpc_channel_args** a, grpc_compression_algorithm algorithm,
int state) {
int* states_arg = nullptr;
grpc_channel_args* result = *a;
const grpc_channel_args* result = *a;
const int states_arg_found =
find_compression_algorithm_states_bitset(*a, &states_arg);

@ -32,8 +32,9 @@ grpc_channel_args_get_channel_default_compression_algorithm(
/** Returns a channel arg instance with compression enabled. If \a a is
* non-NULL, its args are copied. N.B. GRPC_COMPRESS_NONE disables compression
* for the channel. */
grpc_channel_args* grpc_channel_args_set_channel_default_compression_algorithm(
grpc_channel_args* a, grpc_compression_algorithm algorithm);
const grpc_channel_args*
grpc_channel_args_set_channel_default_compression_algorithm(
const grpc_channel_args* a, grpc_compression_algorithm algorithm);
/** Sets the support for the given compression algorithm. By default, all
* compression algorithms are enabled. It's an error to disable an algorithm set
@ -42,8 +43,9 @@ grpc_channel_args* grpc_channel_args_set_channel_default_compression_algorithm(
* Returns an instance with the updated algorithm states. The \a a pointer is
* modified to point to the returned instance (which may be different from the
* input value of \a a). */
grpc_channel_args* grpc_channel_args_compression_algorithm_set_state(
grpc_channel_args** a, grpc_compression_algorithm algorithm, int state);
const grpc_channel_args* grpc_channel_args_compression_algorithm_set_state(
const grpc_channel_args** a, grpc_compression_algorithm algorithm,
int state);
/** Returns the bitset representing the support state (true for enabled, false
* for disabled) for compression algorithms.

@ -31,7 +31,9 @@ CoreConfiguration* CoreConfiguration::Builder::Build() {
}
CoreConfiguration::CoreConfiguration(Builder* builder)
: channel_init_(builder->channel_init_.Build()),
: channel_args_preconditioning_(
builder->channel_args_preconditioning_.Build()),
channel_init_(builder->channel_init_.Build()),
handshaker_registry_(builder->handshaker_registry_.Build()) {}
void CoreConfiguration::RegisterBuilder(std::function<void(Builder*)> builder) {

@ -19,6 +19,7 @@
#include <atomic>
#include "src/core/lib/channel/channel_args_preconditioning.h"
#include "src/core/lib/channel/handshaker_registry.h"
#include "src/core/lib/surface/channel_init.h"
@ -35,6 +36,10 @@ class CoreConfiguration {
// their configuration and assemble the published CoreConfiguration.
class Builder {
public:
ChannelArgsPreconditioning::Builder* channel_args_preconditioning() {
return &channel_args_preconditioning_;
}
ChannelInit::Builder* channel_init() { return &channel_init_; }
HandshakerRegistry::Builder* handshaker_registry() {
@ -44,6 +49,7 @@ class CoreConfiguration {
private:
friend class CoreConfiguration;
ChannelArgsPreconditioning::Builder channel_args_preconditioning_;
ChannelInit::Builder channel_init_;
HandshakerRegistry::Builder handshaker_registry_;
@ -111,6 +117,10 @@ class CoreConfiguration {
// Accessors
const ChannelArgsPreconditioning& channel_args_preconditioning() const {
return channel_args_preconditioning_;
}
const ChannelInit& channel_init() const { return channel_init_; }
const HandshakerRegistry& handshaker_registry() const {
@ -135,6 +145,7 @@ class CoreConfiguration {
// Extra registered builders
static std::atomic<RegisteredBuilder*> builders_;
ChannelArgsPreconditioning channel_args_preconditioning_;
ChannelInit channel_init_;
HandshakerRegistry handshaker_registry_;
};

@ -27,6 +27,7 @@
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -204,7 +205,13 @@ class InternalRequest {
addr = &addresses_->addrs[next_address_++];
GRPC_CLOSURE_INIT(&connected_, OnConnected, this,
grpc_schedule_on_exec_ctx);
grpc_channel_args* args = ChannelArgsWrappingResourceQuota(resource_quota_);
grpc_arg rq_arg = grpc_channel_arg_pointer_create(
const_cast<char*>(GRPC_ARG_RESOURCE_QUOTA), resource_quota_->c_ptr(),
grpc_resource_quota_arg_vtable());
grpc_channel_args channel_args{1, &rq_arg};
auto* args = CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(&channel_args);
grpc_tcp_client_connect(&connected_, &ep_, context_->pollset_set, args,
addr, deadline_);
grpc_channel_args_destroy(args);

@ -60,13 +60,15 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name,
create_sockets(sv);
grpc_core::ExecCtx exec_ctx;
std::string final_name = absl::StrCat(name, ":client");
args = grpc_core::EnsureResourceQuotaInChannelArgs(args);
const grpc_channel_args* new_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
p.client = grpc_tcp_create(grpc_fd_create(sv[1], final_name.c_str(), false),
args, "socketpair-server");
new_args, "socketpair-server");
final_name = absl::StrCat(name, ":server");
p.server = grpc_tcp_create(grpc_fd_create(sv[0], final_name.c_str(), false),
args, "socketpair-client");
grpc_channel_args_destroy(args);
new_args, "socketpair-client");
grpc_channel_args_destroy(new_args);
return p;
}

@ -36,9 +36,8 @@ grpc_arg MakeArg(ResourceQuota* quota) {
const_cast<char*>(GRPC_ARG_RESOURCE_QUOTA), quota,
grpc_resource_quota_arg_vtable());
}
} // namespace
grpc_channel_args* EnsureResourceQuotaInChannelArgs(
const grpc_channel_args* EnsureResourceQuotaInChannelArgs(
const grpc_channel_args* args) {
const grpc_arg* existing =
grpc_channel_args_find(args, GRPC_ARG_RESOURCE_QUOTA);
@ -54,11 +53,11 @@ grpc_channel_args* EnsureResourceQuotaInChannelArgs(
return grpc_channel_args_copy_and_add_and_remove(args, remove, 1, &new_arg,
1);
}
} // namespace
grpc_channel_args* ChannelArgsWrappingResourceQuota(
ResourceQuotaRefPtr resource_quota) {
auto new_arg = MakeArg(resource_quota.get());
return grpc_channel_args_copy_and_add(nullptr, &new_arg, 1);
void RegisterResourceQuota(CoreConfiguration::Builder* builder) {
builder->channel_args_preconditioning()->RegisterStage(
EnsureResourceQuotaInChannelArgs);
}
} // namespace grpc_core

@ -18,6 +18,7 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/resource_quota/resource_quota.h"
typedef struct grpc_resource_quota grpc_resource_quota;
@ -33,19 +34,7 @@ constexpr size_t kResourceQuotaChannelSize = 50 * 1024;
// UB if not set.
ResourceQuotaRefPtr ResourceQuotaFromChannelArgs(const grpc_channel_args* args);
// Take some channel args:
// If there is a resource quota set, copy args and return that.
// If there is no resource quota set, set a default, and return new
// channel args. Call grpc_channel_args_destroy on the input args.
grpc_channel_args* EnsureResourceQuotaInChannelArgs(
const grpc_channel_args* args);
// Create channel args with just the passed in resource quota
grpc_channel_args* ChannelArgsWrappingResourceQuota(ResourceQuotaRefPtr);
inline ResourceQuota* ResourceQuotaFromC(grpc_resource_quota* quota) {
return reinterpret_cast<ResourceQuota*>(quota);
}
void RegisterResourceQuota(CoreConfiguration::Builder* builder);
} // namespace grpc_core

@ -187,7 +187,9 @@ grpc_channel* grpc_lame_client_channel_create(const char* target,
grpc_arg error_arg = grpc_core::MakeLameClientErrorArg(&error);
grpc_channel_args* args0 =
grpc_channel_args_copy_and_add(nullptr, &error_arg, 1);
grpc_channel_args* args = grpc_core::EnsureResourceQuotaInChannelArgs(args0);
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args0);
grpc_channel_args_destroy(args0);
grpc_channel* channel = grpc_channel_create(
target, args, GRPC_CLIENT_LAME_CHANNEL, nullptr, nullptr);

@ -1474,13 +1474,12 @@ void Server::CallData::StartTransportStreamOpBatch(
grpc_server* grpc_server_create(const grpc_channel_args* args, void* reserved) {
grpc_core::ExecCtx exec_ctx;
args = grpc_channel_args_remove_grpc_internal(args);
GRPC_API_TRACE("grpc_server_create(%p, %p)", 2, (args, reserved));
grpc_channel_args* new_args =
grpc_core::EnsureResourceQuotaInChannelArgs(args);
const grpc_channel_args* new_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_core::Server* server = new grpc_core::Server(new_args);
grpc_channel_args_destroy(new_args);
grpc_channel_args_destroy(args);
return server->c_ptr();
}

@ -169,6 +169,7 @@ extern void RegisterMessageSizeFilter(CoreConfiguration::Builder* builder);
extern void RegisterSecurityFilters(CoreConfiguration::Builder* builder);
extern void RegisterServiceConfigChannelArgFilter(
CoreConfiguration::Builder* builder);
extern void RegisterResourceQuota(CoreConfiguration::Builder* builder);
#ifndef GRPC_NO_XDS
extern void RegisterXdsChannelStackModifier(
CoreConfiguration::Builder* builder);
@ -185,9 +186,10 @@ void BuildCoreConfiguration(CoreConfiguration::Builder* builder) {
RegisterDeadlineFilter(builder);
RegisterMessageSizeFilter(builder);
RegisterServiceConfigChannelArgFilter(builder);
#ifndef GRPC_NO_XDS
RegisterResourceQuota(builder);
#ifndef GRPC_NO_XDS
RegisterXdsChannelStackModifier(builder);
#endif
#endif
// Run last so it gets a consistent location.
// TODO(ctiller): Is this actually necessary?
RegisterSecurityFilters(builder);

@ -104,6 +104,7 @@ extern void RegisterMessageSizeFilter(CoreConfiguration::Builder* builder);
extern void RegisterSecurityFilters(CoreConfiguration::Builder* builder);
extern void RegisterServiceConfigChannelArgFilter(
CoreConfiguration::Builder* builder);
extern void RegisterResourceQuota(CoreConfiguration::Builder* builder);
void BuildCoreConfiguration(CoreConfiguration::Builder* builder) {
BuildClientChannelConfiguration(builder);
@ -115,6 +116,7 @@ void BuildCoreConfiguration(CoreConfiguration::Builder* builder) {
RegisterDeadlineFilter(builder);
RegisterMessageSizeFilter(builder);
RegisterServiceConfigChannelArgFilter(builder);
RegisterResourceQuota(builder);
// Run last so it gets a consistent location.
// TODO(ctiller): Is this actually necessary?
RegisterBuiltins(builder);

@ -54,7 +54,7 @@ ThreadManager::ThreadManager(const char*, grpc_resource_quota* resource_quota,
int min_pollers, int max_pollers)
: shutdown_(false),
thread_quota_(
grpc_core::ResourceQuotaFromC(resource_quota)->thread_quota()),
grpc_core::ResourceQuota::FromC(resource_quota)->thread_quota()),
num_pollers_(0),
min_pollers_(min_pollers),
max_pollers_(max_pollers == -1 ? INT_MAX : max_pollers),

@ -345,6 +345,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/address_utils/sockaddr_utils.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_args_preconditioning.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',
'src/core/lib/channel/channel_trace.cc',

@ -212,8 +212,9 @@ void grpc_run_bad_client_test(
GRPC_BAD_CLIENT_REGISTERED_HOST,
GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER, 0);
grpc_server_start(a.server);
grpc_channel_args* channel_args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* channel_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
transport = grpc_create_chttp2_transport(channel_args, sfd.server, false);
grpc_channel_args_destroy(channel_args);
server_setup_transport(&a, transport);

@ -23,6 +23,7 @@
#include <cstring>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>

@ -18,6 +18,7 @@
#include <string.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"

@ -18,6 +18,7 @@
#include <string.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>

@ -263,7 +263,7 @@ static void test_compression_enable_disable_algorithm(void) {
static void test_channel_args_set_compression_algorithm(void) {
grpc_core::ExecCtx exec_ctx;
grpc_channel_args* ch_args;
const grpc_channel_args* ch_args;
ch_args = grpc_channel_args_set_channel_default_compression_algorithm(
nullptr, GRPC_COMPRESS_GZIP);
@ -277,8 +277,10 @@ static void test_channel_args_set_compression_algorithm(void) {
static void test_channel_args_compression_algorithm_states(void) {
grpc_core::ExecCtx exec_ctx;
grpc_channel_args *ch_args, *ch_args_wo_gzip, *ch_args_wo_gzip_deflate,
*ch_args_wo_gzip_deflate_gzip;
const grpc_channel_args* ch_args;
const grpc_channel_args* ch_args_wo_gzip;
const grpc_channel_args* ch_args_wo_gzip_deflate;
const grpc_channel_args* ch_args_wo_gzip_deflate_gzip;
unsigned states_bitset;
size_t i;

@ -63,12 +63,13 @@ struct grpc_end2end_test_config {
* expect to find in call_details.host */
const char* overridden_call_host;
grpc_end2end_test_fixture (*create_fixture)(grpc_channel_args* client_args,
grpc_channel_args* server_args);
grpc_end2end_test_fixture (*create_fixture)(
const grpc_channel_args* client_args,
const grpc_channel_args* server_args);
void (*init_client)(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args);
const grpc_channel_args* client_args);
void (*init_server)(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args);
const grpc_channel_args* server_args);
void (*tear_down_data)(grpc_end2end_test_fixture* f);
};

@ -39,7 +39,8 @@ struct fullstack_fixture_data {
};
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_fixture_data* ffd = new fullstack_fixture_data();
@ -62,7 +63,7 @@ static grpc_arg make_census_enable_arg(void) {
}
void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
grpc_arg arg = make_census_enable_arg();
@ -77,7 +78,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
grpc_arg arg = make_census_enable_arg();

@ -41,12 +41,13 @@ struct fullstack_compression_fixture_data {
grpc_channel_args_destroy(server_args_compression);
}
std::string localaddr;
grpc_channel_args* client_args_compression = nullptr;
grpc_channel_args* server_args_compression = nullptr;
const grpc_channel_args* client_args_compression = nullptr;
const grpc_channel_args* server_args_compression = nullptr;
};
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_compression_fixture_data* ffd =
@ -61,8 +62,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression(
return f;
}
void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
void chttp2_init_client_fullstack_compression(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
fullstack_compression_fixture_data* ffd =
static_cast<fullstack_compression_fixture_data*>(f->fixture_data);
if (ffd->client_args_compression != nullptr) {
@ -76,8 +77,8 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f,
ffd->localaddr.c_str(), ffd->client_args_compression, nullptr);
}
void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
void chttp2_init_server_fullstack_compression(
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
fullstack_compression_fixture_data* ffd =
static_cast<fullstack_compression_fixture_data*>(f->fixture_data);
if (ffd->server_args_compression != nullptr) {

@ -34,7 +34,8 @@ struct fullstack_secure_fixture_data {
};
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data* ffd = new fullstack_secure_fixture_data();
@ -58,7 +59,7 @@ static void process_auth_failure(void* state, grpc_auth_context* /*ctx*/,
}
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args,
grpc_channel_credentials* creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -69,7 +70,7 @@ static void chttp2_init_client_secure_fullstack(
}
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args,
grpc_server_credentials* server_creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -91,13 +92,13 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) {
}
static void chttp2_init_client_fake_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_channel_credentials* fake_ts_creds =
grpc_fake_transport_security_credentials_create();
chttp2_init_client_secure_fullstack(f, client_args, fake_ts_creds);
}
static int fail_server_auth_check(grpc_channel_args* server_args) {
static int fail_server_auth_check(const grpc_channel_args* server_args) {
size_t i;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
@ -110,7 +111,7 @@ static int fail_server_auth_check(grpc_channel_args* server_args) {
}
static void chttp2_init_server_fake_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
grpc_server_credentials* fake_ts_creds =
grpc_fake_transport_security_server_credentials_create();
if (fail_server_auth_check(server_args)) {

@ -51,7 +51,8 @@ static void create_sockets(int sv[2]) {
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
sp_fixture_data* fixture_data =
static_cast<sp_fixture_data*>(gpr_malloc(sizeof(*fixture_data)));
@ -66,8 +67,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
return f;
}
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_client_socketpair(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_core::ExecCtx exec_ctx;
sp_fixture_data* sfd = static_cast<sp_fixture_data*>(f->fixture_data);
@ -77,8 +78,8 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
GPR_ASSERT(f->client);
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
static void chttp2_init_server_socketpair(
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
grpc_core::ExecCtx exec_ctx;
sp_fixture_data* sfd = static_cast<sp_fixture_data*>(f->fixture_data);
GPR_ASSERT(!f->server);

@ -44,7 +44,8 @@ struct fullstack_fixture_data {
};
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_fixture_data* ffd = new fullstack_fixture_data();
@ -60,7 +61,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
}
void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr.c_str(), client_args,
@ -69,7 +70,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
if (f->server) {

@ -43,7 +43,8 @@ struct fullstack_fixture_data {
};
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_fixture_data* ffd = new fullstack_fixture_data();
@ -59,7 +60,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
}
void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr.c_str(), client_args,
@ -68,7 +69,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
if (f->server) {

@ -38,7 +38,8 @@ struct fullstack_fixture_data {
};
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_fixture_data* ffd = new fullstack_fixture_data();
@ -54,7 +55,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
}
void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr.c_str(), client_args,
@ -63,7 +64,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
if (f->server) {

@ -47,7 +47,8 @@ struct fullstack_fixture_data {
};
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args* client_args, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* client_args,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
fullstack_fixture_data* ffd = new fullstack_fixture_data();
@ -66,7 +67,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
}
void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
/* If testing for proxy auth, add credentials to proxy uri */
@ -90,7 +91,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
if (f->server) {

@ -35,7 +35,8 @@ struct Chttp2InsecureFullstackFixtureData {
};
grpc_end2end_test_fixture Chttp2CreateFixtureInsecureFullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
Chttp2InsecureFullstackFixtureData* ffd =
@ -50,7 +51,7 @@ grpc_end2end_test_fixture Chttp2CreateFixtureInsecureFullstack(
}
void Chttp2InitClientInsecureFullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
Chttp2InsecureFullstackFixtureData* ffd =
static_cast<Chttp2InsecureFullstackFixtureData*>(f->fixture_data);
grpc_channel_credentials* creds = grpc_insecure_credentials_create();
@ -69,7 +70,7 @@ void ProcessAuthFailure(void* state, grpc_auth_context* /*ctx*/,
}
void Chttp2InitServerInsecureFullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
Chttp2InsecureFullstackFixtureData* ffd =
static_cast<Chttp2InsecureFullstackFixtureData*>(f->fixture_data);
if (f->server) {

@ -25,7 +25,8 @@
static int unique{0};
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_uds(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f =
grpc_end2end_local_chttp2_create_fixture_fullstack();
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
@ -36,13 +37,13 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_uds(
return f;
}
static void chttp2_init_client_fullstack_uds(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_client_fullstack_uds(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_client_fullstack(f, client_args, UDS);
}
static void chttp2_init_server_fullstack_uds(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_server_fullstack_uds(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_server_fullstack(f, client_args, UDS);
}

@ -27,7 +27,8 @@
#include "test/core/util/test_config.h"
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_ipv4(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f =
grpc_end2end_local_chttp2_create_fixture_fullstack();
int port = grpc_pick_unused_port_or_die();
@ -36,13 +37,13 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_ipv4(
return f;
}
static void chttp2_init_client_fullstack_ipv4(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_client_fullstack_ipv4(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_client_fullstack(f, client_args, LOCAL_TCP);
}
static void chttp2_init_server_fullstack_ipv4(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_server_fullstack_ipv4(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_server_fullstack(f, client_args, LOCAL_TCP);
}

@ -27,7 +27,8 @@
#include "test/core/util/test_config.h"
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_ipv6(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f =
grpc_end2end_local_chttp2_create_fixture_fullstack();
int port = grpc_pick_unused_port_or_die();
@ -36,13 +37,13 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_ipv6(
return f;
}
static void chttp2_init_client_fullstack_ipv6(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_client_fullstack_ipv6(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_client_fullstack(f, client_args, LOCAL_TCP);
}
static void chttp2_init_server_fullstack_ipv6(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_server_fullstack_ipv6(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_server_fullstack(f, client_args, LOCAL_TCP);
}

@ -30,7 +30,8 @@
static int unique = 1;
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_uds(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f =
grpc_end2end_local_chttp2_create_fixture_fullstack();
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
@ -41,13 +42,13 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_uds(
return f;
}
static void chttp2_init_client_fullstack_uds(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_client_fullstack_uds(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_client_fullstack(f, client_args, UDS);
}
static void chttp2_init_server_fullstack_uds(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_server_fullstack_uds(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_server_fullstack(f, client_args, UDS);
}

@ -30,7 +30,8 @@
static int unique = 1;
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_uds(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f =
grpc_end2end_local_chttp2_create_fixture_fullstack();
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
@ -41,13 +42,13 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_uds(
return f;
}
static void chttp2_init_client_fullstack_uds(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_client_fullstack_uds(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_client_fullstack(f, client_args, UDS);
}
static void chttp2_init_server_fullstack_uds(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_server_fullstack_uds(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_end2end_local_chttp2_init_server_fullstack(f, client_args, UDS);
}

@ -96,8 +96,8 @@ static void process_oauth2_failure(void* state, grpc_auth_context* /*ctx*/,
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/,
grpc_tls_version tls_version) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/, grpc_tls_version tls_version) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data* ffd = new fullstack_secure_fixture_data();
@ -111,19 +111,21 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack_tls1_2(
grpc_channel_args* client_args, grpc_channel_args* server_args) {
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
return chttp2_create_fixture_secure_fullstack(client_args, server_args,
grpc_tls_version::TLS1_2);
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack_tls1_3(
grpc_channel_args* client_args, grpc_channel_args* server_args) {
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
return chttp2_create_fixture_secure_fullstack(client_args, server_args,
grpc_tls_version::TLS1_3);
}
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args,
grpc_channel_credentials* creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -134,7 +136,7 @@ static void chttp2_init_client_secure_fullstack(
}
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args,
grpc_server_credentials* server_creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -156,7 +158,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) {
}
static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_core::ExecCtx exec_ctx;
grpc_slice ca_slice;
GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
@ -183,7 +185,7 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char*>("foo.test.google.fr")}};
grpc_channel_args* new_client_args =
const grpc_channel_args* new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_oauth2_creds);
grpc_channel_args_destroy(new_client_args);
@ -192,7 +194,7 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_slice_unref(ca_slice);
}
static int fail_server_auth_check(grpc_channel_args* server_args) {
static int fail_server_auth_check(const grpc_channel_args* server_args) {
size_t i;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
@ -226,7 +228,7 @@ static grpc_auth_metadata_processor test_processor_create(int failing) {
}
static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
grpc_slice cert_slice, key_slice;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"load_file", grpc_load_file(SERVER_CERT_PATH, 1, &cert_slice)));

@ -38,14 +38,14 @@ typedef struct fullstack_fixture_data {
} fullstack_fixture_data;
static grpc_server* create_proxy_server(const char* port,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
grpc_server* s = grpc_server_create(server_args, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(s, port));
return s;
}
static grpc_channel* create_proxy_client(const char* target,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
return grpc_insecure_channel_create(target, client_args, nullptr);
}
@ -53,7 +53,8 @@ static const grpc_end2end_proxy_def proxy_def = {create_proxy_server,
create_proxy_client};
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args* client_args, grpc_channel_args* server_args) {
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
grpc_end2end_test_fixture f;
fullstack_fixture_data* ffd = static_cast<fullstack_fixture_data*>(
gpr_malloc(sizeof(fullstack_fixture_data)));
@ -69,7 +70,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
}
void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(
@ -78,7 +79,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
if (f->server) {

@ -69,7 +69,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
typedef struct {
grpc_end2end_test_fixture* f;
grpc_channel_args* client_args;
const grpc_channel_args* client_args;
} sp_client_setup;
static void client_setup_transport(void* ts, grpc_transport* transport) {
@ -77,7 +77,7 @@ static void client_setup_transport(void* ts, grpc_transport* transport) {
grpc_arg authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test-authority"));
grpc_channel_args* args =
const grpc_channel_args* args =
grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1);
grpc_error_handle error = GRPC_ERROR_NONE;
cs->f->client = grpc_channel_create(
@ -99,7 +99,8 @@ static void client_setup_transport(void* ts, grpc_transport* transport) {
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
custom_fixture_data* fixture_data = static_cast<custom_fixture_data*>(
gpr_malloc(sizeof(custom_fixture_data)));
grpc_end2end_test_fixture f;
@ -111,15 +112,17 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
return f;
}
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_client_socketpair(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_core::ExecCtx exec_ctx;
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
client_args = grpc_core::EnsureResourceQuotaInChannelArgs(client_args);
client_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(client_args);
transport =
grpc_create_chttp2_transport(client_args, fixture_data->ep.client, true);
grpc_channel_args_destroy(client_args);
@ -127,8 +130,8 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
GPR_ASSERT(f->client);
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
static void chttp2_init_server_socketpair(
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
grpc_core::ExecCtx exec_ctx;
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
@ -136,7 +139,9 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
server_args = grpc_core::EnsureResourceQuotaInChannelArgs(server_args);
server_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(server_args);
transport =
grpc_create_chttp2_transport(server_args, fixture_data->ep.server, false);
grpc_channel_args_destroy(server_args);

@ -64,7 +64,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
typedef struct {
grpc_end2end_test_fixture* f;
grpc_channel_args* client_args;
const grpc_channel_args* client_args;
} sp_client_setup;
static void client_setup_transport(void* ts, grpc_transport* transport) {
@ -73,7 +73,7 @@ static void client_setup_transport(void* ts, grpc_transport* transport) {
grpc_arg authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test-authority"));
grpc_channel_args* args =
const grpc_channel_args* args =
grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1);
grpc_error_handle error = GRPC_ERROR_NONE;
cs->f->client = grpc_channel_create(
@ -95,7 +95,8 @@ static void client_setup_transport(void* ts, grpc_transport* transport) {
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
custom_fixture_data* fixture_data = static_cast<custom_fixture_data*>(
gpr_malloc(sizeof(custom_fixture_data)));
grpc_end2end_test_fixture f;
@ -107,15 +108,17 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
return f;
}
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_client_socketpair(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_core::ExecCtx exec_ctx;
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
client_args = grpc_core::EnsureResourceQuotaInChannelArgs(client_args);
client_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(client_args);
transport =
grpc_create_chttp2_transport(client_args, fixture_data->ep.client, true);
grpc_channel_args_destroy(client_args);
@ -123,8 +126,8 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
GPR_ASSERT(f->client);
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
static void chttp2_init_server_socketpair(
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
grpc_core::ExecCtx exec_ctx;
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
@ -132,7 +135,9 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
server_args = grpc_core::EnsureResourceQuotaInChannelArgs(server_args);
server_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(server_args);
transport =
grpc_create_chttp2_transport(server_args, fixture_data->ep.server, false);
grpc_channel_args_destroy(server_args);

@ -64,7 +64,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
typedef struct {
grpc_end2end_test_fixture* f;
grpc_channel_args* client_args;
const grpc_channel_args* client_args;
} sp_client_setup;
static void client_setup_transport(void* ts, grpc_transport* transport) {
@ -73,7 +73,7 @@ static void client_setup_transport(void* ts, grpc_transport* transport) {
grpc_arg authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test-authority"));
grpc_channel_args* args =
const grpc_channel_args* args =
grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1);
grpc_error_handle error = GRPC_ERROR_NONE;
cs->f->client = grpc_channel_create(
@ -95,7 +95,8 @@ static void client_setup_transport(void* ts, grpc_transport* transport) {
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
custom_fixture_data* fixture_data = static_cast<custom_fixture_data*>(
gpr_malloc(sizeof(custom_fixture_data)));
grpc_end2end_test_fixture f;
@ -118,15 +119,17 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
return f;
}
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
static void chttp2_init_client_socketpair(
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_core::ExecCtx exec_ctx;
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
client_args = grpc_core::EnsureResourceQuotaInChannelArgs(client_args);
client_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(client_args);
transport =
grpc_create_chttp2_transport(client_args, fixture_data->ep.client, true);
grpc_channel_args_destroy(client_args);
@ -134,8 +137,8 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
GPR_ASSERT(f->client);
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
static void chttp2_init_server_socketpair(
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
grpc_core::ExecCtx exec_ctx;
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
@ -143,7 +146,9 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
server_args = grpc_core::EnsureResourceQuotaInChannelArgs(server_args);
server_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(server_args);
transport =
grpc_create_chttp2_transport(server_args, fixture_data->ep.server, false);
grpc_channel_args_destroy(server_args);

@ -44,8 +44,8 @@ struct fullstack_secure_fixture_data {
};
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/,
grpc_tls_version tls_version) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/, grpc_tls_version tls_version) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data* ffd = new fullstack_secure_fixture_data();
@ -62,13 +62,15 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack_tls1_2(
grpc_channel_args* client_args, grpc_channel_args* server_args) {
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
return chttp2_create_fixture_secure_fullstack(client_args, server_args,
grpc_tls_version::TLS1_2);
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack_tls1_3(
grpc_channel_args* client_args, grpc_channel_args* server_args) {
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
return chttp2_create_fixture_secure_fullstack(client_args, server_args,
grpc_tls_version::TLS1_3);
}
@ -83,7 +85,7 @@ static void process_auth_failure(void* state, grpc_auth_context* /*ctx*/,
}
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args,
grpc_channel_credentials* creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -94,7 +96,7 @@ static void chttp2_init_client_secure_fullstack(
}
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args,
grpc_server_credentials* server_creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -116,7 +118,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) {
}
static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(nullptr, nullptr, nullptr, nullptr);
if (f != nullptr && ssl_creds != nullptr) {
@ -132,13 +134,13 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char*>("foo.test.google.fr")}};
grpc_channel_args* new_client_args =
const grpc_channel_args* new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);
grpc_channel_args_destroy(new_client_args);
}
static int fail_server_auth_check(grpc_channel_args* server_args) {
static int fail_server_auth_check(const grpc_channel_args* server_args) {
size_t i;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
@ -151,7 +153,7 @@ static int fail_server_auth_check(grpc_channel_args* server_args) {
}
static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
grpc_slice cert_slice, key_slice;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"load_file", grpc_load_file(SERVER_CERT_PATH, 1, &cert_slice)));

@ -80,8 +80,8 @@ ssl_server_certificate_config_callback(
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/,
grpc_tls_version tls_version) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/, grpc_tls_version tls_version) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data* ffd = new fullstack_secure_fixture_data();
@ -97,13 +97,15 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack_tls1_2(
grpc_channel_args* client_args, grpc_channel_args* server_args) {
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
return chttp2_create_fixture_secure_fullstack(client_args, server_args,
grpc_tls_version::TLS1_2);
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack_tls1_3(
grpc_channel_args* client_args, grpc_channel_args* server_args) {
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
return chttp2_create_fixture_secure_fullstack(client_args, server_args,
grpc_tls_version::TLS1_3);
}
@ -118,7 +120,7 @@ static void process_auth_failure(void* state, grpc_auth_context* /*ctx*/,
}
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args,
grpc_channel_credentials* creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -129,7 +131,7 @@ static void chttp2_init_client_secure_fullstack(
}
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args,
grpc_server_credentials* server_creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -152,7 +154,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) {
}
static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(nullptr, nullptr, nullptr, nullptr);
if (f != nullptr && ssl_creds != nullptr) {
@ -168,13 +170,13 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char*>("foo.test.google.fr")}};
grpc_channel_args* new_client_args =
const grpc_channel_args* new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);
grpc_channel_args_destroy(new_client_args);
}
static int fail_server_auth_check(grpc_channel_args* server_args) {
static int fail_server_auth_check(const grpc_channel_args* server_args) {
size_t i;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
@ -187,7 +189,7 @@ static int fail_server_auth_check(grpc_channel_args* server_args) {
}
static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
grpc_ssl_server_credentials_options* options =
grpc_ssl_server_credentials_create_options_using_config_fetcher(
GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,

@ -42,7 +42,7 @@ typedef struct fullstack_secure_fixture_data {
} fullstack_secure_fixture_data;
static grpc_server* create_proxy_server(const char* port,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
grpc_server* s = grpc_server_create(server_args, nullptr);
grpc_slice cert_slice, key_slice;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
@ -64,7 +64,7 @@ static grpc_server* create_proxy_server(const char* port,
}
static grpc_channel* create_proxy_client(const char* target,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
grpc_channel* channel;
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(nullptr, nullptr, nullptr, nullptr);
@ -72,7 +72,7 @@ static grpc_channel* create_proxy_client(const char* target,
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char*>("foo.test.google.fr")}};
grpc_channel_args* new_client_args =
const grpc_channel_args* new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
channel =
grpc_secure_channel_create(ssl_creds, target, new_client_args, nullptr);
@ -88,7 +88,8 @@ static const grpc_end2end_proxy_def proxy_def = {create_proxy_server,
create_proxy_client};
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
grpc_channel_args* client_args, grpc_channel_args* server_args) {
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
grpc_end2end_test_fixture f;
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(
@ -114,7 +115,7 @@ static void process_auth_failure(void* state, grpc_auth_context* /*ctx*/,
}
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args,
grpc_channel_credentials* creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -126,7 +127,7 @@ static void chttp2_init_client_secure_fullstack(
}
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args,
grpc_server_credentials* server_creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -149,14 +150,14 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) {
}
static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(nullptr, nullptr, nullptr, nullptr);
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char*>("foo.test.google.fr")}};
grpc_channel_args* new_client_args =
const grpc_channel_args* new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);
{
@ -165,7 +166,7 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
}
}
static int fail_server_auth_check(grpc_channel_args* server_args) {
static int fail_server_auth_check(const grpc_channel_args* server_args) {
size_t i;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
@ -178,7 +179,7 @@ static int fail_server_auth_check(grpc_channel_args* server_args) {
}
static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args) {
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args) {
grpc_slice cert_slice, key_slice;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"load_file", grpc_load_file(SERVER_CERT_PATH, 1, &cert_slice)));

@ -173,7 +173,7 @@ static void SetCertificateVerifier(
}
static grpc_end2end_test_fixture chttp2_create_fixture_simple_fullstack(
grpc_channel_args*, grpc_channel_args*) {
const grpc_channel_args*, const grpc_channel_args*) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data* ffd = new fullstack_secure_fixture_data();
@ -191,7 +191,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_simple_fullstack(
}
static grpc_end2end_test_fixture chttp2_create_fixture_async_verifier(
grpc_channel_args*, grpc_channel_args*) {
const grpc_channel_args*, const grpc_channel_args*) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data* ffd = new fullstack_secure_fixture_data();
@ -209,8 +209,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_async_verifier(
}
static grpc_end2end_test_fixture
chttp2_create_fixture_hostname_verifier_cert_watcher(grpc_channel_args*,
grpc_channel_args*) {
chttp2_create_fixture_hostname_verifier_cert_watcher(const grpc_channel_args*,
const grpc_channel_args*) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data* ffd = new fullstack_secure_fixture_data();
@ -227,8 +227,8 @@ chttp2_create_fixture_hostname_verifier_cert_watcher(grpc_channel_args*,
}
static grpc_end2end_test_fixture
chttp2_create_fixture_async_verifier_cert_watcher(grpc_channel_args*,
grpc_channel_args*) {
chttp2_create_fixture_async_verifier_cert_watcher(const grpc_channel_args*,
const grpc_channel_args*) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data* ffd = new fullstack_secure_fixture_data();
@ -254,7 +254,7 @@ static void process_auth_failure(void* state, grpc_auth_context* /*ctx*/,
}
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args,
grpc_channel_credentials* creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -265,7 +265,7 @@ static void chttp2_init_client_secure_fullstack(
}
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args,
grpc_server_credentials* server_creds) {
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
@ -331,20 +331,20 @@ static grpc_server_credentials* create_tls_server_credentials(
}
static void chttp2_init_client(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
grpc_channel_credentials* ssl_creds = create_tls_channel_credentials(
static_cast<fullstack_secure_fixture_data*>(f->fixture_data));
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char*>("foo.test.google.fr")}};
grpc_channel_args* new_client_args =
const grpc_channel_args* new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);
grpc_channel_args_destroy(new_client_args);
}
static int fail_server_auth_check(grpc_channel_args* server_args) {
static int fail_server_auth_check(const grpc_channel_args* server_args) {
size_t i;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
@ -357,7 +357,7 @@ static int fail_server_auth_check(grpc_channel_args* server_args) {
}
static void chttp2_init_server(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
grpc_server_credentials* ssl_creds = create_tls_server_credentials(
static_cast<fullstack_secure_fixture_data*>(f->fixture_data));
if (fail_server_auth_check(server_args)) {

@ -61,7 +61,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_base(
}
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
const std::string localaddr = absl::StrFormat(
"unix:/tmp/grpc_fullstack_test.%d.%" PRId64 ".%" PRId32 ".%d", getpid(),
@ -71,7 +72,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
static grpc_end2end_test_fixture
chttp2_create_fixture_fullstack_abstract_namespace(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
const std::string localaddr = absl::StrFormat(
"unix-abstract:grpc_fullstack_test.%d.%" PRId64 ".%" PRId32 ".%d",
@ -80,7 +82,7 @@ chttp2_create_fixture_fullstack_abstract_namespace(
}
void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr.c_str(), client_args,
@ -88,7 +90,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
if (f->server) {

@ -62,7 +62,7 @@ struct grpc_end2end_http_proxy {
std::string proxy_name;
grpc_core::Thread thd;
grpc_tcp_server* server;
grpc_channel_args* channel_args;
const grpc_channel_args* channel_args;
gpr_mu* mu;
std::vector<grpc_pollset*> pollset;
gpr_refcount users;
@ -536,8 +536,9 @@ static void on_read_request_done_locked(void* arg, grpc_error_handle error) {
grpc_core::ExecCtx::Get()->Now() + 10 * GPR_MS_PER_SEC;
GRPC_CLOSURE_INIT(&conn->on_server_connect_done, on_server_connect_done, conn,
grpc_schedule_on_exec_ctx);
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_tcp_client_connect(&conn->on_server_connect_done, &conn->server_endpoint,
conn->pollset_set, args,
&resolved_addresses->addrs[0], deadline);
@ -604,7 +605,7 @@ static void thread_main(void* arg) {
}
grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
grpc_channel_args* args) {
const grpc_channel_args* args) {
grpc_core::ExecCtx exec_ctx;
grpc_end2end_http_proxy* proxy = new grpc_end2end_http_proxy();
// Construct proxy address.
@ -612,7 +613,9 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
proxy->proxy_name = grpc_core::JoinHostPort("localhost", proxy_port);
gpr_log(GPR_INFO, "Proxy address: %s", proxy->proxy_name.c_str());
// Create TCP server.
proxy->channel_args = grpc_core::EnsureResourceQuotaInChannelArgs(args);
proxy->channel_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_error_handle error =
grpc_tcp_server_create(nullptr, proxy->channel_args, &proxy->server);
GPR_ASSERT(error == GRPC_ERROR_NONE);

@ -33,7 +33,7 @@
typedef struct grpc_end2end_http_proxy grpc_end2end_http_proxy;
grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
grpc_channel_args* args);
const grpc_channel_args* args);
void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy);

@ -37,7 +37,8 @@ typedef struct inproc_fixture_data {
} inproc_fixture_data;
static grpc_end2end_test_fixture inproc_create_fixture(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
inproc_fixture_data* ffd = static_cast<inproc_fixture_data*>(
gpr_malloc(sizeof(inproc_fixture_data)));
@ -51,13 +52,13 @@ static grpc_end2end_test_fixture inproc_create_fixture(
}
void inproc_init_client(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
f->client = grpc_inproc_channel_create(f->server, client_args, nullptr);
GPR_ASSERT(f->client);
}
void inproc_init_server(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
if (f->server) {
grpc_server_destroy(f->server);
}

@ -45,7 +45,7 @@ grpc_end2end_test_fixture grpc_end2end_local_chttp2_create_fixture_fullstack() {
}
void grpc_end2end_local_chttp2_init_client_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args,
grpc_local_connect_type type) {
grpc_channel_credentials* creds = grpc_local_credentials_create(type);
grpc_end2end_local_fullstack_fixture_data* ffd =
@ -61,7 +61,7 @@ void grpc_end2end_local_chttp2_init_client_fullstack(
* processor will be installed that always fails in processing client's
* metadata.
*/
static bool fail_server_auth_check(grpc_channel_args* server_args) {
static bool fail_server_auth_check(const grpc_channel_args* server_args) {
size_t i;
if (server_args == nullptr) return false;
for (i = 0; i < server_args->num_args; i++) {
@ -83,7 +83,7 @@ static void process_auth_failure(void* state, grpc_auth_context* /*ctx*/,
}
void grpc_end2end_local_chttp2_init_server_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args,
grpc_local_connect_type type) {
grpc_server_credentials* creds = grpc_local_server_credentials_create(type);
grpc_end2end_local_fullstack_fixture_data* ffd =

@ -29,11 +29,11 @@ struct grpc_end2end_local_fullstack_fixture_data {
grpc_end2end_test_fixture grpc_end2end_local_chttp2_create_fixture_fullstack();
void grpc_end2end_local_chttp2_init_client_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args,
grpc_local_connect_type type);
void grpc_end2end_local_chttp2_init_server_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* server_args,
grpc_end2end_test_fixture* f, const grpc_channel_args* server_args,
grpc_local_connect_type type);
void grpc_end2end_local_chttp2_tear_down_fullstack(

@ -84,9 +84,9 @@ typedef struct {
static void thread_main(void* arg);
static void request_call(grpc_end2end_proxy* proxy);
grpc_end2end_proxy* grpc_end2end_proxy_create(const grpc_end2end_proxy_def* def,
grpc_channel_args* client_args,
grpc_channel_args* server_args) {
grpc_end2end_proxy* grpc_end2end_proxy_create(
const grpc_end2end_proxy_def* def, const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
int proxy_port = grpc_pick_unused_port_or_die();
int server_port = grpc_pick_unused_port_or_die();
@ -104,7 +104,7 @@ grpc_end2end_proxy* grpc_end2end_proxy_create(const grpc_end2end_proxy_def* def,
const char* arg_to_remove = GRPC_ARG_ENABLE_RETRIES;
grpc_arg arg_to_add = grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ENABLE_RETRIES), 0);
grpc_channel_args* proxy_client_args =
const grpc_channel_args* proxy_client_args =
grpc_channel_args_copy_and_add_and_remove(client_args, &arg_to_remove, 1,
&arg_to_add, 1);
proxy->client =

@ -27,14 +27,14 @@ typedef struct grpc_end2end_proxy grpc_end2end_proxy;
typedef struct grpc_end2end_proxy_def {
grpc_server* (*create_server)(const char* port,
grpc_channel_args* server_args);
const grpc_channel_args* server_args);
grpc_channel* (*create_client)(const char* target,
grpc_channel_args* client_args);
const grpc_channel_args* client_args);
} grpc_end2end_proxy_def;
grpc_end2end_proxy* grpc_end2end_proxy_create(const grpc_end2end_proxy_def* def,
grpc_channel_args* client_args,
grpc_channel_args* server_args);
grpc_end2end_proxy* grpc_end2end_proxy_create(
const grpc_end2end_proxy_def* def, const grpc_channel_args* client_args,
const grpc_channel_args* server_args);
void grpc_end2end_proxy_destroy(grpc_end2end_proxy* proxy);
const char* grpc_end2end_proxy_get_client_target(grpc_end2end_proxy* proxy);

@ -50,8 +50,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_resource_quota_create("context_list_test");
grpc_endpoint* mock_endpoint = grpc_mock_endpoint_create(discard_write);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_transport* transport =
grpc_create_chttp2_transport(args, mock_endpoint, true);
grpc_channel_args_destroy(args);

@ -52,8 +52,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// TODO(ctiller): add more registered methods (one for POST, one for PUT)
grpc_server_register_method(server, "/reg", nullptr, {}, 0);
grpc_server_start(server);
grpc_channel_args* channel_args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* channel_args =
grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_transport* transport =
grpc_create_chttp2_transport(channel_args, mock_endpoint, false);
grpc_channel_args_destroy(channel_args);

@ -205,7 +205,8 @@ static grpc_completion_queue_functor* tag(intptr_t t) {
}
static grpc_end2end_test_fixture inproc_create_fixture(
grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
const grpc_channel_args* /*client_args*/,
const grpc_channel_args* /*server_args*/) {
grpc_end2end_test_fixture f;
inproc_fixture_data* ffd = static_cast<inproc_fixture_data*>(
gpr_malloc(sizeof(inproc_fixture_data)));
@ -221,13 +222,13 @@ static grpc_end2end_test_fixture inproc_create_fixture(
}
void inproc_init_client(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
const grpc_channel_args* client_args) {
f->client = grpc_inproc_channel_create(f->server, client_args, nullptr);
GPR_ASSERT(f->client);
}
void inproc_init_server(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
const grpc_channel_args* server_args) {
if (f->server) {
grpc_server_destroy(f->server);
}
@ -241,10 +242,10 @@ void inproc_tear_down(grpc_end2end_test_fixture* f) {
gpr_free(ffd);
}
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,
grpc_channel_args* client_args,
grpc_channel_args* server_args) {
static grpc_end2end_test_fixture begin_test(
grpc_end2end_test_config config, const char* test_name,
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
f = config.create_fixture(client_args, server_args);

@ -24,7 +24,7 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/lib/resource_quota/api.h"
#include "src/core/lib/config/core_configuration.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/end2end/end2end_tests.h"
@ -36,8 +36,14 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
grpc_channel_args* server_args) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
client_args = grpc_core::EnsureResourceQuotaInChannelArgs(client_args);
server_args = grpc_core::EnsureResourceQuotaInChannelArgs(server_args);
client_args =
const_cast<grpc_channel_args*>(grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(client_args));
server_args =
const_cast<grpc_channel_args*>(grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(server_args));
f = config.create_fixture(client_args, server_args);
config.init_server(&f, server_args);
config.init_client(&f, client_args);

@ -40,11 +40,10 @@
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,
grpc_channel_args* client_args,
grpc_channel_args* server_args,
bool decompress_in_core) {
static grpc_end2end_test_fixture begin_test(
grpc_end2end_test_config config, const char* test_name,
const grpc_channel_args* client_args, const grpc_channel_args* server_args,
bool decompress_in_core) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "Running test: %s%s/%s", test_name,
decompress_in_core ? "" : "_with_decompression_disabled",
@ -108,8 +107,8 @@ static void request_for_disabled_algorithm(
grpc_call* s;
grpc_slice request_payload_slice;
grpc_byte_buffer* request_payload;
grpc_channel_args* client_args;
grpc_channel_args* server_args;
const grpc_channel_args* client_args;
const grpc_channel_args* server_args;
grpc_end2end_test_fixture f;
grpc_op ops[6];
grpc_op* op;
@ -140,8 +139,8 @@ static void request_for_disabled_algorithm(
grpc_arg disable_decompression_in_core_arg =
grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION), 0);
grpc_channel_args* old_client_args = client_args;
grpc_channel_args* old_server_args = server_args;
const grpc_channel_args* old_client_args = client_args;
const grpc_channel_args* old_server_args = server_args;
client_args = grpc_channel_args_copy_and_add(
client_args, &disable_decompression_in_core_arg, 1);
server_args = grpc_channel_args_copy_and_add(
@ -288,8 +287,8 @@ static void request_with_payload_template_inner(
grpc_call* s;
grpc_slice request_payload_slice;
grpc_byte_buffer* request_payload = nullptr;
grpc_channel_args* client_args;
grpc_channel_args* server_args;
const grpc_channel_args* client_args;
const grpc_channel_args* server_args;
grpc_end2end_test_fixture f;
grpc_op ops[6];
grpc_op* op;
@ -326,8 +325,8 @@ static void request_with_payload_template_inner(
grpc_arg disable_decompression_in_core_arg =
grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION), 0);
grpc_channel_args* old_client_args = client_args;
grpc_channel_args* old_server_args = server_args;
const grpc_channel_args* old_client_args = client_args;
const grpc_channel_args* old_server_args = server_args;
client_args = grpc_channel_args_copy_and_add(
client_args, &disable_decompression_in_core_arg, 1);
server_args = grpc_channel_args_copy_and_add(

@ -40,10 +40,10 @@
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,
grpc_channel_args* client_args,
grpc_channel_args* server_args) {
static grpc_end2end_test_fixture begin_test(
grpc_end2end_test_config config, const char* test_name,
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
f = config.create_fixture(client_args, server_args);
@ -104,8 +104,8 @@ static void request_for_disabled_algorithm(
grpc_call* s;
grpc_slice request_payload_slice;
grpc_byte_buffer* request_payload;
grpc_channel_args* client_args;
grpc_channel_args* server_args;
const grpc_channel_args* client_args;
const grpc_channel_args* server_args;
grpc_end2end_test_fixture f;
grpc_op ops[6];
grpc_op* op;
@ -280,8 +280,8 @@ static void request_with_payload_template(
grpc_call* s;
grpc_slice request_payload_slice;
grpc_byte_buffer* request_payload = nullptr;
grpc_channel_args* client_args;
grpc_channel_args* server_args;
const grpc_channel_args* client_args;
const grpc_channel_args* server_args;
grpc_end2end_test_fixture f;
grpc_op ops[6];
grpc_op* op;

@ -33,10 +33,10 @@
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,
grpc_channel_args* client_args,
grpc_channel_args* server_args) {
static grpc_end2end_test_fixture begin_test(
grpc_end2end_test_config config, const char* test_name,
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
f = config.create_fixture(client_args, server_args);
@ -263,10 +263,10 @@ static void request_response_with_payload(grpc_end2end_test_config /*config*/,
payload and status. */
static void test_invoke_request_response_with_payload(
grpc_end2end_test_config config) {
grpc_channel_args* client_args =
const grpc_channel_args* client_args =
grpc_channel_args_set_channel_default_compression_algorithm(
nullptr, GRPC_COMPRESS_STREAM_GZIP);
grpc_channel_args* server_args =
const grpc_channel_args* server_args =
grpc_channel_args_set_channel_default_compression_algorithm(
nullptr, GRPC_COMPRESS_STREAM_GZIP);
grpc_end2end_test_fixture f =

@ -33,10 +33,10 @@
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,
grpc_channel_args* client_args,
grpc_channel_args* server_args) {
static grpc_end2end_test_fixture begin_test(
grpc_end2end_test_config config, const char* test_name,
const grpc_channel_args* client_args,
const grpc_channel_args* server_args) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
f = config.create_fixture(client_args, server_args);
@ -90,10 +90,10 @@ static void end_test(grpc_end2end_test_fixture* f) {
/* Client pings and server pongs. Repeat messages rounds before finishing. */
static void test_pingpong_streaming(grpc_end2end_test_config config,
int messages) {
grpc_channel_args* client_args =
const grpc_channel_args* client_args =
grpc_channel_args_set_channel_default_compression_algorithm(
nullptr, GRPC_COMPRESS_STREAM_GZIP);
grpc_channel_args* server_args =
const grpc_channel_args* server_args =
grpc_channel_args_set_channel_default_compression_algorithm(
nullptr, GRPC_COMPRESS_STREAM_GZIP);
grpc_end2end_test_fixture f =

@ -103,7 +103,9 @@ static void must_fail(void* arg, grpc_error_handle error) {
/* connect to it */
GPR_ASSERT(getsockname(svr_fd, (struct sockaddr*)addr, (socklen_t*)&resolved_addr.len) == 0);
GRPC_CLOSURE_INIT(&done, must_succeed, nullptr, grpc_schedule_on_exec_ctx);
grpc_channel_args* args = grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
grpc_channel_args* args =
grpc_core::CoreConfiguration::Get().channel_args_preconditioning().PreconditionChannelArgs(
nullptr);
grpc_tcp_client_connect(&done, &g_connecting, nullptr, args, &resolved_addr,
GRPC_MILLIS_INF_FUTURE);
grpc_channel_args_destroy(args);
@ -160,7 +162,9 @@ static void must_fail(void* arg, grpc_error_handle error) {
/* connect to a broken address */
GRPC_CLOSURE_INIT(&done, must_fail, nullptr, grpc_schedule_on_exec_ctx);
grpc_channel_args* args = grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
grpc_channel_args* args =
grpc_core::CoreConfiguration::Get().channel_args_preconditioning().PreconditionChannelArgs(
nullptr);
grpc_tcp_client_connect(&done, &g_connecting, nullptr, args, &resolved_addr,
GRPC_MILLIS_INF_FUTURE);
grpc_channel_args_destroy(args);

@ -127,7 +127,9 @@ static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const ch
/* connect to it */
XCTAssertEqual(getsockname(svr_fd, (struct sockaddr *)addr, (socklen_t *)&resolved_addr.len), 0);
init_event_closure(&done, &connected);
grpc_channel_args *args = grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
grpc_channel_args *args =
grpc_core::CoreConfiguration::Get().channel_args_preconditioning().PreconditionChannelArgs(
nullptr);
grpc_tcp_client_connect(&done, &ep_, nullptr, args, &resolved_addr, GRPC_MILLIS_INF_FUTURE);
grpc_channel_args_destroy(args);

@ -106,8 +106,9 @@ void test_succeeds(void) {
GPR_ASSERT(getsockname(svr_fd, (struct sockaddr*)addr,
(socklen_t*)&resolved_addr.len) == 0);
GRPC_CLOSURE_INIT(&done, must_succeed, nullptr, grpc_schedule_on_exec_ctx);
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_tcp_client_connect(&done, &g_connecting, g_pollset_set, args,
&resolved_addr, GRPC_MILLIS_INF_FUTURE);
grpc_channel_args_destroy(args);

@ -164,8 +164,9 @@ static void on_connect(void* /*arg*/, grpc_endpoint* tcp,
static void test_no_op(void) {
grpc_core::ExecCtx exec_ctx;
grpc_tcp_server* s;
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(nullptr, args, &s));
grpc_channel_args_destroy(args);
grpc_tcp_server_unref(s);
@ -174,8 +175,9 @@ static void test_no_op(void) {
static void test_no_op_with_start(void) {
grpc_core::ExecCtx exec_ctx;
grpc_tcp_server* s;
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(nullptr, args, &s));
grpc_channel_args_destroy(args);
LOG_TEST("test_no_op_with_start");
@ -190,8 +192,9 @@ static void test_no_op_with_port(void) {
struct sockaddr_in* addr =
reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr);
grpc_tcp_server* s;
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(nullptr, args, &s));
grpc_channel_args_destroy(args);
LOG_TEST("test_no_op_with_port");
@ -213,8 +216,9 @@ static void test_no_op_with_port_and_start(void) {
struct sockaddr_in* addr =
reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr);
grpc_tcp_server* s;
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(nullptr, args, &s));
grpc_channel_args_destroy(args);
LOG_TEST("test_no_op_with_port_and_start");
@ -312,8 +316,10 @@ static void test_connect(size_t num_connects,
int svr1_port;
grpc_tcp_server* s;
const unsigned num_ports = 2;
grpc_channel_args* new_channel_args =
grpc_core::EnsureResourceQuotaInChannelArgs(channel_args);
const grpc_channel_args* new_channel_args =
grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(channel_args);
GPR_ASSERT(GRPC_ERROR_NONE ==
grpc_tcp_server_create(nullptr, new_channel_args, &s));
grpc_channel_args_destroy(new_channel_args);

@ -132,8 +132,9 @@ void bad_server_thread(void* vargs) {
grpc_sockaddr* addr = reinterpret_cast<grpc_sockaddr*>(resolved_addr.addr);
int port;
grpc_tcp_server* s;
grpc_channel_args* channel_args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* channel_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_error_handle error = grpc_tcp_server_create(nullptr, channel_args, &s);
grpc_channel_args_destroy(channel_args);
GPR_ASSERT(error == GRPC_ERROR_NONE);

@ -72,7 +72,9 @@ TEST_F(ContextListTest, ExecuteFlushesList) {
grpc_stream_refcount ref;
GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "phony ref");
grpc_endpoint* mock_endpoint = grpc_mock_endpoint_create(discard_write);
grpc_channel_args* args = EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_transport* t = grpc_create_chttp2_transport(args, mock_endpoint, true);
grpc_channel_args_destroy(args);
std::vector<grpc_chttp2_stream*> s;
@ -125,7 +127,9 @@ TEST_F(ContextListTest, NonEmptyListEmptyTimestamp) {
grpc_stream_refcount ref;
GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "phony ref");
grpc_endpoint* mock_endpoint = grpc_mock_endpoint_create(discard_write);
grpc_channel_args* args = EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_transport* t = grpc_create_chttp2_transport(args, mock_endpoint, true);
grpc_channel_args_destroy(args);
std::vector<grpc_chttp2_stream*> s;

@ -119,7 +119,9 @@ class Client {
grpc_pollset_set* pollset_set = grpc_pollset_set_create();
grpc_pollset_set_add_pollset(pollset_set, pollset_);
EventState state;
grpc_channel_args* args = EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_tcp_client_connect(state.closure(), &endpoint_, pollset_set, args,
server_addresses->addrs,
ExecCtx::Get()->Now() + 1000);

@ -66,8 +66,9 @@ void test_tcp_server_start(test_tcp_server* server, int port) {
memset(&addr->sin_addr, 0, sizeof(addr->sin_addr));
resolved_addr.len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in));
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_error_handle error = grpc_tcp_server_create(&server->shutdown_complete,
args, &server->tcp_server);
grpc_channel_args_destroy(args);

@ -133,8 +133,9 @@ class Fixture {
Fixture(const grpc::ChannelArguments& args, bool client) {
grpc_channel_args c_args = args.c_channel_args();
ep_ = new PhonyEndpoint;
grpc_channel_args* final_args =
grpc_core::EnsureResourceQuotaInChannelArgs(&c_args);
const grpc_channel_args* final_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(&c_args);
t_ = grpc_create_chttp2_transport(final_args, ep_, client);
grpc_channel_args_destroy(final_args);
grpc_chttp2_transport_start_reading(t_, nullptr, nullptr, nullptr);

@ -1726,6 +1726,8 @@ src/core/lib/backoff/backoff.h \
src/core/lib/channel/call_tracer.h \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_args.h \
src/core/lib/channel/channel_args_preconditioning.cc \
src/core/lib/channel/channel_args_preconditioning.h \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack.h \
src/core/lib/channel/channel_stack_builder.cc \

@ -1522,6 +1522,8 @@ src/core/lib/channel/README.md \
src/core/lib/channel/call_tracer.h \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_args.h \
src/core/lib/channel/channel_args_preconditioning.cc \
src/core/lib/channel/channel_args_preconditioning.h \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack.h \
src/core/lib/channel/channel_stack_builder.cc \

Loading…
Cancel
Save