aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-02-08 11:08:41 -0800
committerGravatar Vijay Pai <vpai@google.com>2018-02-08 11:08:41 -0800
commit239b7d4b0be55975e5fc0b62e28f3d3e2a54fa9b (patch)
tree30c6d791eed6e7eaa8dfefe29b8b60651e56b059
parent8f4fbb1c550c99e25f42ceafec3af92b34279db5 (diff)
parent100e0a78ebc1ecfaefb57c5105506b3091d4b86c (diff)
Merge branch 'master' into gpr_review
-rw-r--r--.github/CODEOWNERS3
-rw-r--r--.gitmodules4
-rw-r--r--BUILD24
-rw-r--r--CMakeLists.txt81
-rw-r--r--Makefile73
-rw-r--r--bazel/grpc_deps.bzl8
-rw-r--r--build.yaml19
-rw-r--r--cmake/ssl.cmake8
-rw-r--r--cmake/zlib.cmake7
-rw-r--r--config.m41
-rw-r--r--config.w321
-rw-r--r--doc/compression.md2
-rw-r--r--examples/python/interceptors/headers/generic_client_interceptor.py4
-rw-r--r--gRPC-C++.podspec2
-rw-r--r--gRPC-Core.podspec5
-rw-r--r--grpc.def4
-rw-r--r--grpc.gemspec4
-rw-r--r--grpc.gyp4
-rw-r--r--include/grpc++/generic/generic_stub.h19
-rw-r--r--include/grpc++/impl/codegen/client_context.h13
-rw-r--r--include/grpc++/impl/codegen/completion_queue.h115
-rw-r--r--include/grpc++/impl/codegen/proto_utils.h14
-rw-r--r--include/grpc++/impl/codegen/server_context.h9
-rw-r--r--include/grpc/compression_ruby.h48
-rw-r--r--include/grpc/impl/codegen/compression_types.h4
-rw-r--r--include/grpc/module.modulemap2
-rw-r--r--package.xml4
-rw-r--r--requirements.txt2
-rw-r--r--src/compiler/cpp_generator.cc36
-rw-r--r--src/compiler/cpp_generator.h2
-rw-r--r--src/compiler/cpp_plugin.cc3
-rw-r--r--src/core/ext/filters/client_channel/client_channel.cc3
-rw-r--r--src/core/ext/filters/client_channel/http_proxy.cc2
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc2
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc82
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc16
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/subchannel_list.h2
-rw-r--r--src/core/ext/filters/client_channel/parse_address.cc3
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc2
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc2
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc2
-rw-r--r--src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc71
-rw-r--r--src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h15
-rw-r--r--src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc2
-rw-r--r--src/core/ext/filters/client_channel/retry_throttle.cc2
-rw-r--r--src/core/ext/filters/client_channel/subchannel.cc8
-rw-r--r--src/core/ext/filters/client_channel/subchannel.h4
-rw-r--r--src/core/ext/filters/client_channel/subchannel_index.cc16
-rw-r--r--src/core/ext/filters/max_age/max_age_filter.cc180
-rw-r--r--src/core/ext/transport/cronet/transport/cronet_transport.cc2
-rw-r--r--src/core/lib/avl/avl.cc45
-rw-r--r--src/core/lib/compression/compression.cc37
-rw-r--r--src/core/lib/compression/compression_internal.cc8
-rw-r--r--src/core/lib/compression/compression_ruby.cc65
-rw-r--r--src/core/lib/gpr/env.h2
-rw-r--r--src/core/lib/gpr/host_port.cc3
-rw-r--r--src/core/lib/gpr/host_port.h (renamed from include/grpc/support/host_port.h)18
-rw-r--r--src/core/lib/gprpp/orphanable.h41
-rw-r--r--src/core/lib/gprpp/ref_counted.h40
-rw-r--r--src/core/lib/gprpp/ref_counted_ptr.h18
-rw-r--r--src/core/lib/iomgr/ev_epollex_linux.cc6
-rw-r--r--src/core/lib/iomgr/ev_poll_posix.cc12
-rw-r--r--src/core/lib/iomgr/resolve_address_posix.cc2
-rw-r--r--src/core/lib/iomgr/resolve_address_uv.cc2
-rw-r--r--src/core/lib/iomgr/resolve_address_windows.cc3
-rw-r--r--src/core/lib/iomgr/sockaddr_utils.cc2
-rw-r--r--src/core/lib/iomgr/socket_utils_common_posix.cc3
-rw-r--r--src/core/lib/security/transport/client_auth_filter.cc5
-rw-r--r--src/core/lib/security/transport/security_connector.cc2
-rw-r--r--src/core/lib/surface/call.cc1
-rw-r--r--src/core/lib/surface/version.cc2
-rw-r--r--src/core/lib/transport/static_metadata.cc461
-rw-r--r--src/core/lib/transport/static_metadata.h147
-rw-r--r--src/core/tsi/alts_transport_security.cc31
-rw-r--r--src/core/tsi/alts_transport_security.h7
-rw-r--r--src/cpp/client/client_context.cc1
-rw-r--r--src/cpp/server/server_context.cc1
-rw-r--r--src/csharp/Grpc.Core/Internal/NativeExtension.cs2
-rwxr-xr-xsrc/csharp/Grpc.Core/SourceLink.csproj.include2
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClient.cs2
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+ChannelArg.m4
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.m2
-rw-r--r--src/objective-c/ProtoRPC/ProtoMethod.m3
-rw-r--r--src/objective-c/ProtoRPC/ProtoRPC.m3
-rw-r--r--src/objective-c/ProtoRPC/ProtoService.m3
-rw-r--r--src/objective-c/RxLibrary/GRXConcurrentWriteable.m30
-rw-r--r--src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm2
-rw-r--r--src/objective-c/tests/CronetUnitTests/CronetUnitTests.m2
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi4
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi4
-rw-r--r--src/python/grpcio/grpc_core_dependencies.py1
-rw-r--r--src/python/grpcio_tests/tests/unit/_reconnect_test.py2
-rwxr-xr-xsrc/ruby/bin/apis/pubsub_demo.rb2
-rw-r--r--src/ruby/ext/grpc/rb_channel.c4
-rw-r--r--src/ruby/ext/grpc/rb_compression_options.c5
-rw-r--r--src/ruby/ext/grpc/rb_grpc_imports.generated.c8
-rw-r--r--src/ruby/ext/grpc/rb_grpc_imports.generated.h14
-rwxr-xr-xsrc/ruby/pb/test/client.rb2
-rwxr-xr-xsrc/ruby/pb/test/server.rb2
-rw-r--r--templates/CMakeLists.txt.template8
-rw-r--r--templates/tools/dockerfile/grpc_clang_format/Dockerfile.template5
-rw-r--r--templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template5
-rw-r--r--test/core/avl/avl_test.cc2
-rwxr-xr-xtest/core/bad_client/gen_build_yaml.py1
-rwxr-xr-xtest/core/bad_client/generate_tests.bzl6
-rw-r--r--test/core/bad_client/tests/duplicate_header.cc134
-rw-r--r--test/core/bad_ssl/bad_ssl_test.cc3
-rwxr-xr-xtest/core/bad_ssl/generate_tests.bzl14
-rw-r--r--test/core/channel/BUILD12
-rw-r--r--test/core/channel/channel_args_test.cc18
-rw-r--r--test/core/client_channel/BUILD20
-rw-r--r--test/core/client_channel/lb_policies_test.cc1029
-rw-r--r--test/core/client_channel/resolvers/fake_resolver_test.cc194
-rw-r--r--test/core/compression/algorithm_test.cc2
-rw-r--r--test/core/compression/compression_test.cc50
-rw-r--r--test/core/end2end/bad_server_response_test.cc2
-rw-r--r--test/core/end2end/connection_refused_test.cc2
-rw-r--r--test/core/end2end/dualstack_socket_test.cc2
-rw-r--r--test/core/end2end/fixtures/h2_census.cc3
-rw-r--r--test/core/end2end/fixtures/h2_compress.cc7
-rw-r--r--test/core/end2end/fixtures/h2_fakesec.cc3
-rw-r--r--test/core/end2end/fixtures/h2_full+pipe.cc2
-rw-r--r--test/core/end2end/fixtures/h2_full+trace.cc2
-rw-r--r--test/core/end2end/fixtures/h2_full+workarounds.cc3
-rw-r--r--test/core/end2end/fixtures/h2_full.cc2
-rw-r--r--test/core/end2end/fixtures/h2_http_proxy.cc2
-rw-r--r--test/core/end2end/fixtures/h2_load_reporting.cc2
-rw-r--r--test/core/end2end/fixtures/h2_oauth2.cc3
-rw-r--r--test/core/end2end/fixtures/h2_proxy.cc2
-rw-r--r--test/core/end2end/fixtures/h2_ssl.cc2
-rw-r--r--test/core/end2end/fixtures/h2_ssl_proxy.cc2
-rw-r--r--test/core/end2end/fixtures/h2_uds.cc2
-rw-r--r--test/core/end2end/fixtures/http_proxy_fixture.cc2
-rw-r--r--test/core/end2end/fixtures/inproc.cc3
-rw-r--r--test/core/end2end/fixtures/proxy.cc2
-rw-r--r--test/core/end2end/fuzzers/hpack.dictionary6
-rw-r--r--test/core/end2end/h2_ssl_cert_test.cc2
-rw-r--r--test/core/end2end/invalid_call_argument_test.cc2
-rw-r--r--test/core/end2end/tests/compressed_payload.cc37
-rw-r--r--test/core/end2end/tests/stream_compression_compressed_payload.cc4
-rw-r--r--test/core/end2end/tests/workaround_cronet_compression.cc13
-rw-r--r--test/core/fling/fling_stream_test.cc3
-rw-r--r--test/core/fling/fling_test.cc3
-rw-r--r--test/core/fling/server.cc3
-rw-r--r--test/core/gpr/host_port_test.cc3
-rw-r--r--test/core/gprpp/orphanable_test.cc20
-rw-r--r--test/core/gprpp/ref_counted_ptr_test.cc7
-rw-r--r--test/core/gprpp/ref_counted_test.cc13
-rw-r--r--test/core/http/BUILD13
-rw-r--r--test/core/memory_usage/memory_usage_test.cc3
-rw-r--r--test/core/memory_usage/server.cc3
-rw-r--r--test/core/surface/byte_buffer_reader_test.cc6
-rw-r--r--test/core/surface/num_external_connectivity_watchers_test.cc2
-rw-r--r--test/core/surface/public_headers_must_be_c89.c6
-rw-r--r--test/core/surface/sequential_connectivity_test.cc2
-rw-r--r--test/core/surface/server_chttp2_test.cc3
-rw-r--r--test/core/surface/server_test.cc3
-rw-r--r--test/core/util/reconnect_server.cc3
-rw-r--r--test/core/util/test_tcp_server.cc3
-rw-r--r--test/cpp/end2end/OWNERS5
-rw-r--r--test/cpp/end2end/client_lb_end2end_test.cc238
-rw-r--r--test/cpp/end2end/end2end_test.cc2
-rw-r--r--test/cpp/end2end/filter_end2end_test.cc8
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc8
-rw-r--r--test/cpp/end2end/grpclb_end2end_test.cc23
-rw-r--r--test/cpp/end2end/server_builder_plugin_test.cc2
-rw-r--r--test/cpp/grpclb/grpclb_test.cc2
-rw-r--r--test/cpp/interop/interop_client.cc4
-rw-r--r--test/cpp/interop/interop_test.cc2
-rw-r--r--test/cpp/microbenchmarks/fullstack_fixtures.h21
-rw-r--r--test/cpp/naming/resolver_component_test.cc2
-rw-r--r--test/cpp/performance/BUILD34
-rw-r--r--test/cpp/qps/client_sync.cc2
-rw-r--r--test/cpp/qps/driver.cc2
-rw-r--r--test/cpp/qps/qps_worker.cc2
-rw-r--r--test/cpp/qps/server_async.cc2
-rw-r--r--test/cpp/qps/server_sync.cc2
-rw-r--r--test/cpp/util/cli_call.cc3
-rw-r--r--test/cpp/util/proto_reflection_descriptor_database.cc25
-rw-r--r--test/distrib/cpp/run_distrib_test_cmake.bat4
-rwxr-xr-xtools/codegen/core/gen_static_metadata.py4
-rwxr-xr-xtools/distrib/clang_format_code.sh4
-rwxr-xr-xtools/distrib/clang_tidy_code.sh4
-rw-r--r--tools/dockerfile/grpc_clang_format/Dockerfile5
-rw-r--r--tools/dockerfile/grpc_clang_tidy/Dockerfile5
-rw-r--r--tools/doxygen/Doxyfile.c++2
-rw-r--r--tools/doxygen/Doxyfile.c++.internal3
-rw-r--r--tools/doxygen/Doxyfile.core2
-rw-r--r--tools/doxygen/Doxyfile.core.internal4
-rw-r--r--tools/internal_ci/helper_scripts/prepare_build_linux_rc5
-rwxr-xr-xtools/internal_ci/linux/grpc_build_submodule_at_head.sh3
-rwxr-xr-xtools/internal_ci/linux/grpc_full_performance_master.sh6
-rw-r--r--tools/internal_ci/linux/grpc_full_performance_release.cfg25
-rwxr-xr-xtools/internal_ci/linux/grpc_full_performance_release.sh59
-rw-r--r--tools/run_tests/artifacts/build_artifact_python.bat3
-rwxr-xr-xtools/run_tests/dockerize/build_docker_and_run_tests.sh6
-rwxr-xr-xtools/run_tests/dockerize/docker_run_tests.sh4
-rw-r--r--tools/run_tests/generated/sources_and_headers.json42
-rw-r--r--tools/run_tests/generated/tests.json26
-rw-r--r--tools/run_tests/performance/OWNERS2
200 files changed, 2025 insertions, 2307 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index e07cd99de9..9c0e9dd867 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -5,5 +5,6 @@
/bazel/** @nicolasnoble @dgquintas @a11r @vjpai
/cmake/** @jtattermusch @nicolasnoble @matt-kwong
/src/core/ext/filters/client_channel/** @markdroth @dgquintas @a11r
+/test/cpp/end2end/** @vjpai @yang-g @y-zeng
/tools/dockerfile/** @jtattermusch @matt-kwong @nicolasnoble
-/tools/run_tests/performance/** @ncteisen @matt-kwong @ctiller
+/tools/run_tests/performance/** @ncteisen @matt-kwong @jtattermusch
diff --git a/.gitmodules b/.gitmodules
index c4b0d241dc..52db29be00 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,10 @@
[submodule "third_party/zlib"]
path = third_party/zlib
url = https://github.com/madler/zlib
+ # When using CMake to build, the zlib submodule ends up with a
+ # generated file that makes Git consider the submodule dirty. This
+ # state can be ignored for day-to-day development on gRPC.
+ ignore = dirty
[submodule "third_party/protobuf"]
path = third_party/protobuf
url = https://github.com/google/protobuf.git
diff --git a/BUILD b/BUILD
index 4f1785d462..398a3f411c 100644
--- a/BUILD
+++ b/BUILD
@@ -68,7 +68,6 @@ GPR_PUBLIC_HDRS = [
"include/grpc/support/atm_windows.h",
"include/grpc/support/cmdline.h",
"include/grpc/support/cpu.h",
- "include/grpc/support/host_port.h",
"include/grpc/support/log.h",
"include/grpc/support/log_windows.h",
"include/grpc/support/port_platform.h",
@@ -91,7 +90,6 @@ GRPC_PUBLIC_HDRS = [
"include/grpc/byte_buffer.h",
"include/grpc/byte_buffer_reader.h",
"include/grpc/compression.h",
- "include/grpc/compression_ruby.h",
"include/grpc/fork.h",
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
@@ -451,8 +449,6 @@ grpc_cc_library(
grpc_cc_library(
name = "gpr_base",
srcs = [
- "src/core/lib/profiling/basic_timers.cc",
- "src/core/lib/profiling/stap_timers.cc",
"src/core/lib/gpr/alloc.cc",
"src/core/lib/gpr/arena.cc",
"src/core/lib/gpr/atm.cc",
@@ -494,13 +490,14 @@ grpc_cc_library(
"src/core/lib/gpr/tmpfile_posix.cc",
"src/core/lib/gpr/tmpfile_windows.cc",
"src/core/lib/gpr/wrap_memcpy.cc",
+ "src/core/lib/profiling/basic_timers.cc",
+ "src/core/lib/profiling/stap_timers.cc",
],
hdrs = [
- "src/core/lib/profiling/timers.h",
"src/core/lib/gpr/arena.h",
"src/core/lib/gpr/env.h",
"src/core/lib/gpr/fork.h",
- "src/core/lib/gpr/useful.h",
+ "src/core/lib/gpr/host_port.h",
"src/core/lib/gpr/mpscq.h",
"src/core/lib/gpr/murmur_hash.h",
"src/core/lib/gpr/spinlock.h",
@@ -509,6 +506,8 @@ grpc_cc_library(
"src/core/lib/gpr/thd_internal.h",
"src/core/lib/gpr/time_precise.h",
"src/core/lib/gpr/tmpfile.h",
+ "src/core/lib/gpr/useful.h",
+ "src/core/lib/profiling/timers.h",
],
language = "c++",
public_hdrs = GPR_PUBLIC_HDRS,
@@ -561,14 +560,14 @@ grpc_cc_library(
grpc_cc_library(
name = "atomic",
- language = "c++",
- public_hdrs = [
- "src/core/lib/gprpp/atomic.h",
- ],
hdrs = [
"src/core/lib/gprpp/atomic_with_atm.h",
"src/core/lib/gprpp/atomic_with_std.h",
],
+ language = "c++",
+ public_hdrs = [
+ "src/core/lib/gprpp/atomic.h",
+ ],
deps = [
"gpr",
],
@@ -599,6 +598,7 @@ grpc_cc_library(
"debug_location",
"gpr++_base",
"grpc_trace",
+ "ref_counted_ptr",
],
)
@@ -610,6 +610,7 @@ grpc_cc_library(
"debug_location",
"gpr++_base",
"grpc_trace",
+ "ref_counted_ptr",
],
)
@@ -636,7 +637,6 @@ grpc_cc_library(
"src/core/lib/channel/handshaker_registry.cc",
"src/core/lib/compression/compression.cc",
"src/core/lib/compression/compression_internal.cc",
- "src/core/lib/compression/compression_ruby.cc",
"src/core/lib/compression/message_compress.cc",
"src/core/lib/compression/stream_compression.cc",
"src/core/lib/compression/stream_compression_gzip.cc",
@@ -888,8 +888,8 @@ grpc_cc_library(
language = "c++",
public_hdrs = GRPC_PUBLIC_HDRS,
deps = [
- "gpr_base",
"gpr++_base",
+ "gpr_base",
"grpc_codegen",
"grpc_trace",
],
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d582e5214b..fe67dd8216 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,10 +30,10 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
project(${PACKAGE_NAME} C CXX)
-set(gRPC_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
-set(gRPC_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
-set(gRPC_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
-set(gRPC_INSTALL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/lib/cmake/${PACKAGE_NAME}" CACHE PATH "Installation directory for cmake config files")
+set(gRPC_INSTALL_BINDIR "bin" CACHE STRING "Installation directory for executables")
+set(gRPC_INSTALL_LIBDIR "lib" CACHE STRING "Installation directory for libraries")
+set(gRPC_INSTALL_INCLUDEDIR "include" CACHE STRING "Installation directory for headers")
+set(gRPC_INSTALL_CMAKEDIR "lib/cmake/${PACKAGE_NAME}" CACHE STRING "Installation directory for cmake config files")
# Options
option(gRPC_BUILD_TESTS "Build tests" OFF)
@@ -316,7 +316,6 @@ add_dependencies(buildtests_c json_rewrite_test)
add_dependencies(buildtests_c json_stream_error_test)
add_dependencies(buildtests_c json_test)
add_dependencies(buildtests_c lame_client_test)
-add_dependencies(buildtests_c lb_policies_test)
add_dependencies(buildtests_c load_file_test)
add_dependencies(buildtests_c memory_profile_client)
add_dependencies(buildtests_c memory_profile_server)
@@ -389,6 +388,7 @@ endif()
add_dependencies(buildtests_c public_headers_must_be_c89)
add_dependencies(buildtests_c badreq_bad_client_test)
add_dependencies(buildtests_c connection_prefix_bad_client_test)
+add_dependencies(buildtests_c duplicate_header_bad_client_test)
add_dependencies(buildtests_c head_of_line_blocking_bad_client_test)
add_dependencies(buildtests_c headers_bad_client_test)
add_dependencies(buildtests_c initial_settings_frame_bad_client_test)
@@ -705,7 +705,6 @@ foreach(_hdr
include/grpc/support/atm_windows.h
include/grpc/support/cmdline.h
include/grpc/support/cpu.h
- include/grpc/support/host_port.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
@@ -802,7 +801,6 @@ add_library(grpc
src/core/lib/channel/handshaker_registry.cc
src/core/lib/compression/compression.cc
src/core/lib/compression/compression_internal.cc
- src/core/lib/compression/compression_ruby.cc
src/core/lib/compression/message_compress.cc
src/core/lib/compression/stream_compression.cc
src/core/lib/compression/stream_compression_gzip.cc
@@ -1103,7 +1101,6 @@ foreach(_hdr
include/grpc/byte_buffer.h
include/grpc/byte_buffer_reader.h
include/grpc/compression.h
- include/grpc/compression_ruby.h
include/grpc/fork.h
include/grpc/grpc.h
include/grpc/grpc_posix.h
@@ -1145,7 +1142,6 @@ add_library(grpc_cronet
src/core/lib/channel/handshaker_registry.cc
src/core/lib/compression/compression.cc
src/core/lib/compression/compression_internal.cc
- src/core/lib/compression/compression_ruby.cc
src/core/lib/compression/message_compress.cc
src/core/lib/compression/stream_compression.cc
src/core/lib/compression/stream_compression_gzip.cc
@@ -1470,7 +1466,6 @@ add_library(grpc_test_util
src/core/lib/channel/handshaker_registry.cc
src/core/lib/compression/compression.cc
src/core/lib/compression/compression_internal.cc
- src/core/lib/compression/compression_ruby.cc
src/core/lib/compression/message_compress.cc
src/core/lib/compression/stream_compression.cc
src/core/lib/compression/stream_compression_gzip.cc
@@ -1739,7 +1734,6 @@ add_library(grpc_test_util_unsecure
src/core/lib/channel/handshaker_registry.cc
src/core/lib/compression/compression.cc
src/core/lib/compression/compression_internal.cc
- src/core/lib/compression/compression_ruby.cc
src/core/lib/compression/message_compress.cc
src/core/lib/compression/stream_compression.cc
src/core/lib/compression/stream_compression_gzip.cc
@@ -1991,7 +1985,6 @@ add_library(grpc_unsecure
src/core/lib/channel/handshaker_registry.cc
src/core/lib/compression/compression.cc
src/core/lib/compression/compression_internal.cc
- src/core/lib/compression/compression_ruby.cc
src/core/lib/compression/message_compress.cc
src/core/lib/compression/stream_compression.cc
src/core/lib/compression/stream_compression_gzip.cc
@@ -2258,7 +2251,6 @@ foreach(_hdr
include/grpc/byte_buffer.h
include/grpc/byte_buffer_reader.h
include/grpc/compression.h
- include/grpc/compression_ruby.h
include/grpc/fork.h
include/grpc/grpc.h
include/grpc/grpc_posix.h
@@ -2498,7 +2490,6 @@ foreach(_hdr
include/grpc/support/atm_windows.h
include/grpc/support/cmdline.h
include/grpc/support/cpu.h
- include/grpc/support/host_port.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
@@ -2531,7 +2522,6 @@ foreach(_hdr
include/grpc/byte_buffer.h
include/grpc/byte_buffer_reader.h
include/grpc/compression.h
- include/grpc/compression_ruby.h
include/grpc/fork.h
include/grpc/grpc.h
include/grpc/grpc_posix.h
@@ -2724,7 +2714,6 @@ add_library(grpc++_cronet
src/core/lib/channel/handshaker_registry.cc
src/core/lib/compression/compression.cc
src/core/lib/compression/compression_internal.cc
- src/core/lib/compression/compression_ruby.cc
src/core/lib/compression/message_compress.cc
src/core/lib/compression/stream_compression.cc
src/core/lib/compression/stream_compression_gzip.cc
@@ -2972,7 +2961,6 @@ foreach(_hdr
include/grpc/support/atm_windows.h
include/grpc/support/cmdline.h
include/grpc/support/cpu.h
- include/grpc/support/host_port.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
@@ -3005,7 +2993,6 @@ foreach(_hdr
include/grpc/byte_buffer.h
include/grpc/byte_buffer_reader.h
include/grpc/compression.h
- include/grpc/compression_ruby.h
include/grpc/fork.h
include/grpc/grpc.h
include/grpc/grpc_posix.h
@@ -3701,7 +3688,6 @@ foreach(_hdr
include/grpc/support/atm_windows.h
include/grpc/support/cmdline.h
include/grpc/support/cpu.h
- include/grpc/support/host_port.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
@@ -3734,7 +3720,6 @@ foreach(_hdr
include/grpc/byte_buffer.h
include/grpc/byte_buffer_reader.h
include/grpc/compression.h
- include/grpc/compression_ruby.h
include/grpc/fork.h
include/grpc/grpc.h
include/grpc/grpc_posix.h
@@ -6988,33 +6973,6 @@ target_link_libraries(lame_client_test
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
-add_executable(lb_policies_test
- test/core/client_channel/lb_policies_test.cc
-)
-
-
-target_include_directories(lb_policies_test
- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
- PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
- PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
- PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
- PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
- PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
- PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
-)
-
-target_link_libraries(lb_policies_test
- ${_gRPC_ALLTARGETS_LIBRARIES}
- grpc_test_util
- grpc
- gpr_test_util
- gpr
-)
-
-endif (gRPC_BUILD_TESTS)
-if (gRPC_BUILD_TESTS)
-
add_executable(load_file_test
test/core/iomgr/load_file_test.cc
)
@@ -12355,6 +12313,35 @@ target_link_libraries(connection_prefix_bad_client_test
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
+add_executable(duplicate_header_bad_client_test
+ test/core/bad_client/tests/duplicate_header.cc
+)
+
+
+target_include_directories(duplicate_header_bad_client_test
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
+ PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
+ PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
+ PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
+ PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
+ PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
+ PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
+)
+
+target_link_libraries(duplicate_header_bad_client_test
+ ${_gRPC_SSL_LIBRARIES}
+ ${_gRPC_ALLTARGETS_LIBRARIES}
+ bad_client_test
+ grpc_test_util_unsecure
+ grpc_unsecure
+ gpr_test_util
+ gpr
+)
+
+endif (gRPC_BUILD_TESTS)
+if (gRPC_BUILD_TESTS)
+
add_executable(head_of_line_blocking_bad_client_test
test/core/bad_client/tests/head_of_line_blocking.cc
)
diff --git a/Makefile b/Makefile
index 89b1d98811..21906d4445 100644
--- a/Makefile
+++ b/Makefile
@@ -1039,7 +1039,6 @@ json_rewrite_test: $(BINDIR)/$(CONFIG)/json_rewrite_test
json_stream_error_test: $(BINDIR)/$(CONFIG)/json_stream_error_test
json_test: $(BINDIR)/$(CONFIG)/json_test
lame_client_test: $(BINDIR)/$(CONFIG)/lame_client_test
-lb_policies_test: $(BINDIR)/$(CONFIG)/lb_policies_test
load_file_test: $(BINDIR)/$(CONFIG)/load_file_test
low_level_ping_pong_benchmark: $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark
memory_profile_client: $(BINDIR)/$(CONFIG)/memory_profile_client
@@ -1245,6 +1244,7 @@ boringssl_span_test: $(BINDIR)/$(CONFIG)/boringssl_span_test
boringssl_ssl_test: $(BINDIR)/$(CONFIG)/boringssl_ssl_test
badreq_bad_client_test: $(BINDIR)/$(CONFIG)/badreq_bad_client_test
connection_prefix_bad_client_test: $(BINDIR)/$(CONFIG)/connection_prefix_bad_client_test
+duplicate_header_bad_client_test: $(BINDIR)/$(CONFIG)/duplicate_header_bad_client_test
head_of_line_blocking_bad_client_test: $(BINDIR)/$(CONFIG)/head_of_line_blocking_bad_client_test
headers_bad_client_test: $(BINDIR)/$(CONFIG)/headers_bad_client_test
initial_settings_frame_bad_client_test: $(BINDIR)/$(CONFIG)/initial_settings_frame_bad_client_test
@@ -1447,7 +1447,6 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/json_stream_error_test \
$(BINDIR)/$(CONFIG)/json_test \
$(BINDIR)/$(CONFIG)/lame_client_test \
- $(BINDIR)/$(CONFIG)/lb_policies_test \
$(BINDIR)/$(CONFIG)/load_file_test \
$(BINDIR)/$(CONFIG)/memory_profile_client \
$(BINDIR)/$(CONFIG)/memory_profile_server \
@@ -1498,6 +1497,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/public_headers_must_be_c89 \
$(BINDIR)/$(CONFIG)/badreq_bad_client_test \
$(BINDIR)/$(CONFIG)/connection_prefix_bad_client_test \
+ $(BINDIR)/$(CONFIG)/duplicate_header_bad_client_test \
$(BINDIR)/$(CONFIG)/head_of_line_blocking_bad_client_test \
$(BINDIR)/$(CONFIG)/headers_bad_client_test \
$(BINDIR)/$(CONFIG)/initial_settings_frame_bad_client_test \
@@ -2050,6 +2050,8 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/badreq_bad_client_test || ( echo test badreq_bad_client_test failed ; exit 1 )
$(E) "[RUN] Testing connection_prefix_bad_client_test"
$(Q) $(BINDIR)/$(CONFIG)/connection_prefix_bad_client_test || ( echo test connection_prefix_bad_client_test failed ; exit 1 )
+ $(E) "[RUN] Testing duplicate_header_bad_client_test"
+ $(Q) $(BINDIR)/$(CONFIG)/duplicate_header_bad_client_test || ( echo test duplicate_header_bad_client_test failed ; exit 1 )
$(E) "[RUN] Testing head_of_line_blocking_bad_client_test"
$(Q) $(BINDIR)/$(CONFIG)/head_of_line_blocking_bad_client_test || ( echo test head_of_line_blocking_bad_client_test failed ; exit 1 )
$(E) "[RUN] Testing headers_bad_client_test"
@@ -2923,7 +2925,6 @@ PUBLIC_HEADERS_C += \
include/grpc/support/atm_windows.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
- include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
@@ -3029,7 +3030,6 @@ LIBGRPC_SRC = \
src/core/lib/channel/handshaker_registry.cc \
src/core/lib/compression/compression.cc \
src/core/lib/compression/compression_internal.cc \
- src/core/lib/compression/compression_ruby.cc \
src/core/lib/compression/message_compress.cc \
src/core/lib/compression/stream_compression.cc \
src/core/lib/compression/stream_compression_gzip.cc \
@@ -3297,7 +3297,6 @@ PUBLIC_HEADERS_C += \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/compression.h \
- include/grpc/compression_ruby.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
@@ -3374,7 +3373,6 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/channel/handshaker_registry.cc \
src/core/lib/compression/compression.cc \
src/core/lib/compression/compression_internal.cc \
- src/core/lib/compression/compression_ruby.cc \
src/core/lib/compression/message_compress.cc \
src/core/lib/compression/stream_compression.cc \
src/core/lib/compression/stream_compression_gzip.cc \
@@ -3700,7 +3698,6 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/channel/handshaker_registry.cc \
src/core/lib/compression/compression.cc \
src/core/lib/compression/compression_internal.cc \
- src/core/lib/compression/compression_ruby.cc \
src/core/lib/compression/message_compress.cc \
src/core/lib/compression/stream_compression.cc \
src/core/lib/compression/stream_compression_gzip.cc \
@@ -3962,7 +3959,6 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
src/core/lib/channel/handshaker_registry.cc \
src/core/lib/compression/compression.cc \
src/core/lib/compression/compression_internal.cc \
- src/core/lib/compression/compression_ruby.cc \
src/core/lib/compression/message_compress.cc \
src/core/lib/compression/stream_compression.cc \
src/core/lib/compression/stream_compression_gzip.cc \
@@ -4194,7 +4190,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/channel/handshaker_registry.cc \
src/core/lib/compression/compression.cc \
src/core/lib/compression/compression_internal.cc \
- src/core/lib/compression/compression_ruby.cc \
src/core/lib/compression/message_compress.cc \
src/core/lib/compression/stream_compression.cc \
src/core/lib/compression/stream_compression_gzip.cc \
@@ -4429,7 +4424,6 @@ PUBLIC_HEADERS_C += \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/compression.h \
- include/grpc/compression_ruby.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
@@ -4654,7 +4648,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/atm_windows.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
- include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
@@ -4687,7 +4680,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/compression.h \
- include/grpc/compression_ruby.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
@@ -4928,7 +4920,6 @@ LIBGRPC++_CRONET_SRC = \
src/core/lib/channel/handshaker_registry.cc \
src/core/lib/compression/compression.cc \
src/core/lib/compression/compression_internal.cc \
- src/core/lib/compression/compression_ruby.cc \
src/core/lib/compression/message_compress.cc \
src/core/lib/compression/stream_compression.cc \
src/core/lib/compression/stream_compression_gzip.cc \
@@ -5141,7 +5132,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/atm_windows.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
- include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
@@ -5174,7 +5164,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/compression.h \
- include/grpc/compression_ruby.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
@@ -5859,7 +5848,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/atm_windows.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
- include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
@@ -5892,7 +5880,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/compression.h \
- include/grpc/compression_ruby.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
@@ -12106,38 +12093,6 @@ endif
endif
-LB_POLICIES_TEST_SRC = \
- test/core/client_channel/lb_policies_test.cc \
-
-LB_POLICIES_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LB_POLICIES_TEST_SRC))))
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL.
-
-$(BINDIR)/$(CONFIG)/lb_policies_test: openssl_dep_error
-
-else
-
-
-
-$(BINDIR)/$(CONFIG)/lb_policies_test: $(LB_POLICIES_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
- $(E) "[LD] Linking $@"
- $(Q) mkdir -p `dirname $@`
- $(Q) $(LD) $(LDFLAGS) $(LB_POLICIES_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/lb_policies_test
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/core/client_channel/lb_policies_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_lb_policies_test: $(LB_POLICIES_TEST_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(LB_POLICIES_TEST_OBJS:.o=.dep)
-endif
-endif
-
-
LOAD_FILE_TEST_SRC = \
test/core/iomgr/load_file_test.cc \
@@ -20143,6 +20098,26 @@ ifneq ($(NO_DEPS),true)
endif
+DUPLICATE_HEADER_BAD_CLIENT_TEST_SRC = \
+ test/core/bad_client/tests/duplicate_header.cc \
+
+DUPLICATE_HEADER_BAD_CLIENT_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(DUPLICATE_HEADER_BAD_CLIENT_TEST_SRC))))
+
+
+$(BINDIR)/$(CONFIG)/duplicate_header_bad_client_test: $(DUPLICATE_HEADER_BAD_CLIENT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libbad_client_test.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+ $(E) "[LD] Linking $@"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) $(LD) $(LDFLAGS) $(DUPLICATE_HEADER_BAD_CLIENT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libbad_client_test.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/duplicate_header_bad_client_test
+
+$(OBJDIR)/$(CONFIG)/test/core/bad_client/tests/duplicate_header.o: $(LIBDIR)/$(CONFIG)/libbad_client_test.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
+deps_duplicate_header_bad_client_test: $(DUPLICATE_HEADER_BAD_CLIENT_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_DEPS),true)
+-include $(DUPLICATE_HEADER_BAD_CLIENT_TEST_OBJS:.o=.dep)
+endif
+
+
HEAD_OF_LINE_BLOCKING_BAD_CLIENT_TEST_SRC = \
test/core/bad_client/tests/head_of_line_blocking.cc \
diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl
index e465312a40..47d33085a2 100644
--- a/bazel/grpc_deps.bzl
+++ b/bazel/grpc_deps.bzl
@@ -120,10 +120,10 @@ def grpc_deps():
if "com_github_bazelbuild_bazeltoolchains" not in native.existing_rules():
native.http_archive(
name = "com_github_bazelbuild_bazeltoolchains",
- strip_prefix = "bazel-toolchains-af4681c3d19f063f090222ec3d04108c4e0ca255",
+ strip_prefix = "bazel-toolchains-f3b09700fae5d7b6e659d7cefe0dcc6e8498504c",
urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/af4681c3d19f063f090222ec3d04108c4e0ca255.tar.gz",
- "https://github.com/bazelbuild/bazel-toolchains/archive/af4681c3d19f063f090222ec3d04108c4e0ca255.tar.gz",
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/f3b09700fae5d7b6e659d7cefe0dcc6e8498504c.tar.gz",
+ "https://github.com/bazelbuild/bazel-toolchains/archive/f3b09700fae5d7b6e659d7cefe0dcc6e8498504c.tar.gz",
],
- sha256 = "d58bb2d6c8603f600d522b6104d6192a65339aa26cbba9f11ff5c4b36dedb928",
+ sha256 = "ed829b5eea8af1f405f4cc3d6ecfc3b1365bb7843171036030a31b5127002311",
)
diff --git a/build.yaml b/build.yaml
index f4ac3388ab..77c1d60f92 100644
--- a/build.yaml
+++ b/build.yaml
@@ -13,7 +13,7 @@ settings:
'#09': Per-language overrides are possible with (eg) ruby_version tag here
'#10': See the expand_version.py for all the quirks here
core_version: 6.0.0-dev
- g_stands_for: glossy
+ g_stands_for: glamorous
version: 1.10.0-dev
filegroups:
- name: census
@@ -80,7 +80,6 @@ filegroups:
- include/grpc/support/atm_windows.h
- include/grpc/support/cmdline.h
- include/grpc/support/cpu.h
- - include/grpc/support/host_port.h
- include/grpc/support/log.h
- include/grpc/support/log_windows.h
- include/grpc/support/port_platform.h
@@ -101,6 +100,7 @@ filegroups:
- src/core/lib/gpr/arena.h
- src/core/lib/gpr/env.h
- src/core/lib/gpr/fork.h
+ - src/core/lib/gpr/host_port.h
- src/core/lib/gpr/mpscq.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
@@ -159,7 +159,6 @@ filegroups:
- src/core/lib/channel/handshaker_registry.cc
- src/core/lib/compression/compression.cc
- src/core/lib/compression/compression_internal.cc
- - src/core/lib/compression/compression_ruby.cc
- src/core/lib/compression/message_compress.cc
- src/core/lib/compression/stream_compression.cc
- src/core/lib/compression/stream_compression_gzip.cc
@@ -295,7 +294,6 @@ filegroups:
- include/grpc/byte_buffer.h
- include/grpc/byte_buffer_reader.h
- include/grpc/compression.h
- - include/grpc/compression_ruby.h
- include/grpc/fork.h
- include/grpc/grpc.h
- include/grpc/grpc_posix.h
@@ -2724,19 +2722,6 @@ targets:
- grpc
- gpr_test_util
- gpr
-- name: lb_policies_test
- cpu_cost: 0.1
- build: test
- run: false
- language: c
- src:
- - test/core/client_channel/lb_policies_test.cc
- deps:
- - grpc_test_util
- - grpc
- - gpr_test_util
- - gpr
- uses_polling: false
- name: load_file_test
build: test
language: c
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index 75ce069fe6..53d8a1597e 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -32,7 +32,13 @@ if("${gRPC_SSL_PROVIDER}" STREQUAL "module")
endif()
elseif("${gRPC_SSL_PROVIDER}" STREQUAL "package")
find_package(OpenSSL REQUIRED)
- set(_gRPC_SSL_LIBRARIES ${OPENSSL_LIBRARIES})
+
+ if(TARGET OpenSSL::SSL)
+ set(_gRPC_SSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
+ else()
+ set(_gRPC_SSL_LIBRARIES ${OPENSSL_LIBRARIES})
+ endif()
set(_gRPC_SSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR})
+
set(_gRPC_FIND_SSL "if(NOT OPENSSL_FOUND)\n find_package(OpenSSL)\nendif()")
endif()
diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake
index 4a9d2f011b..e4c94f5213 100644
--- a/cmake/zlib.cmake
+++ b/cmake/zlib.cmake
@@ -34,7 +34,12 @@ if("${gRPC_ZLIB_PROVIDER}" STREQUAL "module")
endif()
elseif("${gRPC_ZLIB_PROVIDER}" STREQUAL "package")
find_package(ZLIB REQUIRED)
- set(_gRPC_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
+
+ if(TARGET ZLIB::ZLIB)
+ set(_gRPC_ZLIB_LIBRARIES ZLIB::ZLIB)
+ else()
+ set(_gRPC_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
+ endif()
set(_gRPC_ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS})
set(_gRPC_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()")
endif()
diff --git a/config.m4 b/config.m4
index ec48ff9619..5ace5cbf36 100644
--- a/config.m4
+++ b/config.m4
@@ -94,7 +94,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/channel/handshaker_registry.cc \
src/core/lib/compression/compression.cc \
src/core/lib/compression/compression_internal.cc \
- src/core/lib/compression/compression_ruby.cc \
src/core/lib/compression/message_compress.cc \
src/core/lib/compression/stream_compression.cc \
src/core/lib/compression/stream_compression_gzip.cc \
diff --git a/config.w32 b/config.w32
index 9a44d1f9ec..a951ad245e 100644
--- a/config.w32
+++ b/config.w32
@@ -71,7 +71,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\channel\\handshaker_registry.cc " +
"src\\core\\lib\\compression\\compression.cc " +
"src\\core\\lib\\compression\\compression_internal.cc " +
- "src\\core\\lib\\compression\\compression_ruby.cc " +
"src\\core\\lib\\compression\\message_compress.cc " +
"src\\core\\lib\\compression\\stream_compression.cc " +
"src\\core\\lib\\compression\\stream_compression_gzip.cc " +
diff --git a/doc/compression.md b/doc/compression.md
index bf38e3bd53..b8cdfb3048 100644
--- a/doc/compression.md
+++ b/doc/compression.md
@@ -63,7 +63,7 @@ header received from the client), it SHALL send the message uncompressed.
If the user (through the previously described mechanisms) requests to disable
compression the next message MUST be sent uncompressed. This is instrumental in
-preventing BEAST/CRIME attacks. This applies to both the the unary and streaming
+preventing BEAST/CRIME attacks. This applies to both the unary and streaming
cases.
### Compression Levels and Algorithms
diff --git a/examples/python/interceptors/headers/generic_client_interceptor.py b/examples/python/interceptors/headers/generic_client_interceptor.py
index 30b0755aaf..d2bb7e568a 100644
--- a/examples/python/interceptors/headers/generic_client_interceptor.py
+++ b/examples/python/interceptors/headers/generic_client_interceptor.py
@@ -33,14 +33,14 @@ class _GenericClientInterceptor(
request):
new_details, new_request_iterator, postprocess = self._fn(
client_call_details, iter((request,)), False, True)
- response_it = continuation(new_details, new_request_iterator)
+ response_it = continuation(new_details, next(new_request_iterator))
return postprocess(response_it) if postprocess else response_it
def intercept_stream_unary(self, continuation, client_call_details,
request_iterator):
new_details, new_request_iterator, postprocess = self._fn(
client_call_details, request_iterator, True, False)
- response = continuation(new_details, next(new_request_iterator))
+ response = continuation(new_details, new_request_iterator)
return postprocess(response) if postprocess else response
def intercept_stream_stream(self, continuation, client_call_details,
diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec
index 7aa2998796..281c7e7cb8 100644
--- a/gRPC-C++.podspec
+++ b/gRPC-C++.podspec
@@ -206,6 +206,7 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/fork.h',
+ 'src/core/lib/gpr/host_port.h',
'src/core/lib/gpr/mpscq.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
@@ -453,6 +454,7 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/fork.h',
+ 'src/core/lib/gpr/host_port.h',
'src/core/lib/gpr/mpscq.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index ea6e95e8dd..414df047e2 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -116,7 +116,6 @@ Pod::Spec.new do |s|
'include/grpc/support/atm_windows.h',
'include/grpc/support/cmdline.h',
'include/grpc/support/cpu.h',
- 'include/grpc/support/host_port.h',
'include/grpc/support/log.h',
'include/grpc/support/log_windows.h',
'include/grpc/support/port_platform.h',
@@ -171,7 +170,6 @@ Pod::Spec.new do |s|
'include/grpc/byte_buffer.h',
'include/grpc/byte_buffer_reader.h',
'include/grpc/compression.h',
- 'include/grpc/compression_ruby.h',
'include/grpc/fork.h',
'include/grpc/grpc.h',
'include/grpc/grpc_posix.h',
@@ -194,6 +192,7 @@ Pod::Spec.new do |s|
ss.source_files = 'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/fork.h',
+ 'src/core/lib/gpr/host_port.h',
'src/core/lib/gpr/mpscq.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
@@ -481,7 +480,6 @@ Pod::Spec.new do |s|
'src/core/lib/channel/handshaker_registry.cc',
'src/core/lib/compression/compression.cc',
'src/core/lib/compression/compression_internal.cc',
- 'src/core/lib/compression/compression_ruby.cc',
'src/core/lib/compression/message_compress.cc',
'src/core/lib/compression/stream_compression.cc',
'src/core/lib/compression/stream_compression_gzip.cc',
@@ -723,6 +721,7 @@ Pod::Spec.new do |s|
ss.private_header_files = 'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/fork.h',
+ 'src/core/lib/gpr/host_port.h',
'src/core/lib/gpr/mpscq.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
diff --git a/grpc.def b/grpc.def
index 022e527247..dd3fd51de5 100644
--- a/grpc.def
+++ b/grpc.def
@@ -8,8 +8,6 @@ EXPORTS
grpc_compression_options_enable_algorithm
grpc_compression_options_disable_algorithm
grpc_compression_options_is_algorithm_enabled
- grpc_compression_algorithm_parse_ruby
- grpc_compression_algorithm_name_ruby
grpc_metadata_array_init
grpc_metadata_array_destroy
grpc_call_details_init
@@ -189,8 +187,6 @@ EXPORTS
gpr_cmdline_usage_string
gpr_cpu_num_cores
gpr_cpu_current_cpu
- gpr_join_host_port
- gpr_split_host_port
gpr_log_severity_string
gpr_log
gpr_log_message
diff --git a/grpc.gemspec b/grpc.gemspec
index db36cd8811..12c5796029 100644
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -51,7 +51,6 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/support/atm_windows.h )
s.files += %w( include/grpc/support/cmdline.h )
s.files += %w( include/grpc/support/cpu.h )
- s.files += %w( include/grpc/support/host_port.h )
s.files += %w( include/grpc/support/log.h )
s.files += %w( include/grpc/support/log_windows.h )
s.files += %w( include/grpc/support/port_platform.h )
@@ -84,6 +83,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/arena.h )
s.files += %w( src/core/lib/gpr/env.h )
s.files += %w( src/core/lib/gpr/fork.h )
+ s.files += %w( src/core/lib/gpr/host_port.h )
s.files += %w( src/core/lib/gpr/mpscq.h )
s.files += %w( src/core/lib/gpr/murmur_hash.h )
s.files += %w( src/core/lib/gpr/spinlock.h )
@@ -168,7 +168,6 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/byte_buffer.h )
s.files += %w( include/grpc/byte_buffer_reader.h )
s.files += %w( include/grpc/compression.h )
- s.files += %w( include/grpc/compression_ruby.h )
s.files += %w( include/grpc/fork.h )
s.files += %w( include/grpc/grpc.h )
s.files += %w( include/grpc/grpc_posix.h )
@@ -411,7 +410,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/channel/handshaker_registry.cc )
s.files += %w( src/core/lib/compression/compression.cc )
s.files += %w( src/core/lib/compression/compression_internal.cc )
- s.files += %w( src/core/lib/compression/compression_ruby.cc )
s.files += %w( src/core/lib/compression/message_compress.cc )
s.files += %w( src/core/lib/compression/stream_compression.cc )
s.files += %w( src/core/lib/compression/stream_compression_gzip.cc )
diff --git a/grpc.gyp b/grpc.gyp
index 6d6ac35355..007af12bdf 100644
--- a/grpc.gyp
+++ b/grpc.gyp
@@ -235,7 +235,6 @@
'src/core/lib/channel/handshaker_registry.cc',
'src/core/lib/compression/compression.cc',
'src/core/lib/compression/compression_internal.cc',
- 'src/core/lib/compression/compression_ruby.cc',
'src/core/lib/compression/message_compress.cc',
'src/core/lib/compression/stream_compression.cc',
'src/core/lib/compression/stream_compression_gzip.cc',
@@ -531,7 +530,6 @@
'src/core/lib/channel/handshaker_registry.cc',
'src/core/lib/compression/compression.cc',
'src/core/lib/compression/compression_internal.cc',
- 'src/core/lib/compression/compression_ruby.cc',
'src/core/lib/compression/message_compress.cc',
'src/core/lib/compression/stream_compression.cc',
'src/core/lib/compression/stream_compression_gzip.cc',
@@ -745,7 +743,6 @@
'src/core/lib/channel/handshaker_registry.cc',
'src/core/lib/compression/compression.cc',
'src/core/lib/compression/compression_internal.cc',
- 'src/core/lib/compression/compression_ruby.cc',
'src/core/lib/compression/message_compress.cc',
'src/core/lib/compression/stream_compression.cc',
'src/core/lib/compression/stream_compression_gzip.cc',
@@ -941,7 +938,6 @@
'src/core/lib/channel/handshaker_registry.cc',
'src/core/lib/compression/compression.cc',
'src/core/lib/compression/compression_internal.cc',
- 'src/core/lib/compression/compression_ruby.cc',
'src/core/lib/compression/message_compress.cc',
'src/core/lib/compression/stream_compression.cc',
'src/core/lib/compression/stream_compression_gzip.cc',
diff --git a/include/grpc++/generic/generic_stub.h b/include/grpc++/generic/generic_stub.h
index d5064318cf..e72826bdc1 100644
--- a/include/grpc++/generic/generic_stub.h
+++ b/include/grpc++/generic/generic_stub.h
@@ -37,15 +37,6 @@ class GenericStub final {
explicit GenericStub(std::shared_ptr<ChannelInterface> channel)
: channel_(channel) {}
- /// Begin a call to a named method \a method using \a context.
- /// A tag \a tag will be delivered to \a cq when the call has been started
- /// (i.e, initial metadata has been sent).
- /// The return value only indicates whether or not registration of the call
- /// succeeded (i.e. the call won't proceed if the return value is nullptr).
- std::unique_ptr<GenericClientAsyncReaderWriter> Call(
- ClientContext* context, const grpc::string& method, CompletionQueue* cq,
- void* tag);
-
/// Setup a call to a named method \a method using \a context, but don't
/// start it. Let it be started explicitly with StartCall and a tag.
/// The return value only indicates whether or not registration of the call
@@ -61,6 +52,16 @@ class GenericStub final {
ClientContext* context, const grpc::string& method,
const ByteBuffer& request, CompletionQueue* cq);
+ /// DEPRECATED for multi-threaded use
+ /// Begin a call to a named method \a method using \a context.
+ /// A tag \a tag will be delivered to \a cq when the call has been started
+ /// (i.e, initial metadata has been sent).
+ /// The return value only indicates whether or not registration of the call
+ /// succeeded (i.e. the call won't proceed if the return value is nullptr).
+ std::unique_ptr<GenericClientAsyncReaderWriter> Call(
+ ClientContext* context, const grpc::string& method, CompletionQueue* cq,
+ void* tag);
+
private:
std::shared_ptr<ChannelInterface> channel_;
};
diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h
index 61d97ce818..38cce27b99 100644
--- a/include/grpc++/impl/codegen/client_context.h
+++ b/include/grpc++/impl/codegen/client_context.h
@@ -289,7 +289,9 @@ class ClientContext {
creds_ = creds;
}
- /// Return the compression algorithm to be used by the client call.
+ /// Return the compression algorithm the client call will request be used.
+ /// Note that the gRPC runtime may decide to ignore this request, for example,
+ /// due to resource constraints.
grpc_compression_algorithm compression_algorithm() const {
return compression_algorithm_;
}
@@ -302,7 +304,10 @@ class ClientContext {
/// Flag whether the initial metadata should be \a corked
///
/// If \a corked is true, then the initial metadata will be coalesced with the
- /// write of first message in the stream.
+ /// write of first message in the stream. As a result, any tag set for the
+ /// initial metadata operation (starting a client-streaming or bidi-streaming
+ /// RPC) will not actually be sent to the completion queue or delivered
+ /// via Next.
///
/// \param corked The flag indicating whether the initial metadata is to be
/// corked or not.
@@ -330,6 +335,10 @@ class ClientContext {
/// already finished, it may still return success.
///
/// There is no guarantee the call will be cancelled.
+ ///
+ /// Note that TryCancel() does not change any of the tags that are pending
+ /// on the completion queue. All pending tags will still be delivered
+ /// (though their ok result may reflect the effect of cancellation).
void TryCancel();
/// Global Callbacks
diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h
index b8a7862578..83477d0489 100644
--- a/include/grpc++/impl/codegen/completion_queue.h
+++ b/include/grpc++/impl/codegen/completion_queue.h
@@ -111,12 +111,83 @@ class CompletionQueue : private GrpcLibraryCodegen {
/// Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.
enum NextStatus {
- SHUTDOWN, ///< The completion queue has been shutdown.
+ SHUTDOWN, ///< The completion queue has been shutdown and fully-drained
GOT_EVENT, ///< Got a new event; \a tag will be filled in with its
///< associated value; \a ok indicating its success.
TIMEOUT ///< deadline was reached.
};
+ /// Read from the queue, blocking until an event is available or the queue is
+ /// shutting down.
+ ///
+ /// \param tag[out] Updated to point to the read event's tag.
+ /// \param ok[out] true if read a successful event, false otherwise.
+ ///
+ /// Note that each tag sent to the completion queue (through RPC operations
+ /// or alarms) will be delivered out of the completion queue by a call to
+ /// Next (or a related method), regardless of whether the operation succeeded
+ /// or not. Success here means that this operation completed in the normal
+ /// valid manner.
+ ///
+ /// Server-side RPC request: \a ok indicates that the RPC has indeed
+ /// been started. If it is false, the server has been Shutdown
+ /// before this particular call got matched to an incoming RPC.
+ ///
+ /// Client-side StartCall/RPC invocation: \a ok indicates that the RPC is
+ /// going to go to the wire. If it is false, it not going to the wire. This
+ /// would happen if the channel is either permanently broken or
+ /// transiently broken but with the fail-fast option. (Note that async unary
+ /// RPCs don't post a CQ tag at this point, nor do client-streaming
+ /// or bidi-streaming RPCs that have the initial metadata corked option set.)
+ ///
+ /// Client-side Write, Client-side WritesDone, Server-side Write,
+ /// Server-side Finish, Server-side SendInitialMetadata (which is
+ /// typically included in Write or Finish when not done explicitly):
+ /// \a ok means that the data/metadata/status/etc is going to go to the
+ /// wire. If it is false, it not going to the wire because the call
+ /// is already dead (i.e., canceled, deadline expired, other side
+ /// dropped the channel, etc).
+ ///
+ /// Client-side Read, Server-side Read, Client-side
+ /// RecvInitialMetadata (which is typically included in Read if not
+ /// done explicitly): \a ok indicates whether there is a valid message
+ /// that got read. If not, you know that there are certainly no more
+ /// messages that can ever be read from this stream. For the client-side
+ /// operations, this only happens because the call is dead. For the
+ /// server-sider operation, though, this could happen because the client
+ /// has done a WritesDone already.
+ ///
+ /// Client-side Finish: \a ok should always be true
+ ///
+ /// Server-side AsyncNotifyWhenDone: \a ok should always be true
+ ///
+ /// Alarm: \a ok is true if it expired, false if it was canceled
+ ///
+ /// \return true if got an event, false if the queue is fully drained and
+ /// shut down.
+ bool Next(void** tag, bool* ok) {
+ return (AsyncNextInternal(tag, ok,
+ g_core_codegen_interface->gpr_inf_future(
+ GPR_CLOCK_REALTIME)) != SHUTDOWN);
+ }
+
+ /// Read from the queue, blocking up to \a deadline (or the queue's shutdown).
+ /// Both \a tag and \a ok are updated upon success (if an event is available
+ /// within the \a deadline). A \a tag points to an arbitrary location usually
+ /// employed to uniquely identify an event.
+ ///
+ /// \param tag[out] Upon sucess, updated to point to the event's tag.
+ /// \param ok[out] Upon sucess, true if a successful event, false otherwise
+ /// See documentation for CompletionQueue::Next for explanation of ok
+ /// \param deadline[in] How long to block in wait for an event.
+ ///
+ /// \return The type of event read.
+ template <typename T>
+ NextStatus AsyncNext(void** tag, bool* ok, const T& deadline) {
+ TimePoint<T> deadline_tp(deadline);
+ return AsyncNextInternal(tag, ok, deadline_tp.raw_time());
+ }
+
/// EXPERIMENTAL
/// First executes \a F, then reads from the queue, blocking up to
/// \a deadline (or the queue's shutdown).
@@ -141,44 +212,16 @@ class CompletionQueue : private GrpcLibraryCodegen {
}
}
- /// Read from the queue, blocking up to \a deadline (or the queue's shutdown).
- /// Both \a tag and \a ok are updated upon success (if an event is available
- /// within the \a deadline). A \a tag points to an arbitrary location usually
- /// employed to uniquely identify an event.
- ///
- /// \param tag[out] Upon sucess, updated to point to the event's tag.
- /// \param ok[out] Upon sucess, true if read a regular event, false otherwise.
- /// \param deadline[in] How long to block in wait for an event.
- ///
- /// \return The type of event read.
- template <typename T>
- NextStatus AsyncNext(void** tag, bool* ok, const T& deadline) {
- TimePoint<T> deadline_tp(deadline);
- return AsyncNextInternal(tag, ok, deadline_tp.raw_time());
- }
-
- /// Read from the queue, blocking until an event is available or the queue is
- /// shutting down.
- ///
- /// \param tag[out] Updated to point to the read event's tag.
- /// \param ok[out] true if read a regular event, false otherwise.
- ///
- /// \return true if read a regular event, false if the queue is shutting down.
- bool Next(void** tag, bool* ok) {
- return (AsyncNextInternal(tag, ok,
- g_core_codegen_interface->gpr_inf_future(
- GPR_CLOCK_REALTIME)) != SHUTDOWN);
- }
-
/// Request the shutdown of the queue.
///
/// \warning This method must be called at some point if this completion queue
- /// is accessed with Next or AsyncNext. Once invoked, \a Next
- /// will start to return false and \a AsyncNext will return \a
- /// NextStatus::SHUTDOWN. Only once either one of these methods does that
- /// (that is, once the queue has been \em drained) can an instance of this
- /// class be destroyed. Also note that applications must ensure that
- /// no work is enqueued on this completion queue after this method is called.
+ /// is accessed with Next or AsyncNext. \a Next will not return false
+ /// until this method has been called and all pending tags have been drained.
+ /// (Likewise for \a AsyncNext returning \a NextStatus::SHUTDOWN .)
+ /// Only once either one of these methods does that (that is, once the queue
+ /// has been \em drained) can an instance of this class be destroyed.
+ /// Also note that applications must ensure that no work is enqueued on this
+ /// completion queue after this method is called.
void Shutdown();
/// Returns a \em raw pointer to the underlying \a grpc_completion_queue
diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h
index b7636034d4..209250bba2 100644
--- a/include/grpc++/impl/codegen/proto_utils.h
+++ b/include/grpc++/impl/codegen/proto_utils.h
@@ -59,18 +59,22 @@ class GrpcBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
bool Next(void** data, int* size) override {
// Protobuf should not ask for more memory than total_size_.
GPR_CODEGEN_ASSERT(byte_count_ < total_size_);
+ size_t remain = total_size_ - byte_count_;
if (have_backup_) {
slice_ = backup_slice_;
have_backup_ = false;
+ if (GRPC_SLICE_LENGTH(slice_) > remain) {
+ GRPC_SLICE_SET_LENGTH(slice_, remain);
+ }
} else {
// When less than a whole block is needed, only allocate that much.
// But make sure the allocated slice is not inlined.
- size_t remain = total_size_ - byte_count_ > block_size_
- ? block_size_
- : total_size_ - byte_count_;
+ size_t allocate_length =
+ remain > static_cast<size_t>(block_size_) ? block_size_ : remain;
slice_ = g_core_codegen_interface->grpc_slice_malloc(
- remain > GRPC_SLICE_INLINED_SIZE ? remain
- : GRPC_SLICE_INLINED_SIZE + 1);
+ allocate_length > GRPC_SLICE_INLINED_SIZE
+ ? allocate_length
+ : GRPC_SLICE_INLINED_SIZE + 1);
}
*data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h
index a2d6967bf8..57347f4fcd 100644
--- a/include/grpc++/impl/codegen/server_context.h
+++ b/include/grpc++/impl/codegen/server_context.h
@@ -151,6 +151,10 @@ class ServerContext {
/// The only exception is that if the serverhandler is already returning an
/// error status code, it is ok to not return Status::CANCELLED even if
/// TryCancel() was called.
+ ///
+ /// Note that TryCancel() does not change any of the tags that are pending
+ /// on the completion queue. All pending tags will still be delivered
+ /// (though their ok result may reflect the effect of cancellation).
void TryCancel() const;
/// Return a collection of initial metadata key-value pairs sent from the
@@ -185,7 +189,10 @@ class ServerContext {
/// \a set_compression_level.
bool compression_level_set() const { return compression_level_set_; }
- /// Return the compression algorithm to be used by the server call.
+ /// Return the compression algorithm the server call will request be used.
+ /// Note that the gRPC runtime may decide to ignore this request, for example,
+ /// due to resource constraints, or if the server is aware the client doesn't
+ /// support the requested algorithm.
grpc_compression_algorithm compression_algorithm() const {
return compression_algorithm_;
}
diff --git a/include/grpc/compression_ruby.h b/include/grpc/compression_ruby.h
deleted file mode 100644
index b063b2b529..0000000000
--- a/include/grpc/compression_ruby.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright 2017 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_COMPRESSION_RUBY_H
-#define GRPC_COMPRESSION_RUBY_H
-
-#include <grpc/impl/codegen/port_platform.h>
-
-#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/slice.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Parses the \a slice as a grpc_compression_algorithm instance and updating \a
- * algorithm following algorithm names compatible with Ruby. Returns 1 upon
- * success, 0 otherwise. */
-GRPCAPI int grpc_compression_algorithm_parse_ruby(
- grpc_slice value, grpc_compression_algorithm* algorithm);
-
-/** Updates \a name with the encoding name corresponding to a valid \a
- * algorithm. The \a name follows names compatible with Ruby. Note that \a name
- * is statically allocated and must *not* be freed. Returns 1 upon success, 0
- * otherwise. */
-GRPCAPI int grpc_compression_algorithm_name_ruby(
- grpc_compression_algorithm algorithm, const char** name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_COMPRESSION_RUBY_H */
diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h
index ddc667fcdb..be9dd2d8e7 100644
--- a/include/grpc/impl/codegen/compression_types.h
+++ b/include/grpc/impl/codegen/compression_types.h
@@ -55,8 +55,8 @@ extern "C" {
/** The various compression algorithms supported by gRPC */
typedef enum {
GRPC_COMPRESS_NONE = 0,
- GRPC_COMPRESS_MESSAGE_DEFLATE,
- GRPC_COMPRESS_MESSAGE_GZIP,
+ GRPC_COMPRESS_DEFLATE,
+ GRPC_COMPRESS_GZIP,
GRPC_COMPRESS_STREAM_GZIP,
/* TODO(ctiller): snappy */
GRPC_COMPRESS_ALGORITHMS_COUNT
diff --git a/include/grpc/module.modulemap b/include/grpc/module.modulemap
index 6c3fff030e..ea8d85827c 100644
--- a/include/grpc/module.modulemap
+++ b/include/grpc/module.modulemap
@@ -6,7 +6,6 @@ framework module grpc {
header "support/atm.h"
header "support/cmdline.h"
header "support/cpu.h"
- header "support/host_port.h"
header "support/log.h"
header "support/log_windows.h"
header "support/port_platform.h"
@@ -43,7 +42,6 @@ framework module grpc {
header "byte_buffer.h"
header "byte_buffer_reader.h"
header "compression.h"
- header "compression_ruby.h"
header "fork.h"
header "grpc.h"
header "grpc_posix.h"
diff --git a/package.xml b/package.xml
index 9c298431cb..6d32cf0a1c 100644
--- a/package.xml
+++ b/package.xml
@@ -58,7 +58,6 @@
<file baseinstalldir="/" name="include/grpc/support/atm_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/cmdline.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/cpu.h" role="src" />
- <file baseinstalldir="/" name="include/grpc/support/host_port.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/log.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/log_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/port_platform.h" role="src" />
@@ -91,6 +90,7 @@
<file baseinstalldir="/" name="src/core/lib/gpr/arena.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/env.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/fork.h" role="src" />
+ <file baseinstalldir="/" name="src/core/lib/gpr/host_port.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/mpscq.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/murmur_hash.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/spinlock.h" role="src" />
@@ -175,7 +175,6 @@
<file baseinstalldir="/" name="include/grpc/byte_buffer.h" role="src" />
<file baseinstalldir="/" name="include/grpc/byte_buffer_reader.h" role="src" />
<file baseinstalldir="/" name="include/grpc/compression.h" role="src" />
- <file baseinstalldir="/" name="include/grpc/compression_ruby.h" role="src" />
<file baseinstalldir="/" name="include/grpc/fork.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc_posix.h" role="src" />
@@ -418,7 +417,6 @@
<file baseinstalldir="/" name="src/core/lib/channel/handshaker_registry.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/compression.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/compression_internal.cc" role="src" />
- <file baseinstalldir="/" name="src/core/lib/compression/compression_ruby.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/message_compress.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/stream_compression.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/stream_compression_gzip.cc" role="src" />
diff --git a/requirements.txt b/requirements.txt
index c976cef4cb..53768c6822 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
# GRPC Python setup requirements
coverage>=4.0
-cython>=0.23
+cython>=0.27
enum34>=1.0.4
futures>=2.2.0
protobuf>=3.5.0.post1
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index f35bfd9ab9..3a15a601cb 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -64,16 +64,15 @@ T* array_end(T (&array)[N]) {
void PrintIncludes(grpc_generator::Printer* printer,
const std::vector<grpc::string>& headers,
- const Parameters& params) {
+ bool use_system_headers, const grpc::string& search_path) {
std::map<grpc::string, grpc::string> vars;
- vars["l"] = params.use_system_headers ? '<' : '"';
- vars["r"] = params.use_system_headers ? '>' : '"';
+ vars["l"] = use_system_headers ? '<' : '"';
+ vars["r"] = use_system_headers ? '>' : '"';
- auto& s = params.grpc_search_path;
- if (!s.empty()) {
- vars["l"] += s;
- if (s[s.size() - 1] != '/') {
+ if (!search_path.empty()) {
+ vars["l"] += search_path;
+ if (search_path[search_path.size() - 1] != '/') {
vars["l"] += '/';
}
}
@@ -124,6 +123,10 @@ grpc::string GetHeaderIncludes(grpc_generator::File* file,
auto printer = file->CreatePrinter(&output);
std::map<grpc::string, grpc::string> vars;
+ if (!params.additional_header_includes.empty()) {
+ PrintIncludes(printer.get(), params.additional_header_includes, false,
+ "");
+ }
static const char* headers_strs[] = {
"grpc++/impl/codegen/async_stream.h",
"grpc++/impl/codegen/async_unary_call.h",
@@ -135,7 +138,8 @@ grpc::string GetHeaderIncludes(grpc_generator::File* file,
"grpc++/impl/codegen/stub_options.h",
"grpc++/impl/codegen/sync_stream.h"};
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
- PrintIncludes(printer.get(), headers, params);
+ PrintIncludes(printer.get(), headers, params.use_system_headers,
+ params.grpc_search_path);
printer->Print(vars, "\n");
printer->Print(vars, "namespace grpc {\n");
printer->Print(vars, "class CompletionQueue;\n");
@@ -1153,7 +1157,8 @@ grpc::string GetSourceIncludes(grpc_generator::File* file,
"grpc++/impl/codegen/service_type.h",
"grpc++/impl/codegen/sync_stream.h"};
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
- PrintIncludes(printer.get(), headers, params);
+ PrintIncludes(printer.get(), headers, params.use_system_headers,
+ params.grpc_search_path);
if (!file->package().empty()) {
std::vector<grpc::string> parts = file->package_parts();
@@ -1570,20 +1575,19 @@ grpc::string GetMockIncludes(grpc_generator::File* file,
"grpc++/impl/codegen/sync_stream.h",
};
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
- PrintIncludes(printer.get(), headers, params);
+ PrintIncludes(printer.get(), headers, params.use_system_headers,
+ params.grpc_search_path);
std::vector<grpc::string> gmock_header;
if (params.gmock_search_path.empty()) {
gmock_header.push_back("gmock/gmock.h");
- PrintIncludes(printer.get(), gmock_header, params);
+ PrintIncludes(printer.get(), gmock_header, params.use_system_headers,
+ params.grpc_search_path);
} else {
gmock_header.push_back("gmock.h");
- // Copy a params to generate gmock header.
- Parameters gmock_params(params);
// We use local includes when a gmock_search_path is given
- gmock_params.use_system_headers = false;
- gmock_params.grpc_search_path = params.gmock_search_path;
- PrintIncludes(printer.get(), gmock_header, gmock_params);
+ PrintIncludes(printer.get(), gmock_header, false,
+ params.gmock_search_path);
}
if (!file->package().empty()) {
diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h
index 300a27c589..d88ef75c98 100644
--- a/src/compiler/cpp_generator.h
+++ b/src/compiler/cpp_generator.h
@@ -54,6 +54,8 @@ struct Parameters {
bool generate_mock_code;
// Google Mock search path, when non-empty, local includes will be used.
grpc::string gmock_search_path;
+ // *EXPERIMENTAL* Additional include files in grpc.pb.h
+ std::vector<grpc::string> additional_header_includes;
};
// Return the prologue of the generated header file.
diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc
index 661282f880..c8ab78863b 100644
--- a/src/compiler/cpp_plugin.cc
+++ b/src/compiler/cpp_plugin.cc
@@ -80,6 +80,9 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
}
} else if (param[0] == "gmock_search_path") {
generator_parameters.gmock_search_path = param[1];
+ } else if (param[0] == "additional_header_includes") {
+ generator_parameters.additional_header_includes =
+ grpc_generator::tokenize(param[1], ":");
} else {
*error = grpc::string("Unknown parameter: ") + *parameter_string;
return false;
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index bca4ecbc25..e16f9e4c8f 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -1094,6 +1094,7 @@ static void pick_callback_done_locked(void* arg, grpc_error* error) {
chand, calld);
}
async_pick_done_locked(elem, GRPC_ERROR_REF(error));
+ GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback");
}
// Takes a ref to chand->lb_policy and calls grpc_lb_policy_pick_locked().
@@ -1133,6 +1134,7 @@ static bool pick_callback_start_locked(grpc_call_element* elem) {
GRPC_CLOSURE_INIT(&calld->lb_pick_closure, pick_callback_done_locked, elem,
grpc_combiner_scheduler(chand->combiner));
calld->pick.on_complete = &calld->lb_pick_closure;
+ GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback");
const bool pick_done =
grpc_lb_policy_pick_locked(chand->lb_policy, &calld->pick);
if (pick_done) {
@@ -1141,6 +1143,7 @@ static bool pick_callback_start_locked(grpc_call_element* elem) {
gpr_log(GPR_DEBUG, "chand=%p calld=%p: pick completed synchronously",
chand, calld);
}
+ GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback");
} else {
GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback_cancel");
grpc_call_combiner_set_notify_on_cancel(
diff --git a/src/core/ext/filters/client_channel/http_proxy.cc b/src/core/ext/filters/client_channel/http_proxy.cc
index 7c5f79fb30..d42376413d 100644
--- a/src/core/ext/filters/client_channel/http_proxy.cc
+++ b/src/core/ext/filters/client_channel/http_proxy.cc
@@ -22,7 +22,6 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@@ -31,6 +30,7 @@
#include "src/core/ext/filters/client_channel/uri_parser.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/slice/b64.h"
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
index 1709e5622e..5e24bdd4e7 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
@@ -87,7 +87,6 @@
#include <grpc/byte_buffer_reader.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
@@ -106,6 +105,7 @@
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/combiner.h"
diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
index 24c381a46d..ab6d3e6a03 100644
--- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
@@ -328,18 +328,11 @@ static void update_lb_connectivity_status_locked(grpc_lb_subchannel_data* sd,
* 2) RULE: ANY subchannel is CONNECTING => policy is CONNECTING.
* CHECK: sd->curr_connectivity_state == CONNECTING.
*
- * 3) RULE: ALL subchannels are SHUTDOWN => policy is IDLE (and requests
- * re-resolution).
- * CHECK: subchannel_list->num_shutdown ==
- * subchannel_list->num_subchannels.
- *
- * 4) RULE: ALL subchannels are SHUTDOWN or TRANSIENT_FAILURE => policy is
- * TRANSIENT_FAILURE.
- * CHECK: subchannel_list->num_shutdown +
- * subchannel_list->num_transient_failures ==
+ * 3) RULE: ALL subchannels are TRANSIENT_FAILURE => policy is
+ * TRANSIENT_FAILURE.
+ * CHECK: subchannel_list->num_transient_failures ==
* subchannel_list->num_subchannels.
*/
- // TODO(juanlishen): For rule 4, we may want to re-resolve instead.
grpc_lb_subchannel_list* subchannel_list = sd->subchannel_list;
round_robin_lb_policy* p = (round_robin_lb_policy*)subchannel_list->policy;
GPR_ASSERT(sd->curr_connectivity_state != GRPC_CHANNEL_IDLE);
@@ -351,22 +344,12 @@ static void update_lb_connectivity_status_locked(grpc_lb_subchannel_data* sd,
/* 2) CONNECTING */
grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_CONNECTING,
GRPC_ERROR_NONE, "rr_connecting");
- } else if (subchannel_list->num_shutdown ==
+ } else if (subchannel_list->num_transient_failures ==
subchannel_list->num_subchannels) {
- /* 3) IDLE and re-resolve */
- grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_IDLE,
- GRPC_ERROR_NONE,
- "rr_exhausted_subchannels+reresolve");
- p->started_picking = false;
- grpc_lb_policy_try_reresolve(&p->base, &grpc_lb_round_robin_trace,
- GRPC_ERROR_NONE);
- } else if (subchannel_list->num_shutdown +
- subchannel_list->num_transient_failures ==
- subchannel_list->num_subchannels) {
- /* 4) TRANSIENT_FAILURE */
- grpc_connectivity_state_set(&p->state_tracker,
- GRPC_CHANNEL_TRANSIENT_FAILURE,
- GRPC_ERROR_REF(error), "rr_transient_failure");
+ /* 3) TRANSIENT_FAILURE */
+ grpc_connectivity_state_set(
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ GRPC_ERROR_REF(error), "rr_exhausted_subchannels");
}
GRPC_ERROR_UNREF(error);
}
@@ -387,6 +370,7 @@ static void rr_connectivity_changed_locked(void* arg, grpc_error* error) {
p->shutdown, sd->subchannel_list->shutting_down,
grpc_error_string(error));
}
+ GPR_ASSERT(sd->subchannel != nullptr);
// If the policy is shutting down, unref and return.
if (p->shutdown) {
grpc_lb_subchannel_data_stop_connectivity_watch(sd);
@@ -412,14 +396,19 @@ static void rr_connectivity_changed_locked(void* arg, grpc_error* error) {
// state (which was set by the connectivity state watcher) to
// curr_connectivity_state, which is what we use inside of the combiner.
sd->curr_connectivity_state = sd->pending_connectivity_state_unsafe;
- // Update state counters and new overall state.
- update_state_counters_locked(sd);
- update_lb_connectivity_status_locked(sd, GRPC_ERROR_REF(error));
// If the sd's new state is TRANSIENT_FAILURE, unref the *connected*
// subchannel, if any.
switch (sd->curr_connectivity_state) {
case GRPC_CHANNEL_TRANSIENT_FAILURE: {
sd->connected_subchannel.reset();
+ if (grpc_lb_round_robin_trace.enabled()) {
+ gpr_log(GPR_DEBUG,
+ "[RR %p] Subchannel %p has gone into TRANSIENT_FAILURE. "
+ "Requesting re-resolution",
+ p, sd->subchannel);
+ }
+ grpc_lb_policy_try_reresolve(&p->base, &grpc_lb_round_robin_trace,
+ GRPC_ERROR_NONE);
break;
}
case GRPC_CHANNEL_READY: {
@@ -442,8 +431,8 @@ static void rr_connectivity_changed_locked(void* arg, grpc_error* error) {
gpr_log(GPR_DEBUG,
"[RR %p] phasing out subchannel list %p (size %lu) in favor "
"of %p (size %lu)",
- (void*)p, (void*)p->subchannel_list, num_subchannels,
- (void*)sd->subchannel_list, num_subchannels);
+ p, p->subchannel_list, num_subchannels, sd->subchannel_list,
+ num_subchannels);
}
if (p->subchannel_list != nullptr) {
// dispose of the current subchannel_list
@@ -455,7 +444,8 @@ static void rr_connectivity_changed_locked(void* arg, grpc_error* error) {
}
/* at this point we know there's at least one suitable subchannel. Go
* ahead and pick one and notify the pending suitors in
- * p->pending_picks. This preemptively replicates rr_pick()'s actions. */
+ * p->pending_picks. This preemptively replicates rr_pick()'s actions.
+ */
const size_t next_ready_index = get_next_ready_subchannel_index_locked(p);
GPR_ASSERT(next_ready_index < p->subchannel_list->num_subchannels);
grpc_lb_subchannel_data* selected =
@@ -488,6 +478,12 @@ static void rr_connectivity_changed_locked(void* arg, grpc_error* error) {
case GRPC_CHANNEL_CONNECTING:
case GRPC_CHANNEL_IDLE:; // fallthrough
}
+ // Update state counters and new overall state.
+ update_state_counters_locked(sd);
+ // Only update connectivity based on the selected subchannel list.
+ if (sd->subchannel_list == p->subchannel_list) {
+ update_lb_connectivity_status_locked(sd, GRPC_ERROR_REF(error));
+ }
// Renew notification.
grpc_lb_subchannel_data_start_connectivity_watch(sd);
}
@@ -562,6 +558,30 @@ static void rr_update_locked(grpc_lb_policy* policy,
return;
}
if (p->started_picking) {
+ for (size_t i = 0; i < subchannel_list->num_subchannels; ++i) {
+ const grpc_connectivity_state subchannel_state =
+ grpc_subchannel_check_connectivity(
+ subchannel_list->subchannels[i].subchannel, nullptr);
+ // Override the default setting of IDLE for connectivity notification
+ // purposes if the subchannel is already in transient failure. Otherwise
+ // we'd be immediately notified of the IDLE-TRANSIENT_FAILURE
+ // discrepancy, attempt to re-resolve and end up here again.
+ // TODO(roth): As part of C++-ifying the subchannel_list API, design a
+ // better API for notifying the LB policy of subchannel states, which can
+ // be used both for the subchannel's initial state and for subsequent
+ // state changes. This will allow us to handle this more generally instead
+ // of special-casing TRANSIENT_FAILURE (e.g., we can also distribute any
+ // pending picks across all READY subchannels rather than sending them all
+ // to the first one).
+ if (subchannel_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
+ subchannel_list->subchannels[i].pending_connectivity_state_unsafe =
+ subchannel_list->subchannels[i].curr_connectivity_state =
+ subchannel_list->subchannels[i].prev_connectivity_state =
+ subchannel_state;
+ --subchannel_list->num_idle;
+ ++subchannel_list->num_transient_failures;
+ }
+ }
if (p->latest_pending_subchannel_list != nullptr) {
if (grpc_lb_round_robin_trace.enabled()) {
gpr_log(GPR_DEBUG,
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
index fa2ffcc796..75f7ca2d12 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
@@ -54,13 +54,15 @@ void grpc_lb_subchannel_data_unref_subchannel(grpc_lb_subchannel_data* sd,
void grpc_lb_subchannel_data_start_connectivity_watch(
grpc_lb_subchannel_data* sd) {
if (sd->subchannel_list->tracer->enabled()) {
- gpr_log(GPR_DEBUG,
- "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
- " (subchannel %p): requesting connectivity change notification",
- sd->subchannel_list->tracer->name(), sd->subchannel_list->policy,
- sd->subchannel_list,
- (size_t)(sd - sd->subchannel_list->subchannels),
- sd->subchannel_list->num_subchannels, sd->subchannel);
+ gpr_log(
+ GPR_DEBUG,
+ "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
+ " (subchannel %p): requesting connectivity change "
+ "notification (from %s)",
+ sd->subchannel_list->tracer->name(), sd->subchannel_list->policy,
+ sd->subchannel_list, (size_t)(sd - sd->subchannel_list->subchannels),
+ sd->subchannel_list->num_subchannels, sd->subchannel,
+ grpc_connectivity_state_name(sd->pending_connectivity_state_unsafe));
}
sd->connectivity_notification_pending = true;
grpc_subchannel_notify_on_state_change(
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
index 3377605263..91537f3afe 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
@@ -101,8 +101,6 @@ struct grpc_lb_subchannel_list {
size_t num_ready;
/** how many subchannels are in state TRANSIENT_FAILURE */
size_t num_transient_failures;
- /** how many subchannels are in state SHUTDOWN */
- size_t num_shutdown;
/** how many subchannels are in state IDLE */
size_t num_idle;
diff --git a/src/core/ext/filters/client_channel/parse_address.cc b/src/core/ext/filters/client_channel/parse_address.cc
index c3309e36a3..4b6905eaa3 100644
--- a/src/core/ext/filters/client_channel/parse_address.cc
+++ b/src/core/ext/filters/client_channel/parse_address.cc
@@ -26,9 +26,10 @@
#endif
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#ifdef GRPC_HAVE_UNIX_SOCKET
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
index e5b2815af8..f2f25bc7c0 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
@@ -25,7 +25,6 @@
#include <unistd.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
@@ -35,6 +34,7 @@
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/combiner.h"
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
index 09dbe22a86..3ec1b6f9fe 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
@@ -28,13 +28,13 @@
#include <ares.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/executor.h"
diff --git a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
index 2c798188d1..478810d263 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
@@ -23,7 +23,6 @@
#include <cstring>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
@@ -32,6 +31,7 @@
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/combiner.h"
diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
index eaa5e6ac49..f457917775 100644
--- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
@@ -24,7 +24,6 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
@@ -32,6 +31,7 @@
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/combiner.h"
@@ -47,10 +47,10 @@
//
typedef struct {
- // base class -- must be first
+ // Base class -- must be first
grpc_resolver base;
- // passed-in parameters
+ // Passed-in parameters
grpc_channel_args* channel_args;
// If not NULL, the next set of resolution results to be returned to
@@ -61,9 +61,16 @@ typedef struct {
// fake_resolver_channel_saw_error_locked().
grpc_channel_args* results_upon_error;
- // pending next completion, or NULL
+ // TODO(juanlishen): This can go away once pick_first is changed to not throw
+ // away its subchannels, since that will eliminate its dependence on
+ // channel_saw_error_locked() causing an immediate resolver return.
+ // A copy of the most-recently used resolution results.
+ grpc_channel_args* last_used_results;
+
+ // Pending next completion, or NULL
grpc_closure* next_completion;
- // target result address for next completion
+
+ // Target result address for next completion
grpc_channel_args** target_result;
} fake_resolver;
@@ -71,6 +78,7 @@ static void fake_resolver_destroy(grpc_resolver* gr) {
fake_resolver* r = (fake_resolver*)gr;
grpc_channel_args_destroy(r->next_results);
grpc_channel_args_destroy(r->results_upon_error);
+ grpc_channel_args_destroy(r->last_used_results);
grpc_channel_args_destroy(r->channel_args);
gpr_free(r);
}
@@ -98,9 +106,15 @@ static void fake_resolver_maybe_finish_next_locked(fake_resolver* r) {
static void fake_resolver_channel_saw_error_locked(grpc_resolver* resolver) {
fake_resolver* r = (fake_resolver*)resolver;
- if (r->next_results == nullptr && r->results_upon_error != nullptr) {
- // Pretend we re-resolved.
+ // A resolution must have been returned before an error is seen.
+ GPR_ASSERT(r->last_used_results != nullptr);
+ grpc_channel_args_destroy(r->next_results);
+ if (r->results_upon_error != nullptr) {
r->next_results = grpc_channel_args_copy(r->results_upon_error);
+ } else {
+ // If results_upon_error is unavailable, re-resolve with the most-recently
+ // used results to avoid a no-op re-resolution.
+ r->next_results = grpc_channel_args_copy(r->last_used_results);
}
fake_resolver_maybe_finish_next_locked(r);
}
@@ -149,35 +163,56 @@ void grpc_fake_resolver_response_generator_unref(
typedef struct set_response_closure_arg {
grpc_closure set_response_closure;
grpc_fake_resolver_response_generator* generator;
- grpc_channel_args* next_response;
+ grpc_channel_args* response;
+ bool upon_error;
} set_response_closure_arg;
-static void set_response_closure_fn(void* arg, grpc_error* error) {
+static void set_response_closure_locked(void* arg, grpc_error* error) {
set_response_closure_arg* closure_arg = (set_response_closure_arg*)arg;
grpc_fake_resolver_response_generator* generator = closure_arg->generator;
fake_resolver* r = generator->resolver;
- if (r->next_results != nullptr) {
+ if (!closure_arg->upon_error) {
grpc_channel_args_destroy(r->next_results);
- }
- r->next_results = closure_arg->next_response;
- if (r->results_upon_error != nullptr) {
+ r->next_results = closure_arg->response;
+ grpc_channel_args_destroy(r->last_used_results);
+ r->last_used_results = grpc_channel_args_copy(closure_arg->response);
+ fake_resolver_maybe_finish_next_locked(r);
+ } else {
grpc_channel_args_destroy(r->results_upon_error);
+ r->results_upon_error = closure_arg->response;
}
- r->results_upon_error = grpc_channel_args_copy(closure_arg->next_response);
gpr_free(closure_arg);
- fake_resolver_maybe_finish_next_locked(r);
}
void grpc_fake_resolver_response_generator_set_response(
grpc_fake_resolver_response_generator* generator,
- grpc_channel_args* next_response) {
+ grpc_channel_args* response) {
+ GPR_ASSERT(generator->resolver != nullptr);
+ GPR_ASSERT(response != nullptr);
+ set_response_closure_arg* closure_arg =
+ (set_response_closure_arg*)gpr_zalloc(sizeof(*closure_arg));
+ closure_arg->generator = generator;
+ closure_arg->response = grpc_channel_args_copy(response);
+ closure_arg->upon_error = false;
+ GRPC_CLOSURE_SCHED(GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
+ set_response_closure_locked, closure_arg,
+ grpc_combiner_scheduler(
+ generator->resolver->base.combiner)),
+ GRPC_ERROR_NONE);
+}
+
+void grpc_fake_resolver_response_generator_set_response_upon_error(
+ grpc_fake_resolver_response_generator* generator,
+ grpc_channel_args* response) {
GPR_ASSERT(generator->resolver != nullptr);
set_response_closure_arg* closure_arg =
(set_response_closure_arg*)gpr_zalloc(sizeof(*closure_arg));
closure_arg->generator = generator;
- closure_arg->next_response = grpc_channel_args_copy(next_response);
+ closure_arg->response =
+ response != nullptr ? grpc_channel_args_copy(response) : nullptr;
+ closure_arg->upon_error = true;
GRPC_CLOSURE_SCHED(GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
- set_response_closure_fn, closure_arg,
+ set_response_closure_locked, closure_arg,
grpc_combiner_scheduler(
generator->resolver->base.combiner)),
GRPC_ERROR_NONE);
diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
index a8977e5980..94f9a8e6ca 100644
--- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
+++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
@@ -36,11 +36,20 @@ typedef struct grpc_fake_resolver_response_generator
grpc_fake_resolver_response_generator*
grpc_fake_resolver_response_generator_create();
-// Instruct the fake resolver associated with the \a response_generator instance
-// to trigger a new resolution for \a uri and \a args.
+// Set next response of the fake resolver associated with the \a
+// response_generator instance and trigger a new resolution.
void grpc_fake_resolver_response_generator_set_response(
grpc_fake_resolver_response_generator* generator,
- grpc_channel_args* next_response);
+ grpc_channel_args* response);
+
+// Set results_upon_error of the fake resolver associated with the \a
+// response_generator instance. When fake_resolver_channel_saw_error_locked() is
+// called, results_upon_error will be returned as long as it's non-NULL,
+// otherwise the last value set by
+// grpc_fake_resolver_response_generator_set_response() will be returned.
+void grpc_fake_resolver_response_generator_set_response_upon_error(
+ grpc_fake_resolver_response_generator* generator,
+ grpc_channel_args* response);
// Return a \a grpc_arg for a \a grpc_fake_resolver_response_generator instance.
grpc_arg grpc_fake_resolver_response_generator_arg(
diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
index 99ad78e23c..784935eb20 100644
--- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
@@ -22,7 +22,6 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
@@ -30,6 +29,7 @@
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/resolve_address.h"
diff --git a/src/core/ext/filters/client_channel/retry_throttle.cc b/src/core/ext/filters/client_channel/retry_throttle.cc
index f632a02cde..0d38feb242 100644
--- a/src/core/ext/filters/client_channel/retry_throttle.cc
+++ b/src/core/ext/filters/client_channel/retry_throttle.cc
@@ -179,7 +179,7 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
gpr_mu_lock(&g_mu);
grpc_server_retry_throttle_data* throttle_data =
(grpc_server_retry_throttle_data*)grpc_avl_get(g_avl, (char*)server_name,
- nullptr);
+ nullptr);
if (throttle_data == nullptr) {
// Entry not found. Create a new one.
throttle_data = grpc_server_retry_throttle_data_create(
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc
index 3d4771e9bf..6d4c4f931e 100644
--- a/src/core/ext/filters/client_channel/subchannel.cc
+++ b/src/core/ext/filters/client_channel/subchannel.cc
@@ -737,8 +737,9 @@ grpc_arg grpc_create_subchannel_address_arg(const grpc_resolved_address* addr) {
}
namespace grpc_core {
+
ConnectedSubchannel::ConnectedSubchannel(grpc_channel_stack* channel_stack)
- : grpc_core::RefCountedWithTracing(&grpc_trace_stream_refcount),
+ : RefCountedWithTracing<ConnectedSubchannel>(&grpc_trace_stream_refcount),
channel_stack_(channel_stack) {}
ConnectedSubchannel::~ConnectedSubchannel() {
@@ -773,7 +774,9 @@ grpc_error* ConnectedSubchannel::CreateCall(const CallArgs& args,
args.arena,
sizeof(grpc_subchannel_call) + channel_stack_->call_stack_size);
grpc_call_stack* callstk = SUBCHANNEL_CALL_TO_CALL_STACK(*call);
- Ref(DEBUG_LOCATION, "subchannel_call");
+ RefCountedPtr<ConnectedSubchannel> connection =
+ Ref(DEBUG_LOCATION, "subchannel_call");
+ connection.release(); // Ref is passed to the grpc_subchannel_call object.
(*call)->connection = this;
const grpc_call_element_args call_args = {
callstk, /* call_stack */
@@ -795,4 +798,5 @@ grpc_error* ConnectedSubchannel::CreateCall(const CallArgs& args,
grpc_call_stack_set_pollset_or_pollset_set(callstk, args.pollent);
return GRPC_ERROR_NONE;
}
+
} // namespace grpc_core
diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h
index b7593ec911..d2b45ae9c8 100644
--- a/src/core/ext/filters/client_channel/subchannel.h
+++ b/src/core/ext/filters/client_channel/subchannel.h
@@ -68,7 +68,8 @@ typedef struct grpc_subchannel_key grpc_subchannel_key;
#endif
namespace grpc_core {
-class ConnectedSubchannel : public grpc_core::RefCountedWithTracing {
+
+class ConnectedSubchannel : public RefCountedWithTracing<ConnectedSubchannel> {
public:
struct CallArgs {
grpc_polling_entity* pollent;
@@ -93,6 +94,7 @@ class ConnectedSubchannel : public grpc_core::RefCountedWithTracing {
private:
grpc_channel_stack* channel_stack_;
};
+
} // namespace grpc_core
grpc_subchannel* grpc_subchannel_ref(
diff --git a/src/core/ext/filters/client_channel/subchannel_index.cc b/src/core/ext/filters/client_channel/subchannel_index.cc
index 8687291bbe..42647ea325 100644
--- a/src/core/ext/filters/client_channel/subchannel_index.cc
+++ b/src/core/ext/filters/client_channel/subchannel_index.cc
@@ -25,8 +25,8 @@
#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>
-#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/avl/avl.h"
+#include "src/core/lib/channel/channel_args.h"
// a map of subchannel_key --> subchannel, used for detecting connections
// to the same destination in order to share them
@@ -165,7 +165,8 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
// Compare and swap loop:
// - take a reference to the current index
gpr_mu_lock(&g_mu);
- grpc_avl index = grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
+ grpc_avl index =
+ grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
gpr_mu_unlock(&g_mu);
// - Check to see if a subchannel already exists
@@ -180,9 +181,9 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
// no -> update the avl and compare/swap
grpc_avl updated =
grpc_avl_add(grpc_avl_ref(index, grpc_core::ExecCtx::Get()),
- subchannel_key_copy(key),
- GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"),
- grpc_core::ExecCtx::Get());
+ subchannel_key_copy(key),
+ GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"),
+ grpc_core::ExecCtx::Get());
// it may happen (but it's expected to be unlikely)
// that some other thread has changed the index:
@@ -213,7 +214,8 @@ void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
// Compare and swap loop:
// - take a reference to the current index
gpr_mu_lock(&g_mu);
- grpc_avl index = grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
+ grpc_avl index =
+ grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
gpr_mu_unlock(&g_mu);
// Check to see if this key still refers to the previously
@@ -229,7 +231,7 @@ void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
// mutated the index behind us)
grpc_avl updated =
grpc_avl_remove(grpc_avl_ref(index, grpc_core::ExecCtx::Get()), key,
- grpc_core::ExecCtx::Get());
+ grpc_core::ExecCtx::Get());
gpr_mu_lock(&g_mu);
if (index.root == g_subchannel_index.root) {
diff --git a/src/core/ext/filters/max_age/max_age_filter.cc b/src/core/ext/filters/max_age/max_age_filter.cc
index 7b86e4cd6c..a3f9780f3f 100644
--- a/src/core/ext/filters/max_age/max_age_filter.cc
+++ b/src/core/ext/filters/max_age/max_age_filter.cc
@@ -37,6 +37,12 @@
#define MAX_CONNECTION_IDLE_INTEGER_OPTIONS \
{ DEFAULT_MAX_CONNECTION_IDLE_MS, 1, INT_MAX }
+/* States for idle_state in channel_data */
+#define MAX_IDLE_STATE_INIT ((gpr_atm)0)
+#define MAX_IDLE_STATE_SEEN_EXIT_IDLE ((gpr_atm)1)
+#define MAX_IDLE_STATE_SEEN_ENTER_IDLE ((gpr_atm)2)
+#define MAX_IDLE_STATE_TIMER_SET ((gpr_atm)3)
+
namespace {
struct channel_data {
/* We take a reference to the channel stack for the timer callback */
@@ -64,7 +70,7 @@ struct channel_data {
grpc_millis max_connection_age_grace;
/* Closure to run when the channel's idle duration reaches max_connection_idle
and should be closed gracefully */
- grpc_closure close_max_idle_channel;
+ grpc_closure max_idle_timer_cb;
/* Closure to run when the channel reaches its max age and should be closed
gracefully */
grpc_closure close_max_age_channel;
@@ -85,26 +91,117 @@ struct channel_data {
grpc_connectivity_state connectivity_state;
/* Number of active calls */
gpr_atm call_count;
+ /* TODO(zyc): C++lize this state machine */
+ /* 'idle_state' holds the states of max_idle_timer and channel idleness.
+ It can contain one of the following values:
+ +--------------------------------+----------------+---------+
+ | idle_state | max_idle_timer | channel |
+ +--------------------------------+----------------+---------+
+ | MAX_IDLE_STATE_INIT | unset | busy |
+ | MAX_IDLE_STATE_TIMER_SET | set, valid | idle |
+ | MAX_IDLE_STATE_SEEN_EXIT_IDLE | set, invalid | busy |
+ | MAX_IDLE_STATE_SEEN_ENTER_IDLE | set, invalid | idle |
+ +--------------------------------+----------------+---------+
+
+ MAX_IDLE_STATE_INIT: The initial and final state of 'idle_state'. The
+ channel has 1 or 1+ active calls, and the the timer is not set. Note that
+ we may put a virtual call to hold this state at channel initialization or
+ shutdown, so that the channel won't enter other states.
+
+ MAX_IDLE_STATE_TIMER_SET: The state after the timer is set and no calls
+ have arrived after the timer is set. The channel must have 0 active call in
+ this state. If the timer is fired in this state, we will close the channel
+ due to idleness.
+
+ MAX_IDLE_STATE_SEEN_EXIT_IDLE: The state after the timer is set and at
+ least one call has arrived after the timer is set. The channel must have 1
+ or 1+ active calls in this state. If the timer is fired in this state, we
+ won't reschudle it.
+
+ MAX_IDLE_STATE_SEEN_ENTER_IDLE: The state after the timer is set and the at
+ least one call has arrived after the timer is set, BUT the channel
+ currently has 1 or 1+ active calls. If the timer is fired in this state, we
+ will reschudle it.
+
+ max_idle_timer will not be cancelled (unless the channel is shutting down).
+ If the timer callback is called when the max_idle_timer is valid (i.e.
+ idle_state is MAX_IDLE_STATE_TIMER_SET), the channel will be closed due to
+ idleness, otherwise the channel won't be changed.
+
+ State transitions:
+ MAX_IDLE_STATE_INIT <-------3------ MAX_IDLE_STATE_SEEN_EXIT_IDLE
+ ^ | ^ ^ |
+ | | | | |
+ 1 2 +-----------4------------+ 6 7
+ | | | | |
+ | v | | v
+ MAX_IDLE_STATE_TIMER_SET <----5------ MAX_IDLE_STATE_SEEN_ENTER_IDLE
+
+ For 1, 3, 5 : See max_idle_timer_cb() function
+ For 2, 7 : See decrease_call_count() function
+ For 4, 6 : See increase_call_count() function */
+ gpr_atm idle_state;
+ /* Time when the channel finished its last outstanding call, in grpc_millis */
+ gpr_atm last_enter_idle_time_millis;
};
} // namespace
/* Increase the nubmer of active calls. Before the increasement, if there are no
calls, the max_idle_timer should be cancelled. */
static void increase_call_count(channel_data* chand) {
+ /* Exit idle */
if (gpr_atm_full_fetch_add(&chand->call_count, 1) == 0) {
- grpc_timer_cancel(&chand->max_idle_timer);
+ while (true) {
+ gpr_atm idle_state = gpr_atm_acq_load(&chand->idle_state);
+ switch (idle_state) {
+ case MAX_IDLE_STATE_TIMER_SET:
+ /* max_idle_timer_cb may have already set idle_state to
+ MAX_IDLE_STATE_INIT, in this case, we don't need to set it to
+ MAX_IDLE_STATE_SEEN_EXIT_IDLE */
+ gpr_atm_rel_cas(&chand->idle_state, MAX_IDLE_STATE_TIMER_SET,
+ MAX_IDLE_STATE_SEEN_EXIT_IDLE);
+ return;
+ case MAX_IDLE_STATE_SEEN_ENTER_IDLE:
+ gpr_atm_rel_store(&chand->idle_state, MAX_IDLE_STATE_SEEN_EXIT_IDLE);
+ return;
+ default:
+ /* try again */
+ break;
+ }
+ }
}
}
/* Decrease the nubmer of active calls. After the decrement, if there are no
calls, the max_idle_timer should be started. */
static void decrease_call_count(channel_data* chand) {
+ /* Enter idle */
if (gpr_atm_full_fetch_add(&chand->call_count, -1) == 1) {
- GRPC_CHANNEL_STACK_REF(chand->channel_stack, "max_age max_idle_timer");
- grpc_timer_init(
- &chand->max_idle_timer,
- grpc_core::ExecCtx::Get()->Now() + chand->max_connection_idle,
- &chand->close_max_idle_channel);
+ gpr_atm_no_barrier_store(&chand->last_enter_idle_time_millis,
+ (gpr_atm)grpc_core::ExecCtx::Get()->Now());
+ while (true) {
+ gpr_atm idle_state = gpr_atm_acq_load(&chand->idle_state);
+ switch (idle_state) {
+ case MAX_IDLE_STATE_INIT:
+ GRPC_CHANNEL_STACK_REF(chand->channel_stack,
+ "max_age max_idle_timer");
+ grpc_timer_init(
+ &chand->max_idle_timer,
+ grpc_core::ExecCtx::Get()->Now() + chand->max_connection_idle,
+ &chand->max_idle_timer_cb);
+ gpr_atm_rel_store(&chand->idle_state, MAX_IDLE_STATE_TIMER_SET);
+ return;
+ case MAX_IDLE_STATE_SEEN_EXIT_IDLE:
+ if (gpr_atm_rel_cas(&chand->idle_state, MAX_IDLE_STATE_SEEN_EXIT_IDLE,
+ MAX_IDLE_STATE_SEEN_ENTER_IDLE)) {
+ return;
+ }
+ break;
+ default:
+ /* try again */
+ break;
+ }
+ }
}
}
@@ -152,20 +249,58 @@ static void start_max_age_grace_timer_after_goaway_op(void* arg,
"max_age start_max_age_grace_timer_after_goaway_op");
}
-static void close_max_idle_channel(void* arg, grpc_error* error) {
+static void close_max_idle_channel(channel_data* chand) {
+ /* Prevent the max idle timer from being set again */
+ gpr_atm_no_barrier_fetch_add(&chand->call_count, 1);
+ grpc_transport_op* op = grpc_make_transport_op(nullptr);
+ op->goaway_error =
+ grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("max_idle"),
+ GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_NO_ERROR);
+ grpc_channel_element* elem =
+ grpc_channel_stack_element(chand->channel_stack, 0);
+ elem->filter->start_transport_op(elem, op);
+}
+
+static void max_idle_timer_cb(void* arg, grpc_error* error) {
channel_data* chand = (channel_data*)arg;
if (error == GRPC_ERROR_NONE) {
- /* Prevent the max idle timer from being set again */
- gpr_atm_no_barrier_fetch_add(&chand->call_count, 1);
- grpc_transport_op* op = grpc_make_transport_op(nullptr);
- op->goaway_error =
- grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("max_idle"),
- GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_NO_ERROR);
- grpc_channel_element* elem =
- grpc_channel_stack_element(chand->channel_stack, 0);
- elem->filter->start_transport_op(elem, op);
- } else if (error != GRPC_ERROR_CANCELLED) {
- GRPC_LOG_IF_ERROR("close_max_idle_channel", error);
+ bool try_again = true;
+ while (try_again) {
+ gpr_atm idle_state = gpr_atm_acq_load(&chand->idle_state);
+ switch (idle_state) {
+ case MAX_IDLE_STATE_TIMER_SET:
+ close_max_idle_channel(chand);
+ /* This MAX_IDLE_STATE_INIT is a final state, we don't have to check
+ * if idle_state has been changed */
+ gpr_atm_rel_store(&chand->idle_state, MAX_IDLE_STATE_INIT);
+ try_again = false;
+ break;
+ case MAX_IDLE_STATE_SEEN_EXIT_IDLE:
+ if (gpr_atm_rel_cas(&chand->idle_state, MAX_IDLE_STATE_SEEN_EXIT_IDLE,
+ MAX_IDLE_STATE_INIT)) {
+ try_again = false;
+ }
+ break;
+ case MAX_IDLE_STATE_SEEN_ENTER_IDLE:
+ GRPC_CHANNEL_STACK_REF(chand->channel_stack,
+ "max_age max_idle_timer");
+ grpc_timer_init(&chand->max_idle_timer,
+ (grpc_millis)gpr_atm_no_barrier_load(
+ &chand->last_enter_idle_time_millis) +
+ chand->max_connection_idle,
+ &chand->max_idle_timer_cb);
+ /* idle_state may have already been set to
+ MAX_IDLE_STATE_SEEN_EXIT_IDLE by increase_call_count(), in this
+ case, we don't need to set it to MAX_IDLE_STATE_TIMER_SET */
+ gpr_atm_rel_cas(&chand->idle_state, MAX_IDLE_STATE_SEEN_ENTER_IDLE,
+ MAX_IDLE_STATE_TIMER_SET);
+ try_again = false;
+ break;
+ default:
+ /* try again */
+ break;
+ }
+ }
}
GRPC_CHANNEL_STACK_UNREF(chand->channel_stack, "max_age max_idle_timer");
}
@@ -288,6 +423,9 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
chand->max_connection_idle = DEFAULT_MAX_CONNECTION_IDLE_MS == INT_MAX
? GRPC_MILLIS_INF_FUTURE
: DEFAULT_MAX_CONNECTION_IDLE_MS;
+ chand->idle_state = MAX_IDLE_STATE_INIT;
+ gpr_atm_no_barrier_store(&chand->last_enter_idle_time_millis,
+ GRPC_MILLIS_INF_PAST);
for (size_t i = 0; i < args->channel_args->num_args; ++i) {
if (0 == strcmp(args->channel_args->args[i].key,
GRPC_ARG_MAX_CONNECTION_AGE_MS)) {
@@ -311,8 +449,8 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
value == INT_MAX ? GRPC_MILLIS_INF_FUTURE : value;
}
}
- GRPC_CLOSURE_INIT(&chand->close_max_idle_channel, close_max_idle_channel,
- chand, grpc_schedule_on_exec_ctx);
+ GRPC_CLOSURE_INIT(&chand->max_idle_timer_cb, max_idle_timer_cb, chand,
+ grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(&chand->close_max_age_channel, close_max_age_channel, chand,
grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(&chand->force_close_max_age_channel,
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc
index 7735c3de6e..e23c07f16c 100644
--- a/src/core/ext/transport/cronet/transport/cronet_transport.cc
+++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc
@@ -21,12 +21,12 @@
#include <grpc/impl/codegen/port_platform.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/transport/chttp2/transport/incoming_metadata.h"
#include "src/core/ext/transport/cronet/transport/cronet_transport.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/exec_ctx.h"
diff --git a/src/core/lib/avl/avl.cc b/src/core/lib/avl/avl.cc
index 959d12fe3a..acc0432af7 100644
--- a/src/core/lib/avl/avl.cc
+++ b/src/core/lib/avl/avl.cc
@@ -78,7 +78,7 @@ static grpc_avl_node* assert_invariants(grpc_avl_node* n) { return n; }
#endif
grpc_avl_node* new_node(void* key, void* value, grpc_avl_node* left,
- grpc_avl_node* right) {
+ grpc_avl_node* right) {
grpc_avl_node* node = (grpc_avl_node*)gpr_malloc(sizeof(*node));
gpr_ref_init(&node->refs, 1);
node->key = key;
@@ -90,7 +90,7 @@ grpc_avl_node* new_node(void* key, void* value, grpc_avl_node* left,
}
static grpc_avl_node* get(const grpc_avl_vtable* vtable, grpc_avl_node* node,
- void* key, void* user_data) {
+ void* key, void* user_data) {
long cmp;
if (node == nullptr) {
@@ -122,19 +122,19 @@ int grpc_avl_maybe_get(grpc_avl avl, void* key, void** value, void* user_data) {
}
static grpc_avl_node* rotate_left(const grpc_avl_vtable* vtable, void* key,
- void* value, grpc_avl_node* left,
- grpc_avl_node* right, void* user_data) {
+ void* value, grpc_avl_node* left,
+ grpc_avl_node* right, void* user_data) {
grpc_avl_node* n = new_node(vtable->copy_key(right->key, user_data),
- vtable->copy_value(right->value, user_data),
- new_node(key, value, left, ref_node(right->left)),
- ref_node(right->right));
+ vtable->copy_value(right->value, user_data),
+ new_node(key, value, left, ref_node(right->left)),
+ ref_node(right->right));
unref_node(vtable, right, user_data);
return n;
}
static grpc_avl_node* rotate_right(const grpc_avl_vtable* vtable, void* key,
- void* value, grpc_avl_node* left,
- grpc_avl_node* right, void* user_data) {
+ void* value, grpc_avl_node* left,
+ grpc_avl_node* right, void* user_data) {
grpc_avl_node* n =
new_node(vtable->copy_key(left->key, user_data),
vtable->copy_value(left->value, user_data), ref_node(left->left),
@@ -143,9 +143,10 @@ static grpc_avl_node* rotate_right(const grpc_avl_vtable* vtable, void* key,
return n;
}
-static grpc_avl_node* rotate_left_right(const grpc_avl_vtable* vtable, void* key,
- void* value, grpc_avl_node* left,
- grpc_avl_node* right, void* user_data) {
+static grpc_avl_node* rotate_left_right(const grpc_avl_vtable* vtable,
+ void* key, void* value,
+ grpc_avl_node* left,
+ grpc_avl_node* right, void* user_data) {
/* rotate_right(..., rotate_left(left), right) */
grpc_avl_node* n =
new_node(vtable->copy_key(left->right->key, user_data),
@@ -158,9 +159,10 @@ static grpc_avl_node* rotate_left_right(const grpc_avl_vtable* vtable, void* key
return n;
}
-static grpc_avl_node* rotate_right_left(const grpc_avl_vtable* vtable, void* key,
- void* value, grpc_avl_node* left,
- grpc_avl_node* right, void* user_data) {
+static grpc_avl_node* rotate_right_left(const grpc_avl_vtable* vtable,
+ void* key, void* value,
+ grpc_avl_node* left,
+ grpc_avl_node* right, void* user_data) {
/* rotate_left(..., left, rotate_right(right)) */
grpc_avl_node* n =
new_node(vtable->copy_key(right->left->key, user_data),
@@ -174,8 +176,8 @@ static grpc_avl_node* rotate_right_left(const grpc_avl_vtable* vtable, void* key
}
static grpc_avl_node* rebalance(const grpc_avl_vtable* vtable, void* key,
- void* value, grpc_avl_node* left,
- grpc_avl_node* right, void* user_data) {
+ void* value, grpc_avl_node* left,
+ grpc_avl_node* right, void* user_data) {
switch (node_height(left) - node_height(right)) {
case 2:
if (node_height(left->left) - node_height(left->right) == -1) {
@@ -198,8 +200,9 @@ static grpc_avl_node* rebalance(const grpc_avl_vtable* vtable, void* key,
}
}
-static grpc_avl_node* add_key(const grpc_avl_vtable* vtable, grpc_avl_node* node,
- void* key, void* value, void* user_data) {
+static grpc_avl_node* add_key(const grpc_avl_vtable* vtable,
+ grpc_avl_node* node, void* key, void* value,
+ void* user_data) {
long cmp;
if (node == nullptr) {
return new_node(key, value, nullptr, nullptr);
@@ -243,8 +246,8 @@ static grpc_avl_node* in_order_tail(grpc_avl_node* node) {
}
static grpc_avl_node* remove_key(const grpc_avl_vtable* vtable,
- grpc_avl_node* node, void* key,
- void* user_data) {
+ grpc_avl_node* node, void* key,
+ void* user_data) {
long cmp;
if (node == nullptr) {
return nullptr;
diff --git a/src/core/lib/compression/compression.cc b/src/core/lib/compression/compression.cc
index be7febf380..69d70ea941 100644
--- a/src/core/lib/compression/compression.cc
+++ b/src/core/lib/compression/compression.cc
@@ -29,8 +29,7 @@
int grpc_compression_algorithm_is_message(
grpc_compression_algorithm algorithm) {
- return (algorithm >= GRPC_COMPRESS_MESSAGE_DEFLATE &&
- algorithm <= GRPC_COMPRESS_MESSAGE_GZIP)
+ return (algorithm >= GRPC_COMPRESS_DEFLATE && algorithm <= GRPC_COMPRESS_GZIP)
? 1
: 0;
}
@@ -44,11 +43,11 @@ int grpc_compression_algorithm_parse(grpc_slice name,
if (grpc_slice_eq(name, GRPC_MDSTR_IDENTITY)) {
*algorithm = GRPC_COMPRESS_NONE;
return 1;
- } else if (grpc_slice_eq(name, GRPC_MDSTR_MESSAGE_SLASH_DEFLATE)) {
- *algorithm = GRPC_COMPRESS_MESSAGE_DEFLATE;
+ } else if (grpc_slice_eq(name, GRPC_MDSTR_DEFLATE)) {
+ *algorithm = GRPC_COMPRESS_DEFLATE;
return 1;
- } else if (grpc_slice_eq(name, GRPC_MDSTR_MESSAGE_SLASH_GZIP)) {
- *algorithm = GRPC_COMPRESS_MESSAGE_GZIP;
+ } else if (grpc_slice_eq(name, GRPC_MDSTR_GZIP)) {
+ *algorithm = GRPC_COMPRESS_GZIP;
return 1;
} else if (grpc_slice_eq(name, GRPC_MDSTR_STREAM_SLASH_GZIP)) {
*algorithm = GRPC_COMPRESS_STREAM_GZIP;
@@ -67,11 +66,11 @@ int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm,
case GRPC_COMPRESS_NONE:
*name = "identity";
return 1;
- case GRPC_COMPRESS_MESSAGE_DEFLATE:
- *name = "message/deflate";
+ case GRPC_COMPRESS_DEFLATE:
+ *name = "deflate";
return 1;
- case GRPC_COMPRESS_MESSAGE_GZIP:
- *name = "message/gzip";
+ case GRPC_COMPRESS_GZIP:
+ *name = "gzip";
return 1;
case GRPC_COMPRESS_STREAM_GZIP:
*name = "stream/gzip";
@@ -133,10 +132,10 @@ grpc_slice grpc_compression_algorithm_slice(
switch (algorithm) {
case GRPC_COMPRESS_NONE:
return GRPC_MDSTR_IDENTITY;
- case GRPC_COMPRESS_MESSAGE_DEFLATE:
- return GRPC_MDSTR_MESSAGE_SLASH_DEFLATE;
- case GRPC_COMPRESS_MESSAGE_GZIP:
- return GRPC_MDSTR_MESSAGE_SLASH_GZIP;
+ case GRPC_COMPRESS_DEFLATE:
+ return GRPC_MDSTR_DEFLATE;
+ case GRPC_COMPRESS_GZIP:
+ return GRPC_MDSTR_GZIP;
case GRPC_COMPRESS_STREAM_GZIP:
return GRPC_MDSTR_STREAM_SLASH_GZIP;
case GRPC_COMPRESS_ALGORITHMS_COUNT:
@@ -148,10 +147,8 @@ grpc_slice grpc_compression_algorithm_slice(
grpc_compression_algorithm grpc_compression_algorithm_from_slice(
grpc_slice str) {
if (grpc_slice_eq(str, GRPC_MDSTR_IDENTITY)) return GRPC_COMPRESS_NONE;
- if (grpc_slice_eq(str, GRPC_MDSTR_MESSAGE_SLASH_DEFLATE))
- return GRPC_COMPRESS_MESSAGE_DEFLATE;
- if (grpc_slice_eq(str, GRPC_MDSTR_MESSAGE_SLASH_GZIP))
- return GRPC_COMPRESS_MESSAGE_GZIP;
+ if (grpc_slice_eq(str, GRPC_MDSTR_DEFLATE)) return GRPC_COMPRESS_DEFLATE;
+ if (grpc_slice_eq(str, GRPC_MDSTR_GZIP)) return GRPC_COMPRESS_GZIP;
if (grpc_slice_eq(str, GRPC_MDSTR_STREAM_SLASH_GZIP))
return GRPC_COMPRESS_STREAM_GZIP;
return GRPC_COMPRESS_ALGORITHMS_COUNT;
@@ -162,9 +159,9 @@ grpc_mdelem grpc_compression_encoding_mdelem(
switch (algorithm) {
case GRPC_COMPRESS_NONE:
return GRPC_MDELEM_GRPC_ENCODING_IDENTITY;
- case GRPC_COMPRESS_MESSAGE_DEFLATE:
+ case GRPC_COMPRESS_DEFLATE:
return GRPC_MDELEM_GRPC_ENCODING_DEFLATE;
- case GRPC_COMPRESS_MESSAGE_GZIP:
+ case GRPC_COMPRESS_GZIP:
return GRPC_MDELEM_GRPC_ENCODING_GZIP;
case GRPC_COMPRESS_STREAM_GZIP:
return GRPC_MDELEM_GRPC_ENCODING_GZIP;
diff --git a/src/core/lib/compression/compression_internal.cc b/src/core/lib/compression/compression_internal.cc
index 0583705dc1..4bbaca2f98 100644
--- a/src/core/lib/compression/compression_internal.cc
+++ b/src/core/lib/compression/compression_internal.cc
@@ -80,9 +80,9 @@ grpc_message_compression_algorithm
grpc_compression_algorithm_to_message_compression_algorithm(
grpc_compression_algorithm algo) {
switch (algo) {
- case GRPC_COMPRESS_MESSAGE_DEFLATE:
+ case GRPC_COMPRESS_DEFLATE:
return GRPC_MESSAGE_COMPRESS_DEFLATE;
- case GRPC_COMPRESS_MESSAGE_GZIP:
+ case GRPC_COMPRESS_GZIP:
return GRPC_MESSAGE_COMPRESS_GZIP;
default:
return GRPC_MESSAGE_COMPRESS_NONE;
@@ -147,10 +147,10 @@ int grpc_compression_algorithm_from_message_stream_compression_algorithm(
*algorithm = GRPC_COMPRESS_NONE;
return 1;
case GRPC_MESSAGE_COMPRESS_DEFLATE:
- *algorithm = GRPC_COMPRESS_MESSAGE_DEFLATE;
+ *algorithm = GRPC_COMPRESS_DEFLATE;
return 1;
case GRPC_MESSAGE_COMPRESS_GZIP:
- *algorithm = GRPC_COMPRESS_MESSAGE_GZIP;
+ *algorithm = GRPC_COMPRESS_GZIP;
return 1;
default:
*algorithm = GRPC_COMPRESS_NONE;
diff --git a/src/core/lib/compression/compression_ruby.cc b/src/core/lib/compression/compression_ruby.cc
deleted file mode 100644
index 4e2d01aab1..0000000000
--- a/src/core/lib/compression/compression_ruby.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Copyright 2017 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/compression_ruby.h>
-
-#include "src/core/lib/surface/api_trace.h"
-#include "src/core/lib/transport/static_metadata.h"
-
-int grpc_compression_algorithm_parse_ruby(
- grpc_slice name, grpc_compression_algorithm* algorithm) {
- if (grpc_slice_eq(name, GRPC_MDSTR_IDENTITY)) {
- *algorithm = GRPC_COMPRESS_NONE;
- return 1;
- } else if (grpc_slice_eq(name, GRPC_MDSTR_DEFLATE)) {
- *algorithm = GRPC_COMPRESS_MESSAGE_DEFLATE;
- return 1;
- } else if (grpc_slice_eq(name, GRPC_MDSTR_GZIP)) {
- *algorithm = GRPC_COMPRESS_MESSAGE_GZIP;
- return 1;
- } else if (grpc_slice_eq(name, GRPC_MDSTR_STREAM_SLASH_GZIP)) {
- *algorithm = GRPC_COMPRESS_STREAM_GZIP;
- return 1;
- } else {
- return 0;
- }
- return 0;
-}
-
-int grpc_compression_algorithm_name_ruby(grpc_compression_algorithm algorithm,
- const char** name) {
- GRPC_API_TRACE("grpc_compression_algorithm_parse(algorithm=%d, name=%p)", 2,
- ((int)algorithm, name));
- switch (algorithm) {
- case GRPC_COMPRESS_NONE:
- *name = "identity";
- return 1;
- case GRPC_COMPRESS_MESSAGE_DEFLATE:
- *name = "deflate";
- return 1;
- case GRPC_COMPRESS_MESSAGE_GZIP:
- *name = "gzip";
- return 1;
- case GRPC_COMPRESS_STREAM_GZIP:
- *name = "stream/gzip";
- return 1;
- case GRPC_COMPRESS_ALGORITHMS_COUNT:
- return 0;
- }
- return 0;
-}
diff --git a/src/core/lib/gpr/env.h b/src/core/lib/gpr/env.h
index 7f35104be3..b31e20b7d2 100644
--- a/src/core/lib/gpr/env.h
+++ b/src/core/lib/gpr/env.h
@@ -29,7 +29,7 @@
variable exists). */
char* gpr_getenv(const char* name);
-/* Sets the the environment with the specified name to the specified value. */
+/* Sets the environment with the specified name to the specified value. */
void gpr_setenv(const char* name, const char* value);
/* This is a version of gpr_getenv that does not produce any output if it has to
diff --git a/src/core/lib/gpr/host_port.cc b/src/core/lib/gpr/host_port.cc
index 29178279d3..0776727906 100644
--- a/src/core/lib/gpr/host_port.cc
+++ b/src/core/lib/gpr/host_port.cc
@@ -16,13 +16,14 @@
*
*/
-#include <grpc/support/host_port.h>
+#include "src/core/lib/gpr/host_port.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+
#include "src/core/lib/gpr/string.h"
int gpr_join_host_port(char** out, const char* host, int port) {
diff --git a/include/grpc/support/host_port.h b/src/core/lib/gpr/host_port.h
index 9805811bfb..0bf0960f82 100644
--- a/include/grpc/support/host_port.h
+++ b/src/core/lib/gpr/host_port.h
@@ -16,15 +16,11 @@
*
*/
-#ifndef GRPC_SUPPORT_HOST_PORT_H
-#define GRPC_SUPPORT_HOST_PORT_H
+#ifndef GRPC_CORE_LIB_GPR_HOST_PORT_H
+#define GRPC_CORE_LIB_GPR_HOST_PORT_H
#include <grpc/support/port_platform.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/** Given a host and port, creates a newly-allocated string of the form
"host:port" or "[ho:st]:port", depending on whether the host contains colons
like an IPv6 literal. If the host is already bracketed, then additional
@@ -35,17 +31,13 @@ extern "C" {
destroyed using gpr_free().
In the unlikely event of an error, returns -1 and sets *out to NULL. */
-GPRAPI int gpr_join_host_port(char** out, const char* host, int port);
+int gpr_join_host_port(char** out, const char* host, int port);
/** Given a name in the form "host:port" or "[ho:st]:port", split into hostname
and port number, into newly allocated strings, which must later be
destroyed using gpr_free().
Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on
failure. */
-GPRAPI int gpr_split_host_port(const char* name, char** host, char** port);
-
-#ifdef __cplusplus
-}
-#endif
+int gpr_split_host_port(const char* name, char** host, char** port);
-#endif /* GRPC_SUPPORT_HOST_PORT_H */
+#endif /* GRPC_CORE_LIB_GPR_HOST_PORT_H */
diff --git a/src/core/lib/gprpp/orphanable.h b/src/core/lib/gprpp/orphanable.h
index 50199730c9..78d1b01ff8 100644
--- a/src/core/lib/gprpp/orphanable.h
+++ b/src/core/lib/gprpp/orphanable.h
@@ -28,6 +28,7 @@
#include "src/core/lib/gprpp/abstract.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/memory.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
namespace grpc_core {
@@ -69,6 +70,7 @@ inline OrphanablePtr<T> MakeOrphanable(Args&&... args) {
}
// A type of Orphanable with internal ref-counting.
+template <typename Child>
class InternallyRefCounted : public Orphanable {
public:
// Not copyable nor movable.
@@ -78,10 +80,20 @@ class InternallyRefCounted : public Orphanable {
GRPC_ABSTRACT_BASE_CLASS
protected:
+ // Allow Delete() to access destructor.
+ template <typename T>
+ friend void Delete(T*);
+
+ // Allow RefCountedPtr<> to access Unref() and IncrementRefCount().
+ friend class RefCountedPtr<Child>;
+
InternallyRefCounted() { gpr_ref_init(&refs_, 1); }
virtual ~InternallyRefCounted() {}
- void Ref() { gpr_ref(&refs_); }
+ RefCountedPtr<Child> Ref() GRPC_MUST_USE_RESULT {
+ IncrementRefCount();
+ return RefCountedPtr<Child>(static_cast<Child*>(this));
+ }
void Unref() {
if (gpr_unref(&refs_)) {
@@ -89,11 +101,9 @@ class InternallyRefCounted : public Orphanable {
}
}
- // Allow Delete() to access destructor.
- template <typename T>
- friend void Delete(T*);
-
private:
+ void IncrementRefCount() { gpr_ref(&refs_); }
+
gpr_refcount refs_;
};
@@ -103,6 +113,7 @@ class InternallyRefCounted : public Orphanable {
// pointers and legacy code that is manually calling Ref() and Unref().
// Once all of our code is converted to idiomatic C++, we may be able to
// eliminate this class.
+template <typename Child>
class InternallyRefCountedWithTracing : public Orphanable {
public:
// Not copyable nor movable.
@@ -118,6 +129,9 @@ class InternallyRefCountedWithTracing : public Orphanable {
template <typename T>
friend void Delete(T*);
+ // Allow RefCountedPtr<> to access Unref() and IncrementRefCount().
+ friend class RefCountedPtr<Child>;
+
InternallyRefCountedWithTracing()
: InternallyRefCountedWithTracing(static_cast<TraceFlag*>(nullptr)) {}
@@ -133,18 +147,27 @@ class InternallyRefCountedWithTracing : public Orphanable {
virtual ~InternallyRefCountedWithTracing() {}
- void Ref() { gpr_ref(&refs_); }
+ RefCountedPtr<Child> Ref() GRPC_MUST_USE_RESULT {
+ IncrementRefCount();
+ return RefCountedPtr<Child>(static_cast<Child*>(this));
+ }
- void Ref(const DebugLocation& location, const char* reason) {
+ RefCountedPtr<Child> Ref(const DebugLocation& location,
+ const char* reason) GRPC_MUST_USE_RESULT {
if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count);
gpr_log(GPR_DEBUG, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s",
trace_flag_->name(), this, location.file(), location.line(),
old_refs, old_refs + 1, reason);
}
- Ref();
+ return Ref();
}
+ // TODO(roth): Once all of our code is converted to C++ and can use
+ // RefCountedPtr<> instead of manual ref-counting, make the Unref() methods
+ // private, since they will only be used by RefCountedPtr<>, which is a
+ // friend of this class.
+
void Unref() {
if (gpr_unref(&refs_)) {
Delete(this);
@@ -162,6 +185,8 @@ class InternallyRefCountedWithTracing : public Orphanable {
}
private:
+ void IncrementRefCount() { gpr_ref(&refs_); }
+
TraceFlag* trace_flag_ = nullptr;
gpr_refcount refs_;
};
diff --git a/src/core/lib/gprpp/ref_counted.h b/src/core/lib/gprpp/ref_counted.h
index c68118a71a..ab589fc01a 100644
--- a/src/core/lib/gprpp/ref_counted.h
+++ b/src/core/lib/gprpp/ref_counted.h
@@ -26,16 +26,28 @@
#include "src/core/lib/gprpp/abstract.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/memory.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
namespace grpc_core {
// A base class for reference-counted objects.
// New objects should be created via New() and start with a refcount of 1.
// When the refcount reaches 0, the object will be deleted via Delete().
+//
+// This will commonly be used by CRTP (curiously-recurring template pattern)
+// e.g., class MyClass : public RefCounted<MyClass>
+template <typename Child>
class RefCounted {
public:
- void Ref() { gpr_ref(&refs_); }
+ RefCountedPtr<Child> Ref() GRPC_MUST_USE_RESULT {
+ IncrementRefCount();
+ return RefCountedPtr<Child>(static_cast<Child*>(this));
+ }
+ // TODO(roth): Once all of our code is converted to C++ and can use
+ // RefCountedPtr<> instead of manual ref-counting, make this method
+ // private, since it will only be used by RefCountedPtr<>, which is a
+ // friend of this class.
void Unref() {
if (gpr_unref(&refs_)) {
Delete(this);
@@ -58,6 +70,11 @@ class RefCounted {
virtual ~RefCounted() {}
private:
+ // Allow RefCountedPtr<> to access IncrementRefCount().
+ friend class RefCountedPtr<Child>;
+
+ void IncrementRefCount() { gpr_ref(&refs_); }
+
gpr_refcount refs_;
};
@@ -67,20 +84,30 @@ class RefCounted {
// pointers and legacy code that is manually calling Ref() and Unref().
// Once all of our code is converted to idiomatic C++, we may be able to
// eliminate this class.
+template <typename Child>
class RefCountedWithTracing {
public:
- void Ref() { gpr_ref(&refs_); }
+ RefCountedPtr<Child> Ref() GRPC_MUST_USE_RESULT {
+ IncrementRefCount();
+ return RefCountedPtr<Child>(static_cast<Child*>(this));
+ }
- void Ref(const DebugLocation& location, const char* reason) {
+ RefCountedPtr<Child> Ref(const DebugLocation& location,
+ const char* reason) GRPC_MUST_USE_RESULT {
if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count);
gpr_log(GPR_DEBUG, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s",
trace_flag_->name(), this, location.file(), location.line(),
old_refs, old_refs + 1, reason);
}
- Ref();
+ return Ref();
}
+ // TODO(roth): Once all of our code is converted to C++ and can use
+ // RefCountedPtr<> instead of manual ref-counting, make the Unref() methods
+ // private, since they will only be used by RefCountedPtr<>, which is a
+ // friend of this class.
+
void Unref() {
if (gpr_unref(&refs_)) {
Delete(this);
@@ -124,6 +151,11 @@ class RefCountedWithTracing {
virtual ~RefCountedWithTracing() {}
private:
+ // Allow RefCountedPtr<> to access IncrementRefCount().
+ friend class RefCountedPtr<Child>;
+
+ void IncrementRefCount() { gpr_ref(&refs_); }
+
TraceFlag* trace_flag_ = nullptr;
gpr_refcount refs_;
};
diff --git a/src/core/lib/gprpp/ref_counted_ptr.h b/src/core/lib/gprpp/ref_counted_ptr.h
index dda0f00d79..f82ba50da3 100644
--- a/src/core/lib/gprpp/ref_counted_ptr.h
+++ b/src/core/lib/gprpp/ref_counted_ptr.h
@@ -25,8 +25,8 @@
namespace grpc_core {
-// A smart pointer class for objects that provide Ref() and Unref() methods,
-// such as those provided by the RefCounted base class.
+// A smart pointer class for objects that provide IncrementRefCount() and
+// Unref() methods, such as those provided by the RefCounted base class.
template <typename T>
class RefCountedPtr {
public:
@@ -49,13 +49,13 @@ class RefCountedPtr {
// Copy support.
RefCountedPtr(const RefCountedPtr& other) {
- if (other.value_ != nullptr) other.value_->Ref();
+ if (other.value_ != nullptr) other.value_->IncrementRefCount();
value_ = other.value_;
}
RefCountedPtr& operator=(const RefCountedPtr& other) {
// Note: Order of reffing and unreffing is important here in case value_
// and other.value_ are the same object.
- if (other.value_ != nullptr) other.value_->Ref();
+ if (other.value_ != nullptr) other.value_->IncrementRefCount();
if (value_ != nullptr) value_->Unref();
value_ = other.value_;
return *this;
@@ -71,6 +71,16 @@ class RefCountedPtr {
value_ = value;
}
+ // TODO(roth): This method exists solely as a transition mechanism to allow
+ // us to pass a ref to idiomatic C code that does not use RefCountedPtr<>.
+ // Once all of our code has been converted to idiomatic C++, this
+ // method should go away.
+ T* release() {
+ T* value = value_;
+ value_ = nullptr;
+ return value;
+ }
+
T* get() const { return value_; }
T& operator*() const { return *value_; }
diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc
index aaace58dd5..7697a85f2e 100644
--- a/src/core/lib/iomgr/ev_epollex_linux.cc
+++ b/src/core/lib/iomgr/ev_epollex_linux.cc
@@ -57,7 +57,7 @@
//#define GRPC_EPOLLEX_CREATE_WORKERS_ON_HEAP 1
#define MAX_EPOLL_EVENTS 100
-#define MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL 5
+#define MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL 1
grpc_core::DebugOnlyTraceFlag grpc_trace_pollable_refcount(false,
"pollable_refcount");
@@ -1452,10 +1452,6 @@ static const grpc_event_engine_vtable vtable = {
const grpc_event_engine_vtable* grpc_init_epollex_linux(
bool explicitly_requested) {
- if (!explicitly_requested) {
- return nullptr;
- }
-
if (!grpc_has_wakeup_fd()) {
gpr_log(GPR_ERROR, "Skipping epollex because of no wakeup fd.");
return nullptr;
diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc
index 84be1804a2..179512b373 100644
--- a/src/core/lib/iomgr/ev_poll_posix.cc
+++ b/src/core/lib/iomgr/ev_poll_posix.cc
@@ -457,16 +457,20 @@ static grpc_error* fd_shutdown_error(grpc_fd* fd) {
if (!fd->shutdown) {
return GRPC_ERROR_NONE;
} else {
- return GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
- "FD shutdown", &fd->shutdown_error, 1);
+ return grpc_error_set_int(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
+ "FD shutdown", &fd->shutdown_error, 1),
+ GRPC_ERROR_INT_GRPC_STATUS,
+ GRPC_STATUS_UNAVAILABLE);
}
}
static void notify_on_locked(grpc_fd* fd, grpc_closure** st,
grpc_closure* closure) {
if (fd->shutdown || gpr_atm_no_barrier_load(&fd->pollhup)) {
- GRPC_CLOSURE_SCHED(closure,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("FD shutdown"));
+ GRPC_CLOSURE_SCHED(
+ closure, grpc_error_set_int(
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("FD shutdown"),
+ GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
} else if (*st == CLOSURE_NOT_READY) {
/* not ready ==> switch to a waiting state by setting the closure */
*st = closure;
diff --git a/src/core/lib/iomgr/resolve_address_posix.cc b/src/core/lib/iomgr/resolve_address_posix.cc
index 131a8de30a..3eea709ce4 100644
--- a/src/core/lib/iomgr/resolve_address_posix.cc
+++ b/src/core/lib/iomgr/resolve_address_posix.cc
@@ -27,12 +27,12 @@
#include <sys/types.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/block_annotate.h"
diff --git a/src/core/lib/iomgr/resolve_address_uv.cc b/src/core/lib/iomgr/resolve_address_uv.cc
index 886c06cdb7..6eb6fe3af5 100644
--- a/src/core/lib/iomgr/resolve_address_uv.cc
+++ b/src/core/lib/iomgr/resolve_address_uv.cc
@@ -22,10 +22,10 @@
#include <uv.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/error.h"
diff --git a/src/core/lib/iomgr/resolve_address_windows.cc b/src/core/lib/iomgr/resolve_address_windows.cc
index e44ab396b3..e875d77fd8 100644
--- a/src/core/lib/iomgr/resolve_address_windows.cc
+++ b/src/core/lib/iomgr/resolve_address_windows.cc
@@ -28,12 +28,13 @@
#include <sys/types.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
#include <grpc/support/string_util.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/block_annotate.h"
#include "src/core/lib/iomgr/executor.h"
diff --git a/src/core/lib/iomgr/sockaddr_utils.cc b/src/core/lib/iomgr/sockaddr_utils.cc
index 71e3e38624..ac97af4dee 100644
--- a/src/core/lib/iomgr/sockaddr_utils.cc
+++ b/src/core/lib/iomgr/sockaddr_utils.cc
@@ -23,11 +23,11 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h"
diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc
index 5068a8081d..d02d77eb02 100644
--- a/src/core/lib/iomgr/socket_utils_common_posix.cc
+++ b/src/core/lib/iomgr/socket_utils_common_posix.cc
@@ -36,10 +36,11 @@
#include <unistd.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
diff --git a/src/core/lib/security/transport/client_auth_filter.cc b/src/core/lib/security/transport/client_auth_filter.cc
index 16814d2598..802503c868 100644
--- a/src/core/lib/security/transport/client_auth_filter.cc
+++ b/src/core/lib/security/transport/client_auth_filter.cc
@@ -118,6 +118,7 @@ static void on_credentials_metadata(void* arg, grpc_error* input_error) {
grpc_transport_stream_op_batch_finish_with_failure(batch, error,
calld->call_combiner);
}
+ GRPC_CALL_STACK_UNREF(calld->owning_call, "get_request_metadata");
}
void grpc_auth_metadata_context_build(
@@ -208,7 +209,7 @@ static void send_security_metadata(grpc_call_element* elem,
chand->auth_context, &calld->auth_md_context);
GPR_ASSERT(calld->pollent != nullptr);
-
+ GRPC_CALL_STACK_REF(calld->owning_call, "get_request_metadata");
GRPC_CLOSURE_INIT(&calld->async_result_closure, on_credentials_metadata,
batch, grpc_schedule_on_exec_ctx);
grpc_error* error = GRPC_ERROR_NONE;
@@ -250,6 +251,7 @@ static void on_host_checked(void* arg, grpc_error* error) {
calld->call_combiner);
gpr_free(error_msg);
}
+ GRPC_CALL_STACK_UNREF(calld->owning_call, "check_call_host");
}
static void cancel_check_call_host(void* arg, grpc_error* error) {
@@ -312,6 +314,7 @@ static void auth_start_transport_stream_op_batch(
}
if (calld->have_host) {
batch->handler_private.extra_arg = elem;
+ GRPC_CALL_STACK_REF(calld->owning_call, "check_call_host");
GRPC_CLOSURE_INIT(&calld->async_result_closure, on_host_checked, batch,
grpc_schedule_on_exec_ctx);
char* call_host = grpc_slice_to_c_string(calld->host);
diff --git a/src/core/lib/security/transport/security_connector.cc b/src/core/lib/security/transport/security_connector.cc
index 1d962f94b2..fd632bdbab 100644
--- a/src/core/lib/security/transport/security_connector.cc
+++ b/src/core/lib/security/transport/security_connector.cc
@@ -23,7 +23,6 @@
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@@ -31,6 +30,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/security/context/security_context.h"
diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc
index a77dc70ba0..a7b932b46d 100644
--- a/src/core/lib/surface/call.cc
+++ b/src/core/lib/surface/call.cc
@@ -1032,6 +1032,7 @@ static grpc_stream_compression_algorithm decode_stream_compression(
static void publish_app_metadata(grpc_call* call, grpc_metadata_batch* b,
int is_trailing) {
if (b->list.count == 0) return;
+ if (is_trailing && call->buffered_metadata[1] == nullptr) return;
GPR_TIMER_SCOPE("publish_app_metadata", 0);
grpc_metadata_array* dest;
grpc_metadata* mdusr;
diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc
index 153b6e0297..51daad0368 100644
--- a/src/core/lib/surface/version.cc
+++ b/src/core/lib/surface/version.cc
@@ -23,4 +23,4 @@
const char* grpc_version_string(void) { return "6.0.0-dev"; }
-const char* grpc_g_stands_for(void) { return "glossy"; }
+const char* grpc_g_stands_for(void) { return "glamorous"; }
diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc
index 82ba7ac51a..ebc75724cf 100644
--- a/src/core/lib/transport/static_metadata.cc
+++ b/src/core/lib/transport/static_metadata.cc
@@ -20,7 +20,7 @@
* To make changes to this file, change
* tools/codegen/core/gen_static_metadata.py, and then re-run it.
*
- * See metadata.h for an explanation of the interface here, and metadata.c for
+ * See metadata.h for an explanation of the interface here, and metadata.cc for
* an explanation of what's going on.
*/
@@ -57,53 +57,52 @@ static uint8_t g_bytes[] = {
112, 111, 110, 115, 101, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98,
121, 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49,
46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66,
- 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 109, 101, 115, 115, 97,
- 103, 101, 47, 100, 101, 102, 108, 97, 116, 101, 109, 101, 115, 115, 97,
- 103, 101, 47, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, 103,
- 122, 105, 112, 48, 49, 50, 105, 100, 101, 110, 116, 105, 116, 121, 103,
- 122, 105, 112, 100, 101, 102, 108, 97, 116, 101, 116, 114, 97, 105, 108,
- 101, 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47,
- 103, 114, 112, 99, 80, 79, 83, 84, 50, 48, 48, 52, 48, 52, 104,
- 116, 116, 112, 104, 116, 116, 112, 115, 103, 114, 112, 99, 71, 69, 84,
- 80, 85, 84, 47, 47, 105, 110, 100, 101, 120, 46, 104, 116, 109, 108,
- 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 53, 48, 48,
- 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, 103,
- 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101, 97, 99, 99,
- 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 97, 99, 99,
- 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99, 99, 101, 112,
- 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 116, 114, 111, 108,
- 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 105, 110, 97, 103,
- 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 114, 105, 122, 97,
- 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 111, 110, 116, 114,
- 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 105, 115, 112, 111,
- 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, 108,
- 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, 116, 45,
- 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, 45, 108,
- 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45,
- 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, 116, 101,
- 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, 105, 114,
- 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, 104, 105,
- 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99,
- 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, 105,
- 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, 100,
- 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, 116,
- 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 98, 45, 99, 111, 115,
- 116, 45, 98, 105, 110, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105,
- 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112,
- 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97,
- 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105,
- 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101,
- 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121,
- 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116,
- 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116,
- 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105,
- 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111,
- 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45,
- 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 105, 100, 101,
- 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100,
- 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108,
- 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116,
- 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112};
+ 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 100, 101, 102, 108, 97,
+ 116, 101, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, 122,
+ 105, 112, 48, 49, 50, 105, 100, 101, 110, 116, 105, 116, 121, 116, 114,
+ 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, 105,
+ 111, 110, 47, 103, 114, 112, 99, 80, 79, 83, 84, 50, 48, 48, 52,
+ 48, 52, 104, 116, 116, 112, 104, 116, 116, 112, 115, 103, 114, 112, 99,
+ 71, 69, 84, 80, 85, 84, 47, 47, 105, 110, 100, 101, 120, 46, 104,
+ 116, 109, 108, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48,
+ 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115,
+ 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101,
+ 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101,
+ 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99,
+ 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 116,
+ 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 105,
+ 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 114,
+ 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 111,
+ 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 105,
+ 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110,
+ 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 101,
+ 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110,
+ 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 101,
+ 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 100,
+ 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 120,
+ 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 116,
+ 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115,
+ 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116,
+ 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110,
+ 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108,
+ 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 98, 45,
+ 99, 111, 115, 116, 45, 98, 105, 110, 108, 105, 110, 107, 108, 111, 99,
+ 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114,
+ 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116,
+ 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104,
+ 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114,
+ 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101,
+ 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114,
+ 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99,
+ 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99,
+ 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101,
+ 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 119,
+ 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101,
+ 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116,
+ 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100,
+ 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110,
+ 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122,
+ 105, 112};
static void static_ref(void* unused) {}
static void static_unref(void* unused) {}
@@ -216,8 +215,6 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = {
{&grpc_static_metadata_vtable, &static_sub_refcnt},
{&grpc_static_metadata_vtable, &static_sub_refcnt},
{&grpc_static_metadata_vtable, &static_sub_refcnt},
- {&grpc_static_metadata_vtable, &static_sub_refcnt},
- {&grpc_static_metadata_vtable, &static_sub_refcnt},
};
const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {
@@ -250,80 +247,78 @@ const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {
{&grpc_static_metadata_refcounts[26], {{g_bytes + 333, 30}}},
{&grpc_static_metadata_refcounts[27], {{g_bytes + 363, 31}}},
{&grpc_static_metadata_refcounts[28], {{g_bytes + 394, 36}}},
- {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 15}}},
- {&grpc_static_metadata_refcounts[30], {{g_bytes + 445, 12}}},
- {&grpc_static_metadata_refcounts[31], {{g_bytes + 457, 11}}},
- {&grpc_static_metadata_refcounts[32], {{g_bytes + 468, 1}}},
- {&grpc_static_metadata_refcounts[33], {{g_bytes + 469, 1}}},
- {&grpc_static_metadata_refcounts[34], {{g_bytes + 470, 1}}},
- {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}},
- {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}},
- {&grpc_static_metadata_refcounts[37], {{g_bytes + 483, 7}}},
- {&grpc_static_metadata_refcounts[38], {{g_bytes + 490, 8}}},
- {&grpc_static_metadata_refcounts[39], {{g_bytes + 498, 16}}},
- {&grpc_static_metadata_refcounts[40], {{g_bytes + 514, 4}}},
- {&grpc_static_metadata_refcounts[41], {{g_bytes + 518, 3}}},
- {&grpc_static_metadata_refcounts[42], {{g_bytes + 521, 3}}},
- {&grpc_static_metadata_refcounts[43], {{g_bytes + 524, 4}}},
- {&grpc_static_metadata_refcounts[44], {{g_bytes + 528, 5}}},
- {&grpc_static_metadata_refcounts[45], {{g_bytes + 533, 4}}},
- {&grpc_static_metadata_refcounts[46], {{g_bytes + 537, 3}}},
- {&grpc_static_metadata_refcounts[47], {{g_bytes + 540, 3}}},
- {&grpc_static_metadata_refcounts[48], {{g_bytes + 543, 1}}},
- {&grpc_static_metadata_refcounts[49], {{g_bytes + 544, 11}}},
- {&grpc_static_metadata_refcounts[50], {{g_bytes + 555, 3}}},
- {&grpc_static_metadata_refcounts[51], {{g_bytes + 558, 3}}},
- {&grpc_static_metadata_refcounts[52], {{g_bytes + 561, 3}}},
- {&grpc_static_metadata_refcounts[53], {{g_bytes + 564, 3}}},
- {&grpc_static_metadata_refcounts[54], {{g_bytes + 567, 3}}},
- {&grpc_static_metadata_refcounts[55], {{g_bytes + 570, 14}}},
- {&grpc_static_metadata_refcounts[56], {{g_bytes + 584, 13}}},
- {&grpc_static_metadata_refcounts[57], {{g_bytes + 597, 15}}},
- {&grpc_static_metadata_refcounts[58], {{g_bytes + 612, 13}}},
- {&grpc_static_metadata_refcounts[59], {{g_bytes + 625, 6}}},
- {&grpc_static_metadata_refcounts[60], {{g_bytes + 631, 27}}},
- {&grpc_static_metadata_refcounts[61], {{g_bytes + 658, 3}}},
- {&grpc_static_metadata_refcounts[62], {{g_bytes + 661, 5}}},
- {&grpc_static_metadata_refcounts[63], {{g_bytes + 666, 13}}},
- {&grpc_static_metadata_refcounts[64], {{g_bytes + 679, 13}}},
- {&grpc_static_metadata_refcounts[65], {{g_bytes + 692, 19}}},
- {&grpc_static_metadata_refcounts[66], {{g_bytes + 711, 16}}},
- {&grpc_static_metadata_refcounts[67], {{g_bytes + 727, 14}}},
- {&grpc_static_metadata_refcounts[68], {{g_bytes + 741, 16}}},
- {&grpc_static_metadata_refcounts[69], {{g_bytes + 757, 13}}},
- {&grpc_static_metadata_refcounts[70], {{g_bytes + 770, 6}}},
- {&grpc_static_metadata_refcounts[71], {{g_bytes + 776, 4}}},
- {&grpc_static_metadata_refcounts[72], {{g_bytes + 780, 4}}},
- {&grpc_static_metadata_refcounts[73], {{g_bytes + 784, 6}}},
- {&grpc_static_metadata_refcounts[74], {{g_bytes + 790, 7}}},
- {&grpc_static_metadata_refcounts[75], {{g_bytes + 797, 4}}},
- {&grpc_static_metadata_refcounts[76], {{g_bytes + 801, 8}}},
- {&grpc_static_metadata_refcounts[77], {{g_bytes + 809, 17}}},
- {&grpc_static_metadata_refcounts[78], {{g_bytes + 826, 13}}},
- {&grpc_static_metadata_refcounts[79], {{g_bytes + 839, 8}}},
- {&grpc_static_metadata_refcounts[80], {{g_bytes + 847, 19}}},
- {&grpc_static_metadata_refcounts[81], {{g_bytes + 866, 13}}},
- {&grpc_static_metadata_refcounts[82], {{g_bytes + 879, 11}}},
- {&grpc_static_metadata_refcounts[83], {{g_bytes + 890, 4}}},
- {&grpc_static_metadata_refcounts[84], {{g_bytes + 894, 8}}},
- {&grpc_static_metadata_refcounts[85], {{g_bytes + 902, 12}}},
- {&grpc_static_metadata_refcounts[86], {{g_bytes + 914, 18}}},
- {&grpc_static_metadata_refcounts[87], {{g_bytes + 932, 19}}},
- {&grpc_static_metadata_refcounts[88], {{g_bytes + 951, 5}}},
- {&grpc_static_metadata_refcounts[89], {{g_bytes + 956, 7}}},
- {&grpc_static_metadata_refcounts[90], {{g_bytes + 963, 7}}},
- {&grpc_static_metadata_refcounts[91], {{g_bytes + 970, 11}}},
- {&grpc_static_metadata_refcounts[92], {{g_bytes + 981, 6}}},
- {&grpc_static_metadata_refcounts[93], {{g_bytes + 987, 10}}},
- {&grpc_static_metadata_refcounts[94], {{g_bytes + 997, 25}}},
- {&grpc_static_metadata_refcounts[95], {{g_bytes + 1022, 17}}},
- {&grpc_static_metadata_refcounts[96], {{g_bytes + 1039, 4}}},
- {&grpc_static_metadata_refcounts[97], {{g_bytes + 1043, 3}}},
- {&grpc_static_metadata_refcounts[98], {{g_bytes + 1046, 16}}},
- {&grpc_static_metadata_refcounts[99], {{g_bytes + 1062, 16}}},
- {&grpc_static_metadata_refcounts[100], {{g_bytes + 1078, 13}}},
- {&grpc_static_metadata_refcounts[101], {{g_bytes + 1091, 12}}},
- {&grpc_static_metadata_refcounts[102], {{g_bytes + 1103, 21}}},
+ {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 7}}},
+ {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}},
+ {&grpc_static_metadata_refcounts[31], {{g_bytes + 441, 11}}},
+ {&grpc_static_metadata_refcounts[32], {{g_bytes + 452, 1}}},
+ {&grpc_static_metadata_refcounts[33], {{g_bytes + 453, 1}}},
+ {&grpc_static_metadata_refcounts[34], {{g_bytes + 454, 1}}},
+ {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}},
+ {&grpc_static_metadata_refcounts[36], {{g_bytes + 463, 8}}},
+ {&grpc_static_metadata_refcounts[37], {{g_bytes + 471, 16}}},
+ {&grpc_static_metadata_refcounts[38], {{g_bytes + 487, 4}}},
+ {&grpc_static_metadata_refcounts[39], {{g_bytes + 491, 3}}},
+ {&grpc_static_metadata_refcounts[40], {{g_bytes + 494, 3}}},
+ {&grpc_static_metadata_refcounts[41], {{g_bytes + 497, 4}}},
+ {&grpc_static_metadata_refcounts[42], {{g_bytes + 501, 5}}},
+ {&grpc_static_metadata_refcounts[43], {{g_bytes + 506, 4}}},
+ {&grpc_static_metadata_refcounts[44], {{g_bytes + 510, 3}}},
+ {&grpc_static_metadata_refcounts[45], {{g_bytes + 513, 3}}},
+ {&grpc_static_metadata_refcounts[46], {{g_bytes + 516, 1}}},
+ {&grpc_static_metadata_refcounts[47], {{g_bytes + 517, 11}}},
+ {&grpc_static_metadata_refcounts[48], {{g_bytes + 528, 3}}},
+ {&grpc_static_metadata_refcounts[49], {{g_bytes + 531, 3}}},
+ {&grpc_static_metadata_refcounts[50], {{g_bytes + 534, 3}}},
+ {&grpc_static_metadata_refcounts[51], {{g_bytes + 537, 3}}},
+ {&grpc_static_metadata_refcounts[52], {{g_bytes + 540, 3}}},
+ {&grpc_static_metadata_refcounts[53], {{g_bytes + 543, 14}}},
+ {&grpc_static_metadata_refcounts[54], {{g_bytes + 557, 13}}},
+ {&grpc_static_metadata_refcounts[55], {{g_bytes + 570, 15}}},
+ {&grpc_static_metadata_refcounts[56], {{g_bytes + 585, 13}}},
+ {&grpc_static_metadata_refcounts[57], {{g_bytes + 598, 6}}},
+ {&grpc_static_metadata_refcounts[58], {{g_bytes + 604, 27}}},
+ {&grpc_static_metadata_refcounts[59], {{g_bytes + 631, 3}}},
+ {&grpc_static_metadata_refcounts[60], {{g_bytes + 634, 5}}},
+ {&grpc_static_metadata_refcounts[61], {{g_bytes + 639, 13}}},
+ {&grpc_static_metadata_refcounts[62], {{g_bytes + 652, 13}}},
+ {&grpc_static_metadata_refcounts[63], {{g_bytes + 665, 19}}},
+ {&grpc_static_metadata_refcounts[64], {{g_bytes + 684, 16}}},
+ {&grpc_static_metadata_refcounts[65], {{g_bytes + 700, 14}}},
+ {&grpc_static_metadata_refcounts[66], {{g_bytes + 714, 16}}},
+ {&grpc_static_metadata_refcounts[67], {{g_bytes + 730, 13}}},
+ {&grpc_static_metadata_refcounts[68], {{g_bytes + 743, 6}}},
+ {&grpc_static_metadata_refcounts[69], {{g_bytes + 749, 4}}},
+ {&grpc_static_metadata_refcounts[70], {{g_bytes + 753, 4}}},
+ {&grpc_static_metadata_refcounts[71], {{g_bytes + 757, 6}}},
+ {&grpc_static_metadata_refcounts[72], {{g_bytes + 763, 7}}},
+ {&grpc_static_metadata_refcounts[73], {{g_bytes + 770, 4}}},
+ {&grpc_static_metadata_refcounts[74], {{g_bytes + 774, 8}}},
+ {&grpc_static_metadata_refcounts[75], {{g_bytes + 782, 17}}},
+ {&grpc_static_metadata_refcounts[76], {{g_bytes + 799, 13}}},
+ {&grpc_static_metadata_refcounts[77], {{g_bytes + 812, 8}}},
+ {&grpc_static_metadata_refcounts[78], {{g_bytes + 820, 19}}},
+ {&grpc_static_metadata_refcounts[79], {{g_bytes + 839, 13}}},
+ {&grpc_static_metadata_refcounts[80], {{g_bytes + 852, 11}}},
+ {&grpc_static_metadata_refcounts[81], {{g_bytes + 863, 4}}},
+ {&grpc_static_metadata_refcounts[82], {{g_bytes + 867, 8}}},
+ {&grpc_static_metadata_refcounts[83], {{g_bytes + 875, 12}}},
+ {&grpc_static_metadata_refcounts[84], {{g_bytes + 887, 18}}},
+ {&grpc_static_metadata_refcounts[85], {{g_bytes + 905, 19}}},
+ {&grpc_static_metadata_refcounts[86], {{g_bytes + 924, 5}}},
+ {&grpc_static_metadata_refcounts[87], {{g_bytes + 929, 7}}},
+ {&grpc_static_metadata_refcounts[88], {{g_bytes + 936, 7}}},
+ {&grpc_static_metadata_refcounts[89], {{g_bytes + 943, 11}}},
+ {&grpc_static_metadata_refcounts[90], {{g_bytes + 954, 6}}},
+ {&grpc_static_metadata_refcounts[91], {{g_bytes + 960, 10}}},
+ {&grpc_static_metadata_refcounts[92], {{g_bytes + 970, 25}}},
+ {&grpc_static_metadata_refcounts[93], {{g_bytes + 995, 17}}},
+ {&grpc_static_metadata_refcounts[94], {{g_bytes + 1012, 4}}},
+ {&grpc_static_metadata_refcounts[95], {{g_bytes + 1016, 3}}},
+ {&grpc_static_metadata_refcounts[96], {{g_bytes + 1019, 16}}},
+ {&grpc_static_metadata_refcounts[97], {{g_bytes + 1035, 16}}},
+ {&grpc_static_metadata_refcounts[98], {{g_bytes + 1051, 13}}},
+ {&grpc_static_metadata_refcounts[99], {{g_bytes + 1064, 12}}},
+ {&grpc_static_metadata_refcounts[100], {{g_bytes + 1076, 21}}},
};
uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
@@ -333,16 +328,16 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4};
static const int8_t elems_r[] = {
- 11, 9, -3, 0, 10, 25, -77, 26, 0, 11, -7, 0, 0, 0, 21, 14, 1,
- 0, 0, 33, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, -56, 0, -36, -61, -60, -39, -63, -64, 0, 36, 35, 34, 33,
- 34, 33, 32, 31, 31, 30, 29, 28, 27, 26, 26, 25, 25, 24, 23, 22, 21,
- 20, 19, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 12, 11, 0};
+ 13, 2, 1, 0, 15, 4, 0, 21, 0, 23, -3, 0, 0, 0, 10, 19, -4,
+ 0, 0, 1, 10, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -52, 0, -55, -36, -57, -58, -58, -58, 0, 40, 39, 38, 37, 36, 35,
+ 34, 33, 32, 31, 30, 29, 28, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19,
+ 18, 17, 16, 15, 18, 17, 16, 15, 14, 13, 12, 11, 11, 0};
static uint32_t elems_phash(uint32_t i) {
- i -= 48;
- uint32_t x = i % 101;
- uint32_t y = i / 101;
+ i -= 46;
+ uint32_t x = i % 99;
+ uint32_t y = i / 99;
uint32_t h = x;
if (y < GPR_ARRAY_SIZE(elems_r)) {
uint32_t delta = (uint32_t)elems_r[y];
@@ -352,31 +347,31 @@ static uint32_t elems_phash(uint32_t i) {
}
static const uint16_t elem_keys[] = {
- 1065, 1066, 1067, 256, 257, 258, 259, 260, 1671, 149, 150, 48,
- 49, 455, 456, 457, 962, 963, 964, 1568, 1683, 1684, 753, 754,
- 1465, 553, 755, 2083, 2186, 5688, 5997, 1580, 1581, 6100, 6306, 6409,
- 6512, 6615, 6718, 6821, 1481, 1704, 6924, 7027, 7130, 7233, 1980, 7336,
- 7439, 7542, 7645, 7748, 7851, 5894, 7954, 8057, 6203, 8160, 8263, 8366,
- 8469, 8572, 8675, 8778, 1129, 1130, 1131, 1132, 8881, 8984, 9087, 9190,
- 9293, 9396, 9499, 9602, 9705, 9808, 9911, 332, 10014, 10117, 0, 0,
- 0, 1748, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 247,
- 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0};
+ 1039, 1040, 145, 146, 541, 1639, 1045, 250, 251, 252, 253, 254,
+ 1646, 46, 47, 1437, 1942, 1651, 445, 446, 447, 739, 740, 741,
+ 938, 939, 1538, 2043, 2144, 1451, 944, 5376, 5578, 1545, 5780, 5881,
+ 1670, 5982, 1550, 6083, 6184, 6285, 6386, 6487, 6588, 6689, 6790, 6891,
+ 6992, 7093, 7194, 7295, 7396, 5679, 7497, 7598, 7699, 7800, 7901, 8002,
+ 8103, 8204, 8305, 8406, 8507, 8608, 8709, 8810, 1107, 1108, 1109, 1110,
+ 8911, 9012, 9113, 9214, 9315, 9416, 9517, 9618, 1714, 9719, 0, 326,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 241, 242, 0, 0, 0, 0, 0, 0, 139, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
static const uint8_t elem_idxs[] = {
- 76, 79, 77, 19, 20, 21, 22, 23, 25, 15, 16, 17, 18, 11,
- 12, 13, 3, 4, 5, 38, 83, 84, 0, 1, 43, 6, 2, 50,
- 57, 24, 28, 36, 37, 29, 31, 32, 33, 34, 35, 39, 7, 26,
- 40, 41, 42, 44, 72, 45, 46, 47, 48, 49, 51, 27, 52, 53,
- 30, 54, 55, 56, 58, 59, 60, 61, 78, 80, 81, 82, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 73, 14, 74, 75, 255, 255,
- 255, 85, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10};
+ 77, 79, 15, 16, 6, 25, 76, 19, 20, 21, 22, 23, 84, 17,
+ 18, 43, 72, 83, 11, 12, 13, 0, 1, 2, 5, 4, 38, 50,
+ 57, 7, 3, 24, 27, 37, 29, 30, 26, 31, 36, 32, 33, 34,
+ 35, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 28, 51, 52,
+ 53, 54, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 78, 80,
+ 81, 82, 66, 67, 68, 69, 70, 71, 73, 74, 85, 75, 255, 14,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 9, 10, 255, 255, 255, 255, 255, 255, 8};
grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) {
if (a == -1 || b == -1) return GRPC_MDNULL;
- uint32_t k = (uint32_t)(a * 103 + b);
+ uint32_t k = (uint32_t)(a * 101 + b);
uint32_t h = elems_phash(k);
return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k &&
elem_idxs[h] != 255
@@ -387,177 +382,177 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) {
grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {
{{&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}},
- {&grpc_static_metadata_refcounts[32], {{g_bytes + 468, 1}}}},
+ {&grpc_static_metadata_refcounts[32], {{g_bytes + 452, 1}}}},
{{&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}},
- {&grpc_static_metadata_refcounts[33], {{g_bytes + 469, 1}}}},
+ {&grpc_static_metadata_refcounts[33], {{g_bytes + 453, 1}}}},
{{&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}},
- {&grpc_static_metadata_refcounts[34], {{g_bytes + 470, 1}}}},
+ {&grpc_static_metadata_refcounts[34], {{g_bytes + 454, 1}}}},
{{&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}},
- {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}}},
+ {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}}},
{{&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}},
- {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}}},
+ {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}}},
{{&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}},
- {&grpc_static_metadata_refcounts[37], {{g_bytes + 483, 7}}}},
+ {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 7}}}},
{{&grpc_static_metadata_refcounts[5], {{g_bytes + 36, 2}}},
- {&grpc_static_metadata_refcounts[38], {{g_bytes + 490, 8}}}},
+ {&grpc_static_metadata_refcounts[36], {{g_bytes + 463, 8}}}},
{{&grpc_static_metadata_refcounts[14], {{g_bytes + 158, 12}}},
- {&grpc_static_metadata_refcounts[39], {{g_bytes + 498, 16}}}},
+ {&grpc_static_metadata_refcounts[37], {{g_bytes + 471, 16}}}},
{{&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}},
- {&grpc_static_metadata_refcounts[40], {{g_bytes + 514, 4}}}},
+ {&grpc_static_metadata_refcounts[38], {{g_bytes + 487, 4}}}},
{{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}},
- {&grpc_static_metadata_refcounts[41], {{g_bytes + 518, 3}}}},
+ {&grpc_static_metadata_refcounts[39], {{g_bytes + 491, 3}}}},
{{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}},
- {&grpc_static_metadata_refcounts[42], {{g_bytes + 521, 3}}}},
+ {&grpc_static_metadata_refcounts[40], {{g_bytes + 494, 3}}}},
{{&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}},
- {&grpc_static_metadata_refcounts[43], {{g_bytes + 524, 4}}}},
+ {&grpc_static_metadata_refcounts[41], {{g_bytes + 497, 4}}}},
{{&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}},
- {&grpc_static_metadata_refcounts[44], {{g_bytes + 528, 5}}}},
+ {&grpc_static_metadata_refcounts[42], {{g_bytes + 501, 5}}}},
{{&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}},
- {&grpc_static_metadata_refcounts[45], {{g_bytes + 533, 4}}}},
+ {&grpc_static_metadata_refcounts[43], {{g_bytes + 506, 4}}}},
{{&grpc_static_metadata_refcounts[3], {{g_bytes + 19, 10}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
{{&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}},
- {&grpc_static_metadata_refcounts[46], {{g_bytes + 537, 3}}}},
+ {&grpc_static_metadata_refcounts[44], {{g_bytes + 510, 3}}}},
{{&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}},
- {&grpc_static_metadata_refcounts[47], {{g_bytes + 540, 3}}}},
+ {&grpc_static_metadata_refcounts[45], {{g_bytes + 513, 3}}}},
{{&grpc_static_metadata_refcounts[0], {{g_bytes + 0, 5}}},
- {&grpc_static_metadata_refcounts[48], {{g_bytes + 543, 1}}}},
+ {&grpc_static_metadata_refcounts[46], {{g_bytes + 516, 1}}}},
{{&grpc_static_metadata_refcounts[0], {{g_bytes + 0, 5}}},
- {&grpc_static_metadata_refcounts[49], {{g_bytes + 544, 11}}}},
+ {&grpc_static_metadata_refcounts[47], {{g_bytes + 517, 11}}}},
{{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}},
- {&grpc_static_metadata_refcounts[50], {{g_bytes + 555, 3}}}},
+ {&grpc_static_metadata_refcounts[48], {{g_bytes + 528, 3}}}},
{{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}},
- {&grpc_static_metadata_refcounts[51], {{g_bytes + 558, 3}}}},
+ {&grpc_static_metadata_refcounts[49], {{g_bytes + 531, 3}}}},
{{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}},
- {&grpc_static_metadata_refcounts[52], {{g_bytes + 561, 3}}}},
+ {&grpc_static_metadata_refcounts[50], {{g_bytes + 534, 3}}}},
{{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}},
- {&grpc_static_metadata_refcounts[53], {{g_bytes + 564, 3}}}},
+ {&grpc_static_metadata_refcounts[51], {{g_bytes + 537, 3}}}},
{{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}},
- {&grpc_static_metadata_refcounts[54], {{g_bytes + 567, 3}}}},
- {{&grpc_static_metadata_refcounts[55], {{g_bytes + 570, 14}}},
+ {&grpc_static_metadata_refcounts[52], {{g_bytes + 540, 3}}}},
+ {{&grpc_static_metadata_refcounts[53], {{g_bytes + 543, 14}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
{{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
{{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}},
- {&grpc_static_metadata_refcounts[56], {{g_bytes + 584, 13}}}},
- {{&grpc_static_metadata_refcounts[57], {{g_bytes + 597, 15}}},
+ {&grpc_static_metadata_refcounts[54], {{g_bytes + 557, 13}}}},
+ {{&grpc_static_metadata_refcounts[55], {{g_bytes + 570, 15}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[58], {{g_bytes + 612, 13}}},
+ {{&grpc_static_metadata_refcounts[56], {{g_bytes + 585, 13}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[59], {{g_bytes + 625, 6}}},
+ {{&grpc_static_metadata_refcounts[57], {{g_bytes + 598, 6}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[60], {{g_bytes + 631, 27}}},
+ {{&grpc_static_metadata_refcounts[58], {{g_bytes + 604, 27}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[61], {{g_bytes + 658, 3}}},
+ {{&grpc_static_metadata_refcounts[59], {{g_bytes + 631, 3}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[62], {{g_bytes + 661, 5}}},
+ {{&grpc_static_metadata_refcounts[60], {{g_bytes + 634, 5}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[63], {{g_bytes + 666, 13}}},
+ {{&grpc_static_metadata_refcounts[61], {{g_bytes + 639, 13}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[64], {{g_bytes + 679, 13}}},
+ {{&grpc_static_metadata_refcounts[62], {{g_bytes + 652, 13}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[65], {{g_bytes + 692, 19}}},
+ {{&grpc_static_metadata_refcounts[63], {{g_bytes + 665, 19}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
{{&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}},
- {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}}},
+ {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}}},
{{&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}},
- {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}}},
+ {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}}},
{{&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[66], {{g_bytes + 711, 16}}},
+ {{&grpc_static_metadata_refcounts[64], {{g_bytes + 684, 16}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[67], {{g_bytes + 727, 14}}},
+ {{&grpc_static_metadata_refcounts[65], {{g_bytes + 700, 14}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[68], {{g_bytes + 741, 16}}},
+ {{&grpc_static_metadata_refcounts[66], {{g_bytes + 714, 16}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[69], {{g_bytes + 757, 13}}},
+ {{&grpc_static_metadata_refcounts[67], {{g_bytes + 730, 13}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
{{&grpc_static_metadata_refcounts[14], {{g_bytes + 158, 12}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[70], {{g_bytes + 770, 6}}},
+ {{&grpc_static_metadata_refcounts[68], {{g_bytes + 743, 6}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[71], {{g_bytes + 776, 4}}},
+ {{&grpc_static_metadata_refcounts[69], {{g_bytes + 749, 4}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[72], {{g_bytes + 780, 4}}},
+ {{&grpc_static_metadata_refcounts[70], {{g_bytes + 753, 4}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[73], {{g_bytes + 784, 6}}},
+ {{&grpc_static_metadata_refcounts[71], {{g_bytes + 757, 6}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[74], {{g_bytes + 790, 7}}},
+ {{&grpc_static_metadata_refcounts[72], {{g_bytes + 763, 7}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[75], {{g_bytes + 797, 4}}},
+ {{&grpc_static_metadata_refcounts[73], {{g_bytes + 770, 4}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
{{&grpc_static_metadata_refcounts[20], {{g_bytes + 278, 4}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[76], {{g_bytes + 801, 8}}},
+ {{&grpc_static_metadata_refcounts[74], {{g_bytes + 774, 8}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[77], {{g_bytes + 809, 17}}},
+ {{&grpc_static_metadata_refcounts[75], {{g_bytes + 782, 17}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[78], {{g_bytes + 826, 13}}},
+ {{&grpc_static_metadata_refcounts[76], {{g_bytes + 799, 13}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[79], {{g_bytes + 839, 8}}},
+ {{&grpc_static_metadata_refcounts[77], {{g_bytes + 812, 8}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[80], {{g_bytes + 847, 19}}},
+ {{&grpc_static_metadata_refcounts[78], {{g_bytes + 820, 19}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[81], {{g_bytes + 866, 13}}},
+ {{&grpc_static_metadata_refcounts[79], {{g_bytes + 839, 13}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
{{&grpc_static_metadata_refcounts[21], {{g_bytes + 282, 8}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[82], {{g_bytes + 879, 11}}},
+ {{&grpc_static_metadata_refcounts[80], {{g_bytes + 852, 11}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[83], {{g_bytes + 890, 4}}},
+ {{&grpc_static_metadata_refcounts[81], {{g_bytes + 863, 4}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[84], {{g_bytes + 894, 8}}},
+ {{&grpc_static_metadata_refcounts[82], {{g_bytes + 867, 8}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[85], {{g_bytes + 902, 12}}},
+ {{&grpc_static_metadata_refcounts[83], {{g_bytes + 875, 12}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[86], {{g_bytes + 914, 18}}},
+ {{&grpc_static_metadata_refcounts[84], {{g_bytes + 887, 18}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[87], {{g_bytes + 932, 19}}},
+ {{&grpc_static_metadata_refcounts[85], {{g_bytes + 905, 19}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[88], {{g_bytes + 951, 5}}},
+ {{&grpc_static_metadata_refcounts[86], {{g_bytes + 924, 5}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[89], {{g_bytes + 956, 7}}},
+ {{&grpc_static_metadata_refcounts[87], {{g_bytes + 929, 7}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[90], {{g_bytes + 963, 7}}},
+ {{&grpc_static_metadata_refcounts[88], {{g_bytes + 936, 7}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[91], {{g_bytes + 970, 11}}},
+ {{&grpc_static_metadata_refcounts[89], {{g_bytes + 943, 11}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[92], {{g_bytes + 981, 6}}},
+ {{&grpc_static_metadata_refcounts[90], {{g_bytes + 954, 6}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[93], {{g_bytes + 987, 10}}},
+ {{&grpc_static_metadata_refcounts[91], {{g_bytes + 960, 10}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[94], {{g_bytes + 997, 25}}},
+ {{&grpc_static_metadata_refcounts[92], {{g_bytes + 970, 25}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[95], {{g_bytes + 1022, 17}}},
+ {{&grpc_static_metadata_refcounts[93], {{g_bytes + 995, 17}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
{{&grpc_static_metadata_refcounts[19], {{g_bytes + 268, 10}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[96], {{g_bytes + 1039, 4}}},
+ {{&grpc_static_metadata_refcounts[94], {{g_bytes + 1012, 4}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[97], {{g_bytes + 1043, 3}}},
+ {{&grpc_static_metadata_refcounts[95], {{g_bytes + 1016, 3}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
- {{&grpc_static_metadata_refcounts[98], {{g_bytes + 1046, 16}}},
+ {{&grpc_static_metadata_refcounts[96], {{g_bytes + 1019, 16}}},
{&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}},
{{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}},
- {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}}},
+ {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}}},
{{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}},
- {&grpc_static_metadata_refcounts[37], {{g_bytes + 483, 7}}}},
+ {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 7}}}},
{{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}},
- {&grpc_static_metadata_refcounts[99], {{g_bytes + 1062, 16}}}},
+ {&grpc_static_metadata_refcounts[97], {{g_bytes + 1035, 16}}}},
{{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}},
- {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}}},
+ {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}}},
{{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}},
- {&grpc_static_metadata_refcounts[100], {{g_bytes + 1078, 13}}}},
+ {&grpc_static_metadata_refcounts[98], {{g_bytes + 1051, 13}}}},
{{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}},
- {&grpc_static_metadata_refcounts[101], {{g_bytes + 1091, 12}}}},
+ {&grpc_static_metadata_refcounts[99], {{g_bytes + 1064, 12}}}},
{{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}},
- {&grpc_static_metadata_refcounts[102], {{g_bytes + 1103, 21}}}},
+ {&grpc_static_metadata_refcounts[100], {{g_bytes + 1076, 21}}}},
{{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}},
- {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}}},
+ {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}}},
{{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}},
- {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}}},
+ {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}}},
{{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}},
- {&grpc_static_metadata_refcounts[100], {{g_bytes + 1078, 13}}}},
+ {&grpc_static_metadata_refcounts[98], {{g_bytes + 1051, 13}}}},
};
bool grpc_static_callout_is_default[GRPC_BATCH_CALLOUTS_COUNT] = {
true, // :path
diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h
index 21dc7a3d3f..8ce9b21bc1 100644
--- a/src/core/lib/transport/static_metadata.h
+++ b/src/core/lib/transport/static_metadata.h
@@ -20,7 +20,7 @@
* To make changes to this file, change
* tools/codegen/core/gen_static_metadata.py, and then re-run it.
*
- * See metadata.h for an explanation of the interface here, and metadata.c for
+ * See metadata.h for an explanation of the interface here, and metadata.cc for
* an explanation of what's going on.
*/
@@ -29,7 +29,7 @@
#include "src/core/lib/transport/metadata.h"
-#define GRPC_STATIC_MDSTR_COUNT 103
+#define GRPC_STATIC_MDSTR_COUNT 101
extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
/* ":path" */
#define GRPC_MDSTR_PATH (grpc_static_slice_table[0])
@@ -93,10 +93,10 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
/* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */
#define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \
(grpc_static_slice_table[28])
-/* "message/deflate" */
-#define GRPC_MDSTR_MESSAGE_SLASH_DEFLATE (grpc_static_slice_table[29])
-/* "message/gzip" */
-#define GRPC_MDSTR_MESSAGE_SLASH_GZIP (grpc_static_slice_table[30])
+/* "deflate" */
+#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[29])
+/* "gzip" */
+#define GRPC_MDSTR_GZIP (grpc_static_slice_table[30])
/* "stream/gzip" */
#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[31])
/* "0" */
@@ -107,141 +107,137 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
#define GRPC_MDSTR_2 (grpc_static_slice_table[34])
/* "identity" */
#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[35])
-/* "gzip" */
-#define GRPC_MDSTR_GZIP (grpc_static_slice_table[36])
-/* "deflate" */
-#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[37])
/* "trailers" */
-#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[38])
+#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[36])
/* "application/grpc" */
-#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[39])
+#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[37])
/* "POST" */
-#define GRPC_MDSTR_POST (grpc_static_slice_table[40])
+#define GRPC_MDSTR_POST (grpc_static_slice_table[38])
/* "200" */
-#define GRPC_MDSTR_200 (grpc_static_slice_table[41])
+#define GRPC_MDSTR_200 (grpc_static_slice_table[39])
/* "404" */
-#define GRPC_MDSTR_404 (grpc_static_slice_table[42])
+#define GRPC_MDSTR_404 (grpc_static_slice_table[40])
/* "http" */
-#define GRPC_MDSTR_HTTP (grpc_static_slice_table[43])
+#define GRPC_MDSTR_HTTP (grpc_static_slice_table[41])
/* "https" */
-#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[44])
+#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[42])
/* "grpc" */
-#define GRPC_MDSTR_GRPC (grpc_static_slice_table[45])
+#define GRPC_MDSTR_GRPC (grpc_static_slice_table[43])
/* "GET" */
-#define GRPC_MDSTR_GET (grpc_static_slice_table[46])
+#define GRPC_MDSTR_GET (grpc_static_slice_table[44])
/* "PUT" */
-#define GRPC_MDSTR_PUT (grpc_static_slice_table[47])
+#define GRPC_MDSTR_PUT (grpc_static_slice_table[45])
/* "/" */
-#define GRPC_MDSTR_SLASH (grpc_static_slice_table[48])
+#define GRPC_MDSTR_SLASH (grpc_static_slice_table[46])
/* "/index.html" */
-#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[49])
+#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[47])
/* "204" */
-#define GRPC_MDSTR_204 (grpc_static_slice_table[50])
+#define GRPC_MDSTR_204 (grpc_static_slice_table[48])
/* "206" */
-#define GRPC_MDSTR_206 (grpc_static_slice_table[51])
+#define GRPC_MDSTR_206 (grpc_static_slice_table[49])
/* "304" */
-#define GRPC_MDSTR_304 (grpc_static_slice_table[52])
+#define GRPC_MDSTR_304 (grpc_static_slice_table[50])
/* "400" */
-#define GRPC_MDSTR_400 (grpc_static_slice_table[53])
+#define GRPC_MDSTR_400 (grpc_static_slice_table[51])
/* "500" */
-#define GRPC_MDSTR_500 (grpc_static_slice_table[54])
+#define GRPC_MDSTR_500 (grpc_static_slice_table[52])
/* "accept-charset" */
-#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[55])
+#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[53])
/* "gzip, deflate" */
-#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[56])
+#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[54])
/* "accept-language" */
-#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[57])
+#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[55])
/* "accept-ranges" */
-#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[58])
+#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[56])
/* "accept" */
-#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[59])
+#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[57])
/* "access-control-allow-origin" */
-#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[60])
+#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[58])
/* "age" */
-#define GRPC_MDSTR_AGE (grpc_static_slice_table[61])
+#define GRPC_MDSTR_AGE (grpc_static_slice_table[59])
/* "allow" */
-#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[62])
+#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[60])
/* "authorization" */
-#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[63])
+#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[61])
/* "cache-control" */
-#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[64])
+#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[62])
/* "content-disposition" */
-#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[65])
+#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[63])
/* "content-language" */
-#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[66])
+#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[64])
/* "content-length" */
-#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[67])
+#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[65])
/* "content-location" */
-#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[68])
+#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[66])
/* "content-range" */
-#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[69])
+#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[67])
/* "cookie" */
-#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[70])
+#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[68])
/* "date" */
-#define GRPC_MDSTR_DATE (grpc_static_slice_table[71])
+#define GRPC_MDSTR_DATE (grpc_static_slice_table[69])
/* "etag" */
-#define GRPC_MDSTR_ETAG (grpc_static_slice_table[72])
+#define GRPC_MDSTR_ETAG (grpc_static_slice_table[70])
/* "expect" */
-#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[73])
+#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[71])
/* "expires" */
-#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[74])
+#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[72])
/* "from" */
-#define GRPC_MDSTR_FROM (grpc_static_slice_table[75])
+#define GRPC_MDSTR_FROM (grpc_static_slice_table[73])
/* "if-match" */
-#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[76])
+#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[74])
/* "if-modified-since" */
-#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[77])
+#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[75])
/* "if-none-match" */
-#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[78])
+#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[76])
/* "if-range" */
-#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[79])
+#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[77])
/* "if-unmodified-since" */
-#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[80])
+#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[78])
/* "last-modified" */
-#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[81])
+#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[79])
/* "lb-cost-bin" */
-#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[82])
+#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[80])
/* "link" */
-#define GRPC_MDSTR_LINK (grpc_static_slice_table[83])
+#define GRPC_MDSTR_LINK (grpc_static_slice_table[81])
/* "location" */
-#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[84])
+#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[82])
/* "max-forwards" */
-#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[85])
+#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[83])
/* "proxy-authenticate" */
-#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[86])
+#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[84])
/* "proxy-authorization" */
-#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[87])
+#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[85])
/* "range" */
-#define GRPC_MDSTR_RANGE (grpc_static_slice_table[88])
+#define GRPC_MDSTR_RANGE (grpc_static_slice_table[86])
/* "referer" */
-#define GRPC_MDSTR_REFERER (grpc_static_slice_table[89])
+#define GRPC_MDSTR_REFERER (grpc_static_slice_table[87])
/* "refresh" */
-#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[90])
+#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[88])
/* "retry-after" */
-#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[91])
+#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[89])
/* "server" */
-#define GRPC_MDSTR_SERVER (grpc_static_slice_table[92])
+#define GRPC_MDSTR_SERVER (grpc_static_slice_table[90])
/* "set-cookie" */
-#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[93])
+#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[91])
/* "strict-transport-security" */
-#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[94])
+#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[92])
/* "transfer-encoding" */
-#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[95])
+#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[93])
/* "vary" */
-#define GRPC_MDSTR_VARY (grpc_static_slice_table[96])
+#define GRPC_MDSTR_VARY (grpc_static_slice_table[94])
/* "via" */
-#define GRPC_MDSTR_VIA (grpc_static_slice_table[97])
+#define GRPC_MDSTR_VIA (grpc_static_slice_table[95])
/* "www-authenticate" */
-#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[98])
+#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[96])
/* "identity,deflate" */
-#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[99])
+#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[97])
/* "identity,gzip" */
-#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[100])
+#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[98])
/* "deflate,gzip" */
-#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[101])
+#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[99])
/* "identity,deflate,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
- (grpc_static_slice_table[102])
+ (grpc_static_slice_table[100])
extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable;
extern grpc_slice_refcount
@@ -590,5 +586,4 @@ extern const uint8_t grpc_static_accept_stream_encoding_metadata[4];
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table \
[grpc_static_accept_stream_encoding_metadata[(algs)]], \
GRPC_MDELEM_STORAGE_STATIC))
-
#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */
diff --git a/src/core/tsi/alts_transport_security.cc b/src/core/tsi/alts_transport_security.cc
index ddd75cbd02..1654d893d0 100644
--- a/src/core/tsi/alts_transport_security.cc
+++ b/src/core/tsi/alts_transport_security.cc
@@ -26,17 +26,36 @@ alts_shared_resource* alts_get_shared_resource(void) {
return &g_alts_resource;
}
+static void grpc_tsi_alts_wait_for_cq_drain() {
+ gpr_mu_lock(&g_alts_resource.mu);
+ while (!g_alts_resource.is_cq_drained) {
+ gpr_cv_wait(&g_alts_resource.cv, &g_alts_resource.mu,
+ gpr_inf_future(GPR_CLOCK_REALTIME));
+ }
+ gpr_mu_unlock(&g_alts_resource.mu);
+}
+
+void grpc_tsi_alts_signal_for_cq_destroy() {
+ gpr_mu_lock(&g_alts_resource.mu);
+ g_alts_resource.is_cq_drained = true;
+ gpr_cv_signal(&g_alts_resource.cv);
+ gpr_mu_unlock(&g_alts_resource.mu);
+}
+
void grpc_tsi_alts_init() {
memset(&g_alts_resource, 0, sizeof(alts_shared_resource));
gpr_mu_init(&g_alts_resource.mu);
+ gpr_cv_init(&g_alts_resource.cv);
}
void grpc_tsi_alts_shutdown() {
- gpr_mu_destroy(&g_alts_resource.mu);
- if (g_alts_resource.cq == nullptr) {
- return;
+ if (g_alts_resource.cq != nullptr) {
+ grpc_completion_queue_shutdown(g_alts_resource.cq);
+ grpc_tsi_alts_wait_for_cq_drain();
+ grpc_completion_queue_destroy(g_alts_resource.cq);
+ grpc_channel_destroy(g_alts_resource.channel);
+ gpr_thd_join(g_alts_resource.thread_id);
}
- grpc_completion_queue_destroy(g_alts_resource.cq);
- grpc_channel_destroy(g_alts_resource.channel);
- gpr_thd_join(g_alts_resource.thread_id);
+ gpr_cv_destroy(&g_alts_resource.cv);
+ gpr_mu_destroy(&g_alts_resource.mu);
}
diff --git a/src/core/tsi/alts_transport_security.h b/src/core/tsi/alts_transport_security.h
index c90e31478e..5d693d04af 100644
--- a/src/core/tsi/alts_transport_security.h
+++ b/src/core/tsi/alts_transport_security.h
@@ -28,10 +28,17 @@ typedef struct alts_shared_resource {
grpc_channel* channel;
grpc_completion_queue* cq;
gpr_mu mu;
+ gpr_cv cv;
+ bool is_cq_drained;
} alts_shared_resource;
/* This method returns the address of alts_shared_resource object shared by all
* TSI handshakes. */
alts_shared_resource* alts_get_shared_resource(void);
+/* This method signals the thread that invokes grpc_tsi_alts_shutdown() to
+ * continue with destroying the cq as a part of shutdown process. */
+
+void grpc_tsi_alts_signal_for_cq_destroy(void);
+
#endif /* GRPC_CORE_TSI_ALTS_TRANSPORT_SECURITY_H */
diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc
index dafa8081e9..5c90838440 100644
--- a/src/cpp/client/client_context.cc
+++ b/src/cpp/client/client_context.cc
@@ -96,6 +96,7 @@ void ClientContext::set_call(grpc_call* call,
void ClientContext::set_compression_algorithm(
grpc_compression_algorithm algorithm) {
+ compression_algorithm_ = algorithm;
const char* algorithm_name = nullptr;
if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc
index f0cbbdb86d..878be1c4b6 100644
--- a/src/cpp/server/server_context.cc
+++ b/src/cpp/server/server_context.cc
@@ -190,6 +190,7 @@ bool ServerContext::IsCancelled() const {
void ServerContext::set_compression_algorithm(
grpc_compression_algorithm algorithm) {
+ compression_algorithm_ = algorithm;
const char* algorithm_name = nullptr;
if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
diff --git a/src/csharp/Grpc.Core/Internal/NativeExtension.cs b/src/csharp/Grpc.Core/Internal/NativeExtension.cs
index 4cbde900d9..e514608c28 100644
--- a/src/csharp/Grpc.Core/Internal/NativeExtension.cs
+++ b/src/csharp/Grpc.Core/Internal/NativeExtension.cs
@@ -39,7 +39,7 @@ namespace Grpc.Core.Internal
{
this.nativeMethods = new NativeMethods(Load());
- // Redirect the the native logs as the very first thing after loading the native extension
+ // Redirect the native logs as the very first thing after loading the native extension
// to make sure we don't lose any logs.
NativeLogRedirector.Redirect(this.nativeMethods);
diff --git a/src/csharp/Grpc.Core/SourceLink.csproj.include b/src/csharp/Grpc.Core/SourceLink.csproj.include
index 02ae79fb89..0ec273f57e 100755
--- a/src/csharp/Grpc.Core/SourceLink.csproj.include
+++ b/src/csharp/Grpc.Core/SourceLink.csproj.include
@@ -13,7 +13,7 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="SourceLink.Embed.AllSourceFiles" Version="2.7.3" PrivateAssets="all" />
+ <PackageReference Include="SourceLink.Create.CommandLine" Version="2.7.6" PrivateAssets="all" />
</ItemGroup>
</Project>
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
index 10c31c455e..e83a8a7274 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
@@ -685,7 +685,7 @@ namespace Grpc.IntegrationTesting
private static Metadata CreateClientCompressionMetadata(bool compressed)
{
- var algorithmName = compressed ? "message/gzip" : "identity";
+ var algorithmName = compressed ? "gzip" : "identity";
return new Metadata
{
{ new Metadata.Entry(Metadata.CompressionRequestAlgorithmMetadataKey, algorithmName) }
diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
index d44e39f551..805e54b890 100644
--- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
+++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
@@ -46,10 +46,10 @@
hostConfig.compressAlgorithm = GRPC_COMPRESS_NONE;
break;
case GRPCCompressDeflate:
- hostConfig.compressAlgorithm = GRPC_COMPRESS_MESSAGE_DEFLATE;
+ hostConfig.compressAlgorithm = GRPC_COMPRESS_DEFLATE;
break;
case GRPCCompressGzip:
- hostConfig.compressAlgorithm = GRPC_COMPRESS_MESSAGE_GZIP;
+ hostConfig.compressAlgorithm = GRPC_COMPRESS_GZIP;
break;
default:
NSLog(@"Invalid compression algorithm");
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m
index 665943f181..ceae9607d7 100644
--- a/src/objective-c/GRPCClient/private/GRPCHost.m
+++ b/src/objective-c/GRPCClient/private/GRPCHost.m
@@ -225,8 +225,6 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil;
if (_responseSizeLimitOverride) {
args[@GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH] = _responseSizeLimitOverride;
}
- // Use 10000ms initial backoff time for correct behavior on bad/slow networks
- args[@GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS] = @10000;
if (_compressAlgorithm != GRPC_COMPRESS_NONE) {
args[@GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM] =
diff --git a/src/objective-c/ProtoRPC/ProtoMethod.m b/src/objective-c/ProtoRPC/ProtoMethod.m
index 4bef10af0e..ed585acfb9 100644
--- a/src/objective-c/ProtoRPC/ProtoMethod.m
+++ b/src/objective-c/ProtoRPC/ProtoMethod.m
@@ -18,7 +18,10 @@
#import "ProtoMethod.h"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-implementations"
@implementation ProtoMethod
+#pragma clang diagnostic pop
- (instancetype)initWithPackage:(NSString *)package
service:(NSString *)service
method:(NSString *)method {
diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m
index 1ecfcc5b0e..20b9d04cd8 100644
--- a/src/objective-c/ProtoRPC/ProtoRPC.m
+++ b/src/objective-c/ProtoRPC/ProtoRPC.m
@@ -42,7 +42,10 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
userInfo:info];
}
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-implementations"
@implementation ProtoRPC {
+#pragma clang diagnostic pop
id<GRXWriteable> _responseWriteable;
}
diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m
index be6089f0a4..611cee46bf 100644
--- a/src/objective-c/ProtoRPC/ProtoService.m
+++ b/src/objective-c/ProtoRPC/ProtoService.m
@@ -24,7 +24,10 @@
#import "ProtoMethod.h"
#import "ProtoRPC.h"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-implementations"
@implementation ProtoService {
+#pragma clang diagnostic pop
NSString *_host;
NSString *_packageName;
NSString *_serviceName;
diff --git a/src/objective-c/RxLibrary/GRXConcurrentWriteable.m b/src/objective-c/RxLibrary/GRXConcurrentWriteable.m
index 37bc975f87..c262313496 100644
--- a/src/objective-c/RxLibrary/GRXConcurrentWriteable.m
+++ b/src/objective-c/RxLibrary/GRXConcurrentWriteable.m
@@ -64,21 +64,25 @@
}
- (void)enqueueSuccessfulCompletion {
+ __weak typeof(self) weakSelf = self;
dispatch_async(_writeableQueue, ^{
- BOOL finished = NO;
- @synchronized (self) {
- if (!_alreadyFinished) {
- _alreadyFinished = YES;
- } else {
- finished = YES;
+ typeof(self) strongSelf = weakSelf;
+ if (strongSelf) {
+ BOOL finished = NO;
+ @synchronized (self) {
+ if (!strongSelf->_alreadyFinished) {
+ strongSelf->_alreadyFinished = YES;
+ } else {
+ finished = YES;
+ }
+ }
+ if (!finished) {
+ // Cancellation is now impossible. None of the other three blocks can run concurrently with
+ // this one.
+ [self.writeable writesFinishedWithError:nil];
+ // Skip any possible message to the wrapped writeable enqueued after this one.
+ self.writeable = nil;
}
- }
- if (!finished) {
- // Cancellation is now impossible. None of the other three blocks can run concurrently with
- // this one.
- [self.writeable writesFinishedWithError:nil];
- // Skip any possible message to the wrapped writeable enqueued after this one.
- self.writeable = nil;
}
});
}
diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
index 16940a4917..d91b5cf99e 100644
--- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
+++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
@@ -34,12 +34,12 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "test/core/end2end/data/ssl_test_data.h"
diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
index 09ee062596..28414b8e39 100644
--- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
+++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
@@ -23,7 +23,6 @@
#import <Cronet/Cronet.h>
#import <grpc/grpc.h>
#import <grpc/grpc_cronet.h>
-#import <grpc/support/host_port.h>
#import "test/core/end2end/cq_verifier.h"
#import "test/core/util/port.h"
@@ -32,6 +31,7 @@
#import "src/core/lib/channel/channel_args.h"
#import "src/core/lib/gpr/env.h"
+#import "src/core/lib/gpr/host_port.h"
#import "src/core/lib/gpr/string.h"
#import "src/core/lib/gpr/tmpfile.h"
#import "test/core/end2end/data/ssl_test_data.h"
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
index 30253fc20c..a4c0319553 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
@@ -557,8 +557,8 @@ cdef extern from "grpc/compression.h":
ctypedef enum grpc_compression_algorithm:
GRPC_COMPRESS_NONE
- GRPC_COMPRESS_MESSAGE_DEFLATE
- GRPC_COMPRESS_MESSAGE_GZIP
+ GRPC_COMPRESS_DEFLATE
+ GRPC_COMPRESS_GZIP
GRPC_COMPRESS_STREAM_GZIP
GRPC_COMPRESS_ALGORITHMS_COUNT
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
index 1bcea8d347..ecd991685f 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
@@ -112,8 +112,8 @@ class OperationType:
class CompressionAlgorithm:
none = GRPC_COMPRESS_NONE
- deflate = GRPC_COMPRESS_MESSAGE_DEFLATE
- gzip = GRPC_COMPRESS_MESSAGE_GZIP
+ deflate = GRPC_COMPRESS_DEFLATE
+ gzip = GRPC_COMPRESS_GZIP
class CompressionLevel:
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index 10d4454d7a..284c79b6ff 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -70,7 +70,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/channel/handshaker_registry.cc',
'src/core/lib/compression/compression.cc',
'src/core/lib/compression/compression_internal.cc',
- 'src/core/lib/compression/compression_ruby.cc',
'src/core/lib/compression/message_compress.cc',
'src/core/lib/compression/stream_compression.cc',
'src/core/lib/compression/stream_compression_gzip.cc',
diff --git a/src/python/grpcio_tests/tests/unit/_reconnect_test.py b/src/python/grpcio_tests/tests/unit/_reconnect_test.py
index 10aee9fb4f..8acba5a30b 100644
--- a/src/python/grpcio_tests/tests/unit/_reconnect_test.py
+++ b/src/python/grpcio_tests/tests/unit/_reconnect_test.py
@@ -14,6 +14,7 @@
"""Tests that a channel will reconnect if a connection is dropped"""
import socket
+import time
import unittest
import grpc
@@ -88,6 +89,7 @@ class ReconnectTest(unittest.TestCase):
multi_callable = channel.unary_unary(_UNARY_UNARY)
self.assertEqual(_RESPONSE, multi_callable(_REQUEST))
server.stop(None)
+ time.sleep(1)
server = grpc.server(server_pool, (handler,))
server.add_insecure_port('[::]:{}'.format(port))
server.start()
diff --git a/src/ruby/bin/apis/pubsub_demo.rb b/src/ruby/bin/apis/pubsub_demo.rb
index 6f155650ed..c565771d45 100755
--- a/src/ruby/bin/apis/pubsub_demo.rb
+++ b/src/ruby/bin/apis/pubsub_demo.rb
@@ -193,7 +193,7 @@ end
Args = Struct.new(:host, :port, :action, :project_id, :topic_name,
:sub_name)
-# validates the the command line options, returning them as an Arg.
+# validates the command line options, returning them as an Arg.
def parse_args
args = Args.new('pubsub-staging.googleapis.com',
443, 'list_some_topics', 'stoked-keyword-656')
diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c
index 1d11a53aa7..c56ac21645 100644
--- a/src/ruby/ext/grpc/rb_channel.c
+++ b/src/ruby/ext/grpc/rb_channel.c
@@ -362,8 +362,8 @@ static void wait_for_watch_state_op_complete_unblocking_func(void* arg) {
/* Wait until the channel's connectivity state becomes different from
* "last_state", or "deadline" expires.
- * Returns true if the the channel's connectivity state becomes
- * different from "last_state" within "deadline".
+ * Returns true if the channel's connectivity state becomes different
+ * from "last_state" within "deadline".
* Returns false if "deadline" expires before the channel's connectivity
* state changes from "last_state".
* */
diff --git a/src/ruby/ext/grpc/rb_compression_options.c b/src/ruby/ext/grpc/rb_compression_options.c
index a7e37099af..e24f20d2f9 100644
--- a/src/ruby/ext/grpc/rb_compression_options.c
+++ b/src/ruby/ext/grpc/rb_compression_options.c
@@ -23,7 +23,6 @@
#include "rb_grpc_imports.generated.h"
#include <grpc/compression.h>
-#include <grpc/compression_ruby.h>
#include <grpc/grpc.h>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/grpc_types.h>
@@ -175,7 +174,7 @@ void grpc_rb_compression_options_algorithm_name_to_value_internal(
/* Raise an error if the name isn't recognized as a compression algorithm by
* the algorithm parse function
* in GRPC core. */
- if (!grpc_compression_algorithm_parse_ruby(name_slice, algorithm_value)) {
+ if (!grpc_compression_algorithm_parse(name_slice, algorithm_value)) {
tmp_str = grpc_slice_to_c_string(name_slice);
rb_raise(rb_eNameError, "Invalid compression algorithm name: %s", tmp_str);
}
@@ -287,7 +286,7 @@ VALUE grpc_rb_compression_options_algorithm_value_to_name_internal(
grpc_compression_algorithm internal_value) {
char* algorithm_name = NULL;
- if (!grpc_compression_algorithm_name_ruby(internal_value, &algorithm_name)) {
+ if (!grpc_compression_algorithm_name(internal_value, &algorithm_name)) {
rb_raise(rb_eArgError, "Failed to convert algorithm value to name");
}
diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c
index 81221acc08..10bda74d18 100644
--- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c
+++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c
@@ -31,8 +31,6 @@ grpc_compression_options_init_type grpc_compression_options_init_import;
grpc_compression_options_enable_algorithm_type grpc_compression_options_enable_algorithm_import;
grpc_compression_options_disable_algorithm_type grpc_compression_options_disable_algorithm_import;
grpc_compression_options_is_algorithm_enabled_type grpc_compression_options_is_algorithm_enabled_import;
-grpc_compression_algorithm_parse_ruby_type grpc_compression_algorithm_parse_ruby_import;
-grpc_compression_algorithm_name_ruby_type grpc_compression_algorithm_name_ruby_import;
grpc_metadata_array_init_type grpc_metadata_array_init_import;
grpc_metadata_array_destroy_type grpc_metadata_array_destroy_import;
grpc_call_details_init_type grpc_call_details_init_import;
@@ -212,8 +210,6 @@ gpr_cmdline_destroy_type gpr_cmdline_destroy_import;
gpr_cmdline_usage_string_type gpr_cmdline_usage_string_import;
gpr_cpu_num_cores_type gpr_cpu_num_cores_import;
gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import;
-gpr_join_host_port_type gpr_join_host_port_import;
-gpr_split_host_port_type gpr_split_host_port_import;
gpr_log_severity_string_type gpr_log_severity_string_import;
gpr_log_type gpr_log_import;
gpr_log_message_type gpr_log_message_import;
@@ -292,8 +288,6 @@ void grpc_rb_load_imports(HMODULE library) {
grpc_compression_options_enable_algorithm_import = (grpc_compression_options_enable_algorithm_type) GetProcAddress(library, "grpc_compression_options_enable_algorithm");
grpc_compression_options_disable_algorithm_import = (grpc_compression_options_disable_algorithm_type) GetProcAddress(library, "grpc_compression_options_disable_algorithm");
grpc_compression_options_is_algorithm_enabled_import = (grpc_compression_options_is_algorithm_enabled_type) GetProcAddress(library, "grpc_compression_options_is_algorithm_enabled");
- grpc_compression_algorithm_parse_ruby_import = (grpc_compression_algorithm_parse_ruby_type) GetProcAddress(library, "grpc_compression_algorithm_parse_ruby");
- grpc_compression_algorithm_name_ruby_import = (grpc_compression_algorithm_name_ruby_type) GetProcAddress(library, "grpc_compression_algorithm_name_ruby");
grpc_metadata_array_init_import = (grpc_metadata_array_init_type) GetProcAddress(library, "grpc_metadata_array_init");
grpc_metadata_array_destroy_import = (grpc_metadata_array_destroy_type) GetProcAddress(library, "grpc_metadata_array_destroy");
grpc_call_details_init_import = (grpc_call_details_init_type) GetProcAddress(library, "grpc_call_details_init");
@@ -473,8 +467,6 @@ void grpc_rb_load_imports(HMODULE library) {
gpr_cmdline_usage_string_import = (gpr_cmdline_usage_string_type) GetProcAddress(library, "gpr_cmdline_usage_string");
gpr_cpu_num_cores_import = (gpr_cpu_num_cores_type) GetProcAddress(library, "gpr_cpu_num_cores");
gpr_cpu_current_cpu_import = (gpr_cpu_current_cpu_type) GetProcAddress(library, "gpr_cpu_current_cpu");
- gpr_join_host_port_import = (gpr_join_host_port_type) GetProcAddress(library, "gpr_join_host_port");
- gpr_split_host_port_import = (gpr_split_host_port_type) GetProcAddress(library, "gpr_split_host_port");
gpr_log_severity_string_import = (gpr_log_severity_string_type) GetProcAddress(library, "gpr_log_severity_string");
gpr_log_import = (gpr_log_type) GetProcAddress(library, "gpr_log");
gpr_log_message_import = (gpr_log_message_type) GetProcAddress(library, "gpr_log_message");
diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h
index 5f2b754d15..ba0ba580c8 100644
--- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h
+++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h
@@ -26,7 +26,6 @@
#include <windows.h>
#include <grpc/compression.h>
-#include <grpc/compression_ruby.h>
#include <grpc/grpc.h>
#include <grpc/grpc_posix.h>
#include <grpc/grpc_security.h>
@@ -36,7 +35,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/cpu.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
#include <grpc/support/string_util.h>
@@ -72,12 +70,6 @@ extern grpc_compression_options_disable_algorithm_type grpc_compression_options_
typedef int(*grpc_compression_options_is_algorithm_enabled_type)(const grpc_compression_options* opts, grpc_compression_algorithm algorithm);
extern grpc_compression_options_is_algorithm_enabled_type grpc_compression_options_is_algorithm_enabled_import;
#define grpc_compression_options_is_algorithm_enabled grpc_compression_options_is_algorithm_enabled_import
-typedef int(*grpc_compression_algorithm_parse_ruby_type)(grpc_slice value, grpc_compression_algorithm* algorithm);
-extern grpc_compression_algorithm_parse_ruby_type grpc_compression_algorithm_parse_ruby_import;
-#define grpc_compression_algorithm_parse_ruby grpc_compression_algorithm_parse_ruby_import
-typedef int(*grpc_compression_algorithm_name_ruby_type)(grpc_compression_algorithm algorithm, const char** name);
-extern grpc_compression_algorithm_name_ruby_type grpc_compression_algorithm_name_ruby_import;
-#define grpc_compression_algorithm_name_ruby grpc_compression_algorithm_name_ruby_import
typedef void(*grpc_metadata_array_init_type)(grpc_metadata_array* array);
extern grpc_metadata_array_init_type grpc_metadata_array_init_import;
#define grpc_metadata_array_init grpc_metadata_array_init_import
@@ -615,12 +607,6 @@ extern gpr_cpu_num_cores_type gpr_cpu_num_cores_import;
typedef unsigned(*gpr_cpu_current_cpu_type)(void);
extern gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import;
#define gpr_cpu_current_cpu gpr_cpu_current_cpu_import
-typedef int(*gpr_join_host_port_type)(char** out, const char* host, int port);
-extern gpr_join_host_port_type gpr_join_host_port_import;
-#define gpr_join_host_port gpr_join_host_port_import
-typedef int(*gpr_split_host_port_type)(const char* name, char** host, char** port);
-extern gpr_split_host_port_type gpr_split_host_port_import;
-#define gpr_split_host_port gpr_split_host_port_import
typedef const char*(*gpr_log_severity_string_type)(gpr_log_severity severity);
extern gpr_log_severity_string_type gpr_log_severity_string_import;
#define gpr_log_severity_string gpr_log_severity_string_import
diff --git a/src/ruby/pb/test/client.rb b/src/ruby/pb/test/client.rb
index a110fec960..63959d9b14 100755
--- a/src/ruby/pb/test/client.rb
+++ b/src/ruby/pb/test/client.rb
@@ -707,7 +707,7 @@ Args = Struct.new(:default_service_account, :host, :host_override,
:oauth_scope, :port, :secure, :test_case,
:use_test_ca)
-# validates the the command line options, returning them as a Hash.
+# validates the command line options, returning them as a Hash.
def parse_args
args = Args.new
args.host_override = 'foo.test.google.fr'
diff --git a/src/ruby/pb/test/server.rb b/src/ruby/pb/test/server.rb
index f3257d3d2d..1c82ba0b9a 100755
--- a/src/ruby/pb/test/server.rb
+++ b/src/ruby/pb/test/server.rb
@@ -211,7 +211,7 @@ class TestTarget < Grpc::Testing::TestService::Service
end
end
-# validates the the command line options, returning them as a Hash.
+# validates the command line options, returning them as a Hash.
def parse_options
options = {
'port' => nil,
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template
index de0f2eb328..c279bef51f 100644
--- a/templates/CMakeLists.txt.template
+++ b/templates/CMakeLists.txt.template
@@ -77,10 +77,10 @@
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
project(<%text>${PACKAGE_NAME}</%text> C CXX)
- set(gRPC_INSTALL_BINDIR "<%text>${CMAKE_INSTALL_PREFIX}</%text>/bin" CACHE PATH "Installation directory for executables")
- set(gRPC_INSTALL_LIBDIR "<%text>${CMAKE_INSTALL_PREFIX}</%text>/lib" CACHE PATH "Installation directory for libraries")
- set(gRPC_INSTALL_INCLUDEDIR "<%text>${CMAKE_INSTALL_PREFIX}</%text>/include" CACHE PATH "Installation directory for headers")
- set(gRPC_INSTALL_CMAKEDIR "<%text>${CMAKE_INSTALL_PREFIX}/lib/cmake/${PACKAGE_NAME}</%text>" CACHE PATH "Installation directory for cmake config files")
+ set(gRPC_INSTALL_BINDIR "bin" CACHE STRING "Installation directory for executables")
+ set(gRPC_INSTALL_LIBDIR "lib" CACHE STRING "Installation directory for libraries")
+ set(gRPC_INSTALL_INCLUDEDIR "include" CACHE STRING "Installation directory for headers")
+ set(gRPC_INSTALL_CMAKEDIR "lib/cmake/<%text>${PACKAGE_NAME}</%text>" CACHE STRING "Installation directory for cmake config files")
# Options
option(gRPC_BUILD_TESTS "Build tests" OFF)
diff --git a/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template b/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template
index 4f24a025c6..c5ec66ae29 100644
--- a/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template
+++ b/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template
@@ -18,6 +18,11 @@
<%include file="../clang5.include"/>
ADD clang_format_all_the_things.sh /
+
+ # When running locally, we'll be impersonating the current user, so we need
+ # to make the script runnable by everyone.
+ RUN chmod a+rx /clang_format_all_the_things.sh
+
CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"]
diff --git a/templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template b/templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template
index f5bceaa5f3..bbdba70075 100644
--- a/templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template
+++ b/templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template
@@ -19,6 +19,11 @@
<%include file="../clang5.include"/>
<%include file="../python_deps.include"/>
ADD clang_tidy_all_the_things.sh /
+
+ # When running locally, we'll be impersonating the current user, so we need
+ # to make the script runnable by everyone.
+ RUN chmod a+rx /clang_tidy_all_the_things.sh
+
CMD ["echo 'Run with tools/distrib/clang_tidy_code.sh'"]
diff --git a/test/core/avl/avl_test.cc b/test/core/avl/avl_test.cc
index a290461599..ac1ab5c8e9 100644
--- a/test/core/avl/avl_test.cc
+++ b/test/core/avl/avl_test.cc
@@ -41,7 +41,7 @@ static void* int_copy(void* p, void* unused) { return box(*(int*)p); }
static void destroy(void* p, void* unused) { gpr_free(p); }
static const grpc_avl_vtable int_int_vtable = {destroy, int_copy, int_compare,
- destroy, int_copy};
+ destroy, int_copy};
static void check_get(grpc_avl avl, int key, int value) {
int* k = box(key);
diff --git a/test/core/bad_client/gen_build_yaml.py b/test/core/bad_client/gen_build_yaml.py
index a8fd777216..32afba5b1f 100755
--- a/test/core/bad_client/gen_build_yaml.py
+++ b/test/core/bad_client/gen_build_yaml.py
@@ -27,6 +27,7 @@ default_test_options = TestOptions(False, 1.0)
BAD_CLIENT_TESTS = {
'badreq': default_test_options,
'connection_prefix': default_test_options._replace(cpu_cost=0.2),
+ 'duplicate_header': default_test_options,
'headers': default_test_options._replace(cpu_cost=0.2),
'initial_settings_frame': default_test_options._replace(cpu_cost=0.2),
'head_of_line_blocking': default_test_options,
diff --git a/test/core/bad_client/generate_tests.bzl b/test/core/bad_client/generate_tests.bzl
index b595defb8c..2769d5c3bb 100755
--- a/test/core/bad_client/generate_tests.bzl
+++ b/test/core/bad_client/generate_tests.bzl
@@ -16,6 +16,7 @@
"""Generates the appropriate build.json data for all the bad_client tests."""
+load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library")
def test_options():
return struct()
@@ -25,6 +26,7 @@ def test_options():
BAD_CLIENT_TESTS = {
'badreq': test_options(),
'connection_prefix': test_options(),
+ 'duplicate_header': test_options(),
'headers': test_options(),
'initial_settings_frame': test_options(),
'head_of_line_blocking': test_options(),
@@ -36,14 +38,14 @@ BAD_CLIENT_TESTS = {
}
def grpc_bad_client_tests():
- native.cc_library(
+ grpc_cc_library(
name = 'bad_client_test',
srcs = ['bad_client.cc'],
hdrs = ['bad_client.h'],
deps = ['//test/core/util:grpc_test_util', '//:grpc', '//:gpr', '//test/core/end2end:cq_verifier']
)
for t, topt in BAD_CLIENT_TESTS.items():
- native.cc_test(
+ grpc_cc_test(
name = '%s_bad_client_test' % t,
srcs = ['tests/%s.cc' % t],
deps = [':bad_client_test'],
diff --git a/test/core/bad_client/tests/duplicate_header.cc b/test/core/bad_client/tests/duplicate_header.cc
new file mode 100644
index 0000000000..0d689bbb7e
--- /dev/null
+++ b/test/core/bad_client/tests/duplicate_header.cc
@@ -0,0 +1,134 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "test/core/bad_client/bad_client.h"
+
+#include <string.h>
+
+#include <grpc/grpc.h>
+
+#include "src/core/lib/surface/server.h"
+#include "test/core/end2end/cq_verifier.h"
+
+#define PFX_STR \
+ "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \
+ "\x00\x00\x00\x04\x00\x00\x00\x00\x00" /* settings frame */
+
+#define HEADER_STR \
+ "\x00\x00\xc9\x01\x04\x00\x00\x00\x01" /* headers: generated from \
+ simple_request.headers in this \
+ directory */ \
+ "\x10\x05:path\x08/foo/bar" \
+ "\x10\x07:scheme\x04http" \
+ "\x10\x07:method\x04POST" \
+ "\x10\x0a:authority\x09localhost" \
+ "\x10\x0c" \
+ "content-type\x10" \
+ "application/grpc" \
+ "\x10\x14grpc-accept-encoding\x15" \
+ "deflate,identity,gzip" \
+ "\x10\x02te\x08trailers" \
+ "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)"
+
+#define PAYLOAD_STR \
+ "\x00\x00\x20\x00\x00\x00\x00\x00\x01" \
+ "\x00\x00\x00\x00"
+
+static void* tag(intptr_t t) { return (void*)t; }
+
+static void verifier(grpc_server* server, grpc_completion_queue* cq,
+ void* registered_method) {
+ grpc_call_error error;
+ grpc_call* s;
+ grpc_call_details call_details;
+ grpc_byte_buffer* request_payload_recv = nullptr;
+ grpc_op* op;
+ grpc_op ops[6];
+ cq_verifier* cqv = cq_verifier_create(cq);
+ grpc_metadata_array request_metadata_recv;
+ int was_cancelled = 2;
+
+ grpc_call_details_init(&call_details);
+ grpc_metadata_array_init(&request_metadata_recv);
+
+ error = grpc_server_request_call(server, &s, &call_details,
+ &request_metadata_recv, cq, cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
+ CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
+ cq_verify(cqv);
+
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "localhost"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo/bar"));
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_MESSAGE;
+ op->data.recv_message.recv_message = &request_payload_recv;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
+ cq_verify(cqv);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
+ op->data.recv_close_on_server.cancelled = &was_cancelled;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
+ op->data.send_status_from_server.trailing_metadata_count = 0;
+ op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ grpc_slice status_details = grpc_slice_from_static_string("xyz");
+ op->data.send_status_from_server.status_details = &status_details;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ CQ_EXPECT_COMPLETION(cqv, tag(103), 1);
+
+ grpc_metadata_array_destroy(&request_metadata_recv);
+ grpc_call_details_destroy(&call_details);
+ grpc_call_unref(s);
+ cq_verifier_destroy(cqv);
+}
+
+int main(int argc, char** argv) {
+ grpc_test_init(argc, argv);
+ grpc_init();
+
+ /* Verify that sending multiple headers doesn't segfault */
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
+ PFX_STR HEADER_STR HEADER_STR PAYLOAD_STR, 0);
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
+ PFX_STR HEADER_STR HEADER_STR HEADER_STR PAYLOAD_STR,
+ 0);
+ grpc_shutdown();
+ return 0;
+}
diff --git a/test/core/bad_ssl/bad_ssl_test.cc b/test/core/bad_ssl/bad_ssl_test.cc
index 8a7960b5ed..8aec94fd99 100644
--- a/test/core/bad_ssl/bad_ssl_test.cc
+++ b/test/core/bad_ssl/bad_ssl_test.cc
@@ -22,11 +22,12 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/subprocess.h>
+
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/port.h"
diff --git a/test/core/bad_ssl/generate_tests.bzl b/test/core/bad_ssl/generate_tests.bzl
index b7cb8f86e6..f2eab54904 100755
--- a/test/core/bad_ssl/generate_tests.bzl
+++ b/test/core/bad_ssl/generate_tests.bzl
@@ -26,12 +26,22 @@ def grpc_bad_ssl_tests():
name = 'bad_ssl_test_server',
srcs = ['server_common.cc'],
hdrs = ['server_common.h'],
- deps = ['//test/core/util:grpc_test_util', '//:grpc', '//test/core/end2end:ssl_test_data']
+ deps = ['//test/core/util:grpc_test_util',
+ '//:grpc',
+ '//test/core/end2end:ssl_test_data']
)
for t in BAD_SSL_TESTS:
- native.cc_test(
+ native.cc_binary(
name = 'bad_ssl_%s_server' % t,
srcs = ['servers/%s.cc' % t],
deps = [':bad_ssl_test_server'],
)
+ native.cc_test(
+ name = 'bad_ssl_%s_test' % t,
+ srcs = ['bad_ssl_test.cc'],
+ data = [':bad_ssl_%s_server' % t],
+ deps = ['//test/core/util:grpc_test_util',
+ '//:gpr',
+ '//test/core/end2end:cq_verifier'],
+ )
diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD
index 92f5907aac..c5dfd8ef37 100644
--- a/test/core/channel/BUILD
+++ b/test/core/channel/BUILD
@@ -53,3 +53,15 @@ grpc_cc_test(
"//test/core/util:grpc_test_util",
],
)
+
+grpc_cc_test(
+ name = "minimal_stack_is_minimal_test",
+ srcs = ["minimal_stack_is_minimal_test.cc"],
+ language = "C++",
+ deps = [
+ "//:gpr",
+ "//:grpc",
+ "//test/core/util:gpr_test_util",
+ "//test/core/util:grpc_test_util",
+ ],
+)
diff --git a/test/core/channel/channel_args_test.cc b/test/core/channel/channel_args_test.cc
index 3a4844881d..d232bc02ac 100644
--- a/test/core/channel/channel_args_test.cc
+++ b/test/core/channel/channel_args_test.cc
@@ -62,8 +62,8 @@ static void test_set_compression_algorithm(void) {
grpc_core::ExecCtx exec_ctx;
grpc_channel_args* ch_args;
- ch_args = grpc_channel_args_set_compression_algorithm(
- nullptr, GRPC_COMPRESS_MESSAGE_GZIP);
+ ch_args =
+ grpc_channel_args_set_compression_algorithm(nullptr, GRPC_COMPRESS_GZIP);
GPR_ASSERT(ch_args->num_args == 1);
GPR_ASSERT(strcmp(ch_args->args[0].key,
GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM) == 0);
@@ -88,12 +88,12 @@ static void test_compression_algorithm_states(void) {
GPR_ASSERT(GPR_BITGET(states_bitset, i));
}
- /* disable message/gzip and message/deflate and stream/gzip */
+ /* disable gzip and deflate and stream/gzip */
ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state(
- &ch_args, GRPC_COMPRESS_MESSAGE_GZIP, 0);
+ &ch_args, GRPC_COMPRESS_GZIP, 0);
GPR_ASSERT(ch_args == ch_args_wo_gzip);
ch_args_wo_gzip_deflate = grpc_channel_args_compression_algorithm_set_state(
- &ch_args_wo_gzip, GRPC_COMPRESS_MESSAGE_DEFLATE, 0);
+ &ch_args_wo_gzip, GRPC_COMPRESS_DEFLATE, 0);
GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate);
ch_args_wo_gzip_deflate_gzip =
grpc_channel_args_compression_algorithm_set_state(
@@ -103,7 +103,7 @@ static void test_compression_algorithm_states(void) {
states_bitset = (unsigned)grpc_channel_args_compression_algorithm_get_states(
ch_args_wo_gzip_deflate);
for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
- if (i == GRPC_COMPRESS_MESSAGE_GZIP || i == GRPC_COMPRESS_MESSAGE_DEFLATE ||
+ if (i == GRPC_COMPRESS_GZIP || i == GRPC_COMPRESS_DEFLATE ||
i == GRPC_COMPRESS_STREAM_GZIP) {
GPR_ASSERT(GPR_BITGET(states_bitset, i) == 0);
} else {
@@ -111,9 +111,9 @@ static void test_compression_algorithm_states(void) {
}
}
- /* re-enabled message/gzip and stream/gzip only */
+ /* re-enabled gzip and stream/gzip only */
ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state(
- &ch_args_wo_gzip_deflate_gzip, GRPC_COMPRESS_MESSAGE_GZIP, 1);
+ &ch_args_wo_gzip_deflate_gzip, GRPC_COMPRESS_GZIP, 1);
ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state(
&ch_args_wo_gzip, GRPC_COMPRESS_STREAM_GZIP, 1);
GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate_gzip);
@@ -121,7 +121,7 @@ static void test_compression_algorithm_states(void) {
states_bitset = (unsigned)grpc_channel_args_compression_algorithm_get_states(
ch_args_wo_gzip);
for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
- if (i == GRPC_COMPRESS_MESSAGE_DEFLATE) {
+ if (i == GRPC_COMPRESS_DEFLATE) {
GPR_ASSERT(GPR_BITGET(states_bitset, i) == 0);
} else {
GPR_ASSERT(GPR_BITGET(states_bitset, i) != 0);
diff --git a/test/core/client_channel/BUILD b/test/core/client_channel/BUILD
index ec72e0ea72..c4d12fe3a1 100644
--- a/test/core/client_channel/BUILD
+++ b/test/core/client_channel/BUILD
@@ -23,8 +23,19 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "uri_fuzzer_test",
srcs = ["uri_fuzzer_test.cc"],
- language = "C++",
corpus = "uri_corpus",
+ language = "C++",
+ deps = [
+ "//:gpr",
+ "//:grpc",
+ "//test/core/util:grpc_test_util",
+ ],
+)
+
+grpc_cc_test(
+ name = "parse_address_test",
+ srcs = ["parse_address_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -33,14 +44,13 @@ grpc_fuzzer(
)
grpc_cc_test(
- name = "lb_policies_test",
- srcs = ["lb_policies_test.cc"],
+ name = "uri_parser_test",
+ srcs = ["uri_parser_test.cc"],
language = "C++",
deps = [
"//:gpr",
"//:grpc",
- "//test/core/end2end:cq_verifier",
- "//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
+
diff --git a/test/core/client_channel/lb_policies_test.cc b/test/core/client_channel/lb_policies_test.cc
deleted file mode 100644
index 716c63b9d0..0000000000
--- a/test/core/client_channel/lb_policies_test.cc
+++ /dev/null
@@ -1,1029 +0,0 @@
-/*
- *
- * Copyright 2015 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 <stdarg.h>
-#include <string.h>
-
-#include <grpc/grpc.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
-#include <grpc/support/log.h>
-#include <grpc/support/string_util.h>
-#include <grpc/support/time.h>
-
-#include "src/core/ext/filters/client_channel/client_channel.h"
-#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
-#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/gpr/string.h"
-#include "src/core/lib/surface/channel.h"
-#include "src/core/lib/surface/server.h"
-#include "test/core/end2end/cq_verifier.h"
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.h"
-
-#define RETRY_TIMEOUT 300
-
-typedef struct servers_fixture {
- size_t num_servers;
- grpc_server** servers;
- grpc_call** server_calls;
- grpc_completion_queue* cq;
- grpc_completion_queue* shutdown_cq;
- char** servers_hostports;
- grpc_metadata_array* request_metadata_recv;
-} servers_fixture;
-
-typedef struct request_sequences {
- size_t n; /* number of iterations */
- int* connections; /* indexed by the interation number, value is the index of
- the server it connected to or -1 if none */
- /* indexed by the interation number, value is the client connectivity state */
- grpc_connectivity_state* connectivity_states;
-} request_sequences;
-
-typedef void (*verifier_fn)(const servers_fixture*, grpc_channel*,
- const request_sequences*, const size_t);
-
-typedef struct test_spec {
- size_t num_iters;
- size_t num_servers;
-
- int** kill_at;
- int** revive_at;
-
- const char* description;
-
- verifier_fn verifier;
-
-} test_spec;
-
-static void test_spec_reset(test_spec* spec) {
- size_t i, j;
-
- for (i = 0; i < spec->num_iters; i++) {
- for (j = 0; j < spec->num_servers; j++) {
- spec->kill_at[i][j] = 0;
- spec->revive_at[i][j] = 0;
- }
- }
-}
-
-static test_spec* test_spec_create(size_t num_iters, size_t num_servers) {
- test_spec* spec;
- size_t i;
-
- spec = static_cast<test_spec*>(gpr_malloc(sizeof(test_spec)));
- spec->num_iters = num_iters;
- spec->num_servers = num_servers;
- spec->kill_at = static_cast<int**>(gpr_malloc(sizeof(int*) * num_iters));
- spec->revive_at = static_cast<int**>(gpr_malloc(sizeof(int*) * num_iters));
- for (i = 0; i < num_iters; i++) {
- spec->kill_at[i] = static_cast<int*>(gpr_malloc(sizeof(int) * num_servers));
- spec->revive_at[i] =
- static_cast<int*>(gpr_malloc(sizeof(int) * num_servers));
- }
-
- test_spec_reset(spec);
- return spec;
-}
-
-static void test_spec_destroy(test_spec* spec) {
- size_t i;
- for (i = 0; i < spec->num_iters; i++) {
- gpr_free(spec->kill_at[i]);
- gpr_free(spec->revive_at[i]);
- }
-
- gpr_free(spec->kill_at);
- gpr_free(spec->revive_at);
-
- gpr_free(spec);
-}
-
-static void* tag(intptr_t t) { return (void*)t; }
-
-static gpr_timespec n_millis_time(int n) {
- return gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
- gpr_time_from_millis(n, GPR_TIMESPAN));
-}
-
-static void drain_cq(grpc_completion_queue* cq) {
- grpc_event ev;
- do {
- ev = grpc_completion_queue_next(cq, n_millis_time(5000), nullptr);
- } while (ev.type != GRPC_QUEUE_SHUTDOWN);
-}
-
-static void kill_server(const servers_fixture* f, size_t i) {
- gpr_log(GPR_INFO, "KILLING SERVER %" PRIuPTR, i);
- GPR_ASSERT(f->servers[i] != nullptr);
- grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000),
- n_millis_time(5000), nullptr)
- .type == GRPC_OP_COMPLETE);
- grpc_server_destroy(f->servers[i]);
- f->servers[i] = nullptr;
-}
-
-typedef struct request_data {
- grpc_metadata_array initial_metadata_recv;
- grpc_metadata_array trailing_metadata_recv;
- grpc_slice details;
- grpc_status_code status;
- grpc_call_details* call_details;
-} request_data;
-
-static void revive_server(const servers_fixture* f, request_data* rdata,
- size_t i) {
- int got_port;
- gpr_log(GPR_INFO, "RAISE AGAIN SERVER %" PRIuPTR, i);
- GPR_ASSERT(f->servers[i] == nullptr);
-
- gpr_log(GPR_DEBUG, "revive: %s", f->servers_hostports[i]);
-
- f->servers[i] = grpc_server_create(nullptr, nullptr);
- grpc_server_register_completion_queue(f->servers[i], f->cq, nullptr);
- GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port(
- f->servers[i], f->servers_hostports[i])) > 0);
- grpc_server_start(f->servers[i]);
-
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_server_request_call(f->servers[i], &f->server_calls[i],
- &rdata->call_details[i],
- &f->request_metadata_recv[i], f->cq,
- f->cq, tag(1000 + (int)i)));
-}
-
-static servers_fixture* setup_servers(const char* server_host,
- request_data* rdata,
- const size_t num_servers) {
- servers_fixture* f =
- static_cast<servers_fixture*>(gpr_malloc(sizeof(servers_fixture)));
- size_t i;
-
- f->num_servers = num_servers;
- f->server_calls =
- static_cast<grpc_call**>(gpr_malloc(sizeof(grpc_call*) * num_servers));
- f->request_metadata_recv = static_cast<grpc_metadata_array*>(
- gpr_malloc(sizeof(grpc_metadata_array) * num_servers));
- /* Create servers. */
- f->servers = static_cast<grpc_server**>(
- gpr_malloc(sizeof(grpc_server*) * num_servers));
- f->servers_hostports =
- static_cast<char**>(gpr_malloc(sizeof(char*) * num_servers));
- f->cq = grpc_completion_queue_create_for_next(nullptr);
- f->shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
- for (i = 0; i < num_servers; i++) {
- grpc_metadata_array_init(&f->request_metadata_recv[i]);
- gpr_join_host_port(&f->servers_hostports[i], server_host,
- grpc_pick_unused_port_or_die());
- f->servers[i] = nullptr;
- revive_server(f, rdata, i);
- }
- return f;
-}
-
-static void teardown_servers(servers_fixture* f) {
- size_t i;
- /* Destroy server. */
- for (i = 0; i < f->num_servers; i++) {
- if (f->servers[i] == nullptr) continue;
- grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000),
- n_millis_time(5000), nullptr)
- .type == GRPC_OP_COMPLETE);
- grpc_server_destroy(f->servers[i]);
- }
- grpc_completion_queue_shutdown(f->cq);
- drain_cq(f->cq);
- grpc_completion_queue_destroy(f->cq);
- grpc_completion_queue_destroy(f->shutdown_cq);
-
- gpr_free(f->servers);
-
- for (i = 0; i < f->num_servers; i++) {
- gpr_free(f->servers_hostports[i]);
- grpc_metadata_array_destroy(&f->request_metadata_recv[i]);
- }
-
- gpr_free(f->servers_hostports);
- gpr_free(f->request_metadata_recv);
- gpr_free(f->server_calls);
- gpr_free(f);
-}
-
-static request_sequences request_sequences_create(size_t n) {
- request_sequences res;
- res.n = n;
- res.connections = static_cast<int*>(gpr_malloc(sizeof(*res.connections) * n));
- res.connectivity_states = static_cast<grpc_connectivity_state*>(
- gpr_malloc(sizeof(*res.connectivity_states) * n));
- memset(res.connections, 0, sizeof(*res.connections) * n);
- memset(res.connectivity_states, 0, sizeof(*res.connectivity_states) * n);
- return res;
-}
-
-static void request_sequences_destroy(const request_sequences* rseqs) {
- gpr_free(rseqs->connections);
- gpr_free(rseqs->connectivity_states);
-}
-
-/** Returns connection sequence (server indices), which must be freed */
-static request_sequences perform_request(servers_fixture* f,
- grpc_channel* client,
- request_data* rdata,
- const test_spec* spec) {
- grpc_call* c;
- int s_idx;
- int* s_valid;
- grpc_op ops[6];
- grpc_op* op;
- int was_cancelled;
- size_t i, iter_num;
- grpc_event ev;
- int read_tag;
- int completed_client;
- const request_sequences sequences = request_sequences_create(spec->num_iters);
-
- s_valid = static_cast<int*>(gpr_malloc(sizeof(int) * f->num_servers));
-
- for (iter_num = 0; iter_num < spec->num_iters; iter_num++) {
- cq_verifier* cqv = cq_verifier_create(f->cq);
- was_cancelled = 2;
-
- for (i = 0; i < f->num_servers; i++) {
- if (spec->kill_at[iter_num][i] != 0) {
- kill_server(f, i);
- } else if (spec->revive_at[iter_num][i] != 0) {
- /* killing takes precedence */
- revive_server(f, rdata, i);
- }
- }
-
- sequences.connections[iter_num] = -1;
- grpc_metadata_array_init(&rdata->initial_metadata_recv);
- grpc_metadata_array_init(&rdata->trailing_metadata_recv);
-
- for (i = 0; i < f->num_servers; i++) {
- grpc_call_details_init(&rdata->call_details[i]);
- }
- memset(s_valid, 0, f->num_servers * sizeof(int));
-
- grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr");
- c = grpc_channel_create_call(client, nullptr, GRPC_PROPAGATE_DEFAULTS,
- f->cq, grpc_slice_from_static_string("/foo"),
- &host, gpr_inf_future(GPR_CLOCK_REALTIME),
- nullptr);
- GPR_ASSERT(c);
- completed_client = 0;
-
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_SEND_INITIAL_METADATA;
- op->data.send_initial_metadata.count = 0;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_RECV_INITIAL_METADATA;
- op->data.recv_initial_metadata.recv_initial_metadata =
- &rdata->initial_metadata_recv;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
- op->data.recv_status_on_client.trailing_metadata =
- &rdata->trailing_metadata_recv;
- op->data.recv_status_on_client.status = &rdata->status;
- op->data.recv_status_on_client.status_details = &rdata->details;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, (size_t)(op - ops),
- tag(1), nullptr));
-
- s_idx = -1;
- while ((ev = grpc_completion_queue_next(
- f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT),
- nullptr))
- .type != GRPC_QUEUE_TIMEOUT) {
- GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
- read_tag = ((int)(intptr_t)ev.tag);
- const grpc_connectivity_state conn_state =
- grpc_channel_check_connectivity_state(client, 0);
- sequences.connectivity_states[iter_num] = conn_state;
- gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%" PRIuPTR,
- ev.success, ev.type, read_tag, iter_num);
- if (ev.success && read_tag >= 1000) {
- GPR_ASSERT(s_idx == -1); /* only one server must reply */
- /* only server notifications for non-shutdown events */
- s_idx = read_tag - 1000;
- s_valid[s_idx] = 1;
- sequences.connections[iter_num] = s_idx;
- break;
- } else if (read_tag == 1) {
- gpr_log(GPR_DEBUG, "client timed out");
- GPR_ASSERT(ev.success);
- completed_client = 1;
- }
- }
-
- if (s_idx >= 0) {
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_SEND_INITIAL_METADATA;
- op->data.send_initial_metadata.count = 0;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
- op->data.send_status_from_server.trailing_metadata_count = 0;
- op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
- grpc_slice status_details = grpc_slice_from_static_string("xyz");
- op->data.send_status_from_server.status_details = &status_details;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
- op->data.recv_close_on_server.cancelled = &was_cancelled;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(f->server_calls[s_idx],
- ops, (size_t)(op - ops),
- tag(102), nullptr));
-
- CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
- if (!completed_client) {
- CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
- }
- cq_verify(cqv);
-
- GPR_ASSERT(rdata->status == GRPC_STATUS_UNIMPLEMENTED);
- GPR_ASSERT(0 == grpc_slice_str_cmp(rdata->details, "xyz"));
- GPR_ASSERT(0 ==
- grpc_slice_str_cmp(rdata->call_details[s_idx].method, "/foo"));
- GPR_ASSERT(0 == grpc_slice_str_cmp(rdata->call_details[s_idx].host,
- "foo.test.google.fr"));
- GPR_ASSERT(was_cancelled == 1);
-
- grpc_call_unref(f->server_calls[s_idx]);
-
- /* ask for the next request on this server */
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f->servers[s_idx], &f->server_calls[s_idx],
- &rdata->call_details[s_idx],
- &f->request_metadata_recv[s_idx], f->cq,
- f->cq, tag(1000 + (int)s_idx)));
- } else { /* no response from server */
- grpc_call_cancel(c, nullptr);
- if (!completed_client) {
- CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
- cq_verify(cqv);
- }
- }
-
- GPR_ASSERT(grpc_completion_queue_next(
- f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT),
- nullptr)
- .type == GRPC_QUEUE_TIMEOUT);
-
- grpc_metadata_array_destroy(&rdata->initial_metadata_recv);
- grpc_metadata_array_destroy(&rdata->trailing_metadata_recv);
-
- cq_verifier_destroy(cqv);
-
- grpc_call_unref(c);
-
- for (i = 0; i < f->num_servers; i++) {
- grpc_call_details_destroy(&rdata->call_details[i]);
- }
- grpc_slice_unref(rdata->details);
- }
-
- gpr_free(s_valid);
-
- return sequences;
-}
-
-static grpc_call** perform_multirequest(servers_fixture* f,
- grpc_channel* client,
- size_t concurrent_calls) {
- grpc_call** calls;
- grpc_op ops[6];
- grpc_op* op;
- size_t i;
-
- calls = static_cast<grpc_call**>(
- gpr_malloc(sizeof(grpc_call*) * concurrent_calls));
- for (i = 0; i < f->num_servers; i++) {
- kill_server(f, i);
- }
-
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_SEND_INITIAL_METADATA;
- op->data.send_initial_metadata.count = 0;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
- op->flags = 0;
- op->reserved = nullptr;
-
- grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr");
- for (i = 0; i < concurrent_calls; i++) {
- calls[i] = grpc_channel_create_call(
- client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq,
- grpc_slice_from_static_string("/foo"), &host,
- gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
- GPR_ASSERT(calls[i]);
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(calls[i], ops,
- (size_t)(op - ops), tag(1),
- nullptr));
- }
-
- return calls;
-}
-
-void run_spec(const test_spec* spec) {
- grpc_channel* client;
- char* client_hostport;
- char* servers_hostports_str;
- request_data rdata;
- servers_fixture* f;
- grpc_channel_args args;
- grpc_arg arg_array[2];
- rdata.call_details = static_cast<grpc_call_details*>(
- gpr_malloc(sizeof(grpc_call_details) * spec->num_servers));
- f = setup_servers("127.0.0.1", &rdata, spec->num_servers);
-
- /* Create client. */
- servers_hostports_str = gpr_strjoin_sep((const char**)f->servers_hostports,
- f->num_servers, ",", nullptr);
- gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str);
-
- arg_array[0].type = GRPC_ARG_INTEGER;
- arg_array[0].key =
- const_cast<char*>("grpc.testing.fixed_reconnect_backoff_ms");
- arg_array[0].value.integer = RETRY_TIMEOUT;
- arg_array[1].type = GRPC_ARG_STRING;
- arg_array[1].key = const_cast<char*>(GRPC_ARG_LB_POLICY_NAME);
- arg_array[1].value.string = const_cast<char*>("round_robin");
- args.num_args = 2;
- args.args = arg_array;
-
- client = grpc_insecure_channel_create(client_hostport, &args, nullptr);
-
- gpr_log(GPR_INFO, "Testing '%s' with servers=%s client=%s", spec->description,
- servers_hostports_str, client_hostport);
-
- const request_sequences sequences = perform_request(f, client, &rdata, spec);
-
- spec->verifier(f, client, &sequences, spec->num_iters);
-
- gpr_free(client_hostport);
- gpr_free(servers_hostports_str);
- gpr_free(rdata.call_details);
- request_sequences_destroy(&sequences);
-
- grpc_channel_destroy(client); /* calls the LB's shutdown func */
- teardown_servers(f);
-}
-
-static grpc_channel* create_client(const servers_fixture* f) {
- grpc_channel* client;
- char* client_hostport;
- char* servers_hostports_str;
- grpc_arg arg_array[3];
- grpc_channel_args args;
-
- servers_hostports_str = gpr_strjoin_sep((const char**)f->servers_hostports,
- f->num_servers, ",", nullptr);
- gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str);
-
- arg_array[0].type = GRPC_ARG_INTEGER;
- arg_array[0].key =
- const_cast<char*>("grpc.testing.fixed_reconnect_backoff_ms");
- arg_array[0].value.integer = RETRY_TIMEOUT;
- arg_array[1].type = GRPC_ARG_STRING;
- arg_array[1].key = const_cast<char*>(GRPC_ARG_LB_POLICY_NAME);
- arg_array[1].value.string = const_cast<char*>("ROUND_ROBIN");
- arg_array[2].type = GRPC_ARG_INTEGER;
- arg_array[2].key =
- const_cast<char*>(GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS);
- arg_array[2].value.integer = 0;
- args.num_args = GPR_ARRAY_SIZE(arg_array);
- args.args = arg_array;
-
- client = grpc_insecure_channel_create(client_hostport, &args, nullptr);
- gpr_free(client_hostport);
- gpr_free(servers_hostports_str);
-
- return client;
-}
-
-static void test_ping() {
- grpc_channel* client;
- request_data rdata;
- servers_fixture* f;
- cq_verifier* cqv;
- grpc_connectivity_state state = GRPC_CHANNEL_IDLE;
- const size_t num_servers = 1;
- int i;
-
- rdata.call_details = static_cast<grpc_call_details*>(
- gpr_malloc(sizeof(grpc_call_details) * num_servers));
- f = setup_servers("127.0.0.1", &rdata, num_servers);
- cqv = cq_verifier_create(f->cq);
-
- client = create_client(f);
-
- grpc_channel_ping(client, f->cq, tag(0), nullptr);
- CQ_EXPECT_COMPLETION(cqv, tag(0), 0);
-
- /* check that we're still in idle, and start connecting */
- GPR_ASSERT(grpc_channel_check_connectivity_state(client, 1) ==
- GRPC_CHANNEL_IDLE);
- /* we'll go through some set of transitions (some might be missed), until
- READY is reached */
- while (state != GRPC_CHANNEL_READY) {
- grpc_channel_watch_connectivity_state(
- client, state, grpc_timeout_seconds_to_deadline(3), f->cq, tag(99));
- CQ_EXPECT_COMPLETION(cqv, tag(99), 1);
- cq_verify(cqv);
- state = grpc_channel_check_connectivity_state(client, 0);
- GPR_ASSERT(state == GRPC_CHANNEL_READY ||
- state == GRPC_CHANNEL_CONNECTING ||
- state == GRPC_CHANNEL_TRANSIENT_FAILURE);
- }
-
- for (i = 1; i <= 5; i++) {
- grpc_channel_ping(client, f->cq, tag(i), nullptr);
- CQ_EXPECT_COMPLETION(cqv, tag(i), 1);
- cq_verify(cqv);
- }
- gpr_free(rdata.call_details);
-
- grpc_channel_destroy(client);
- teardown_servers(f);
-
- cq_verifier_destroy(cqv);
-}
-
-static void test_pending_calls(size_t concurrent_calls) {
- size_t i;
- grpc_call** calls;
- grpc_channel* client;
- request_data rdata;
- servers_fixture* f;
- test_spec* spec = test_spec_create(0, 4);
- rdata.call_details = static_cast<grpc_call_details*>(
- gpr_malloc(sizeof(grpc_call_details) * spec->num_servers));
- f = setup_servers("127.0.0.1", &rdata, spec->num_servers);
-
- client = create_client(f);
- calls = perform_multirequest(f, client, concurrent_calls);
- grpc_call_cancel(calls[0], nullptr); /* exercise the cancel pick path whilst
- there are pending picks */
-
- gpr_free(rdata.call_details);
-
- grpc_channel_destroy(client); /* calls the LB's shutdown func */
- /* destroy the calls after the channel so that they are still around for the
- * LB's shutdown func to process */
- for (i = 0; i < concurrent_calls; i++) {
- grpc_call_unref(calls[i]);
- }
- gpr_free(calls);
- teardown_servers(f);
- test_spec_destroy(spec);
-}
-
-static void test_get_channel_info() {
- grpc_channel* channel =
- grpc_insecure_channel_create("ipv4:127.0.0.1:1234", nullptr, nullptr);
- // Ensures that resolver returns.
- grpc_channel_check_connectivity_state(channel, true /* try_to_connect */);
- // First, request no fields. This is a no-op.
- grpc_channel_info channel_info;
- memset(&channel_info, 0, sizeof(channel_info));
- grpc_channel_get_info(channel, &channel_info);
- // Request LB policy name.
- char* lb_policy_name = nullptr;
- channel_info.lb_policy_name = &lb_policy_name;
- grpc_channel_get_info(channel, &channel_info);
- GPR_ASSERT(lb_policy_name != nullptr);
- GPR_ASSERT(strcmp(lb_policy_name, "pick_first") == 0);
- gpr_free(lb_policy_name);
- // Request service config, which does not exist, so we'll get nothing back.
- memset(&channel_info, 0, sizeof(channel_info));
- char* service_config_json = const_cast<char*>("dummy_string");
- channel_info.service_config_json = &service_config_json;
- grpc_channel_get_info(channel, &channel_info);
- GPR_ASSERT(service_config_json == nullptr);
- // Recreate the channel such that it has a service config.
- grpc_channel_destroy(channel);
- grpc_arg arg;
- arg.type = GRPC_ARG_STRING;
- arg.key = const_cast<char*>(GRPC_ARG_SERVICE_CONFIG);
- arg.value.string =
- const_cast<char*>("{\"loadBalancingPolicy\": \"ROUND_ROBIN\"}");
- grpc_channel_args* args = grpc_channel_args_copy_and_add(nullptr, &arg, 1);
- channel = grpc_insecure_channel_create("ipv4:127.0.0.1:1234", args, nullptr);
- {
- grpc_core::ExecCtx exec_ctx;
- grpc_channel_args_destroy(args);
- }
- // Ensures that resolver returns.
- grpc_channel_check_connectivity_state(channel, true /* try_to_connect */);
- // Now request the service config again.
- grpc_channel_get_info(channel, &channel_info);
- GPR_ASSERT(service_config_json != nullptr);
- GPR_ASSERT(strcmp(service_config_json, arg.value.string) == 0);
- gpr_free(service_config_json);
- // Clean up.
- grpc_channel_destroy(channel);
-}
-
-static void print_failed_expectations(const int* expected_connection_sequence,
- const int* actual_connection_sequence,
- const size_t expected_seq_length,
- const size_t num_iters) {
- size_t i;
- for (i = 0; i < num_iters; i++) {
- gpr_log(GPR_ERROR,
- "FAILURE: Iter (expected, actual): %" PRIuPTR " (%d, %d)", i,
- expected_connection_sequence[i % expected_seq_length],
- actual_connection_sequence[i]);
- }
-}
-
-static void verify_vanilla_round_robin(const servers_fixture* f,
- grpc_channel* client,
- const request_sequences* sequences,
- const size_t num_iters) {
- const size_t expected_seq_length = f->num_servers;
-
- /* verify conn. seq. expectation */
- /* get the first sequence of "num_servers" elements */
- int* expected_connection_sequence =
- static_cast<int*>(gpr_malloc(sizeof(int) * expected_seq_length));
- memcpy(expected_connection_sequence, sequences->connections,
- sizeof(int) * expected_seq_length);
-
- for (size_t i = 0; i < num_iters; i++) {
- const int actual = sequences->connections[i];
- const int expected = expected_connection_sequence[i % expected_seq_length];
- if (actual != expected) {
- gpr_log(
- GPR_ERROR,
- "CONNECTION SEQUENCE FAILURE: expected %d, got %d at iteration #%d",
- expected, actual, (int)i);
- abort();
- }
- }
-
- /* All servers are available, therefore all client subchannels are READY, even
- * when we only need one for the client channel state to be READY */
- for (size_t i = 0; i < sequences->n; i++) {
- const grpc_connectivity_state actual =
- static_cast<grpc_connectivity_state>(sequences->connectivity_states[i]);
- const grpc_connectivity_state expected = GRPC_CHANNEL_READY;
- if (actual != expected) {
- gpr_log(GPR_ERROR,
- "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
- "at iteration #%d",
- grpc_connectivity_state_name(expected),
- grpc_connectivity_state_name(actual), (int)i);
- abort();
- }
- }
-
- gpr_free(expected_connection_sequence);
-}
-
-/* At the start of the second iteration, all but the first and last servers (as
- * given in "f") are killed */
-static void verify_vanishing_floor_round_robin(
- const servers_fixture* f, grpc_channel* client,
- const request_sequences* sequences, const size_t num_iters) {
- int* expected_connection_sequence;
- const size_t expected_seq_length = 2;
- size_t i;
-
- /* verify conn. seq. expectation */
- /* copy the first full sequence (without -1s) */
- expected_connection_sequence =
- static_cast<int*>(gpr_malloc(sizeof(int) * expected_seq_length));
- memcpy(expected_connection_sequence, sequences->connections + 2,
- expected_seq_length * sizeof(int));
-
- /* first two elements of the sequence should be [0 (1st server), -1 (failure)]
- */
- GPR_ASSERT(sequences->connections[0] == 0);
- GPR_ASSERT(sequences->connections[1] == -1);
-
- /* the next two element must be [3, 0], repeating from that point: the 3 is
- * brought forth by servers 1 and 2 disappearing after the intial pick of 0 */
- GPR_ASSERT(sequences->connections[2] == 3);
- GPR_ASSERT(sequences->connections[3] == 0);
-
- /* make sure that the expectation obliges */
- for (i = 2; i < num_iters; i++) {
- const int actual = sequences->connections[i];
- const int expected = expected_connection_sequence[i % expected_seq_length];
- if (actual != expected) {
- print_failed_expectations(expected_connection_sequence,
- sequences->connections, expected_seq_length,
- num_iters);
- abort();
- }
- }
-
- /* There's always at least one subchannel READY (connected), therefore the
- * overall state of the client channel is READY at all times. */
- for (i = 0; i < sequences->n; i++) {
- const grpc_connectivity_state actual =
- static_cast<grpc_connectivity_state>(sequences->connectivity_states[i]);
- const grpc_connectivity_state expected = GRPC_CHANNEL_READY;
- if (actual != expected) {
- gpr_log(GPR_ERROR,
- "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
- "at iteration #%d",
- grpc_connectivity_state_name(expected),
- grpc_connectivity_state_name(actual), (int)i);
- abort();
- }
- }
-
- gpr_free(expected_connection_sequence);
-}
-
-static void verify_total_carnage_round_robin(const servers_fixture* f,
- grpc_channel* client,
- const request_sequences* sequences,
- const size_t num_iters) {
- for (size_t i = 0; i < num_iters; i++) {
- const int actual = sequences->connections[i];
- const int expected = -1;
- if (actual != expected) {
- gpr_log(
- GPR_ERROR,
- "CONNECTION SEQUENCE FAILURE: expected %d, got %d at iteration #%d",
- expected, actual, (int)i);
- abort();
- }
- }
-
- /* No server is ever available. There should be no READY states (or SHUTDOWN).
- * Note that all other states (IDLE, CONNECTING, TRANSIENT_FAILURE) are still
- * possible, as the policy transitions while attempting to reconnect. */
- for (size_t i = 0; i < sequences->n; i++) {
- const grpc_connectivity_state actual =
- static_cast<grpc_connectivity_state>(sequences->connectivity_states[i]);
- if (actual == GRPC_CHANNEL_READY || actual == GRPC_CHANNEL_SHUTDOWN) {
- gpr_log(GPR_ERROR,
- "CONNECTIVITY STATUS SEQUENCE FAILURE: got unexpected state "
- "'%s' at iteration #%d.",
- grpc_connectivity_state_name(actual), (int)i);
- abort();
- }
- }
-}
-
-static void verify_partial_carnage_round_robin(
- const servers_fixture* f, grpc_channel* client,
- const request_sequences* sequences, const size_t num_iters) {
- int* expected_connection_sequence;
- size_t i;
- const size_t expected_seq_length = f->num_servers;
-
- /* verify conn. seq. expectation */
- /* get the first sequence of "num_servers" elements */
- expected_connection_sequence =
- static_cast<int*>(gpr_malloc(sizeof(int) * expected_seq_length));
- memcpy(expected_connection_sequence, sequences->connections,
- sizeof(int) * expected_seq_length);
-
- for (i = 0; i < num_iters / 2; i++) {
- const int actual = sequences->connections[i];
- const int expected = expected_connection_sequence[i % expected_seq_length];
- if (actual != expected) {
- print_failed_expectations(expected_connection_sequence,
- sequences->connections, expected_seq_length,
- num_iters);
- abort();
- }
- }
-
- /* second half of the iterations go without response */
- for (; i < num_iters; i++) {
- GPR_ASSERT(sequences->connections[i] == -1);
- }
-
- /* We can assert that the first client channel state should be READY, when all
- * servers were available */
- grpc_connectivity_state actual =
- static_cast<grpc_connectivity_state>(sequences->connectivity_states[0]);
- grpc_connectivity_state expected = GRPC_CHANNEL_READY;
- if (actual != expected) {
- gpr_log(GPR_ERROR,
- "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
- "at iteration #%d",
- grpc_connectivity_state_name(expected),
- grpc_connectivity_state_name(actual), 0);
- abort();
- }
-
- /* ... and that the last one shouldn't be READY (or SHUTDOWN): all servers are
- * gone. It may be all other states (IDLE, CONNECTING, TRANSIENT_FAILURE), as
- * the policy transitions while attempting to reconnect. */
- actual = static_cast<grpc_connectivity_state>(
- sequences->connectivity_states[num_iters - 1]);
- for (i = 0; i < sequences->n; i++) {
- if (actual == GRPC_CHANNEL_READY || actual == GRPC_CHANNEL_SHUTDOWN) {
- gpr_log(GPR_ERROR,
- "CONNECTIVITY STATUS SEQUENCE FAILURE: got unexpected state "
- "'%s' at iteration #%d.",
- grpc_connectivity_state_name(actual), (int)i);
- abort();
- }
- }
- gpr_free(expected_connection_sequence);
-}
-
-static void dump_array(const char* desc, const int* data, const size_t count) {
- gpr_strvec s;
- char* tmp;
- size_t i;
- gpr_strvec_init(&s);
- gpr_strvec_add(&s, gpr_strdup(desc));
- gpr_strvec_add(&s, gpr_strdup(":"));
- for (i = 0; i < count; i++) {
- gpr_asprintf(&tmp, " %d", data[i]);
- gpr_strvec_add(&s, tmp);
- }
- tmp = gpr_strvec_flatten(&s, nullptr);
- gpr_strvec_destroy(&s);
- gpr_log(GPR_DEBUG, "%s", tmp);
- gpr_free(tmp);
-}
-
-static void verify_rebirth_round_robin(const servers_fixture* f,
- grpc_channel* client,
- const request_sequences* sequences,
- const size_t num_iters) {
- dump_array("actual_connection_sequence", sequences->connections, num_iters);
-
- /* first iteration succeeds */
- GPR_ASSERT(sequences->connections[0] != -1);
- /* then we fail for a while... */
- GPR_ASSERT(sequences->connections[1] == -1);
- /* ... but should be up eventually */
- size_t first_iter_back_up = ~0ul;
- for (size_t i = 2; i < sequences->n; ++i) {
- if (sequences->connections[i] != -1) {
- first_iter_back_up = i;
- break;
- }
- }
- GPR_ASSERT(first_iter_back_up != ~0ul);
-
- /* We can assert that the first client channel state should be READY, when all
- * servers were available; same thing for the last one. In the middle
- * somewhere there must exist at least one TRANSIENT_FAILURE */
- grpc_connectivity_state actual =
- static_cast<grpc_connectivity_state>(sequences->connectivity_states[0]);
- grpc_connectivity_state expected = GRPC_CHANNEL_READY;
- if (actual != expected) {
- gpr_log(GPR_ERROR,
- "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
- "at iteration #%d",
- grpc_connectivity_state_name(expected),
- grpc_connectivity_state_name(actual), 0);
- abort();
- }
-
- actual = static_cast<grpc_connectivity_state>(
- sequences->connectivity_states[num_iters - 1]);
- expected = GRPC_CHANNEL_READY;
- if (actual != expected) {
- gpr_log(GPR_ERROR,
- "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
- "at iteration #%d",
- grpc_connectivity_state_name(expected),
- grpc_connectivity_state_name(actual), (int)num_iters - 1);
- abort();
- }
-
- bool found_failure_status = false;
- for (size_t i = 1; i < sequences->n - 1; i++) {
- if (sequences->connectivity_states[i] == GRPC_CHANNEL_TRANSIENT_FAILURE) {
- found_failure_status = true;
- break;
- }
- }
- if (!found_failure_status) {
- gpr_log(
- GPR_ERROR,
- "CONNECTIVITY STATUS SEQUENCE FAILURE: "
- "GRPC_CHANNEL_TRANSIENT_FAILURE status not found. Got the following "
- "instead:");
- for (size_t i = 0; i < num_iters; i++) {
- gpr_log(GPR_ERROR, "[%d]: %s", (int)i,
- grpc_connectivity_state_name(static_cast<grpc_connectivity_state>(
- sequences->connectivity_states[i])));
- }
- }
-}
-
-int main(int argc, char** argv) {
- grpc_core::ExecCtx exec_ctx;
- test_spec* spec;
- size_t i;
- const size_t NUM_ITERS = 10;
- const size_t NUM_SERVERS = 4;
-
- grpc_init();
- grpc_test_init(argc, argv);
- grpc_tracer_set_enabled("round_robin", 1);
-
- GPR_ASSERT(grpc_lb_policy_create("this-lb-policy-does-not-exist", nullptr) ==
- nullptr);
- GPR_ASSERT(grpc_lb_policy_create(nullptr, nullptr) == nullptr);
-
- spec = test_spec_create(NUM_ITERS, NUM_SERVERS);
- /* everything is fine, all servers stay up the whole time and life's peachy
- */
- spec->verifier = verify_vanilla_round_robin;
- spec->description = "test_all_server_up";
- run_spec(spec);
-
- /* Kill all servers first thing in the morning */
- test_spec_reset(spec);
- spec->verifier = verify_total_carnage_round_robin;
- spec->description = "test_kill_all_server";
- for (i = 0; i < NUM_SERVERS; i++) {
- spec->kill_at[0][i] = 1;
- }
- run_spec(spec);
-
- /* at the start of the 2nd iteration, kill all but the first and last
- * servers.
- * This should knock down the server bound to be selected next */
- test_spec_reset(spec);
- spec->verifier = verify_vanishing_floor_round_robin;
- spec->description = "test_kill_middle_servers_at_2nd_iteration";
- for (i = 1; i < NUM_SERVERS - 1; i++) {
- spec->kill_at[1][i] = 1;
- }
- run_spec(spec);
-
- /* Midway, kill all servers. */
- test_spec_reset(spec);
- spec->verifier = verify_partial_carnage_round_robin;
- spec->description = "test_kill_all_server_midway";
- for (i = 0; i < NUM_SERVERS; i++) {
- spec->kill_at[spec->num_iters / 2][i] = 1;
- }
- run_spec(spec);
-
- /* After first iteration, kill all servers. On the third one, bring them all
- * back up. */
- test_spec_reset(spec);
- spec->verifier = verify_rebirth_round_robin;
- spec->description = "test_kill_all_server_after_1st_resurrect_at_3rd";
- for (i = 0; i < NUM_SERVERS; i++) {
- spec->kill_at[1][i] = 1;
- spec->revive_at[3][i] = 1;
- }
- run_spec(spec);
- test_spec_destroy(spec);
-
- test_pending_calls(4);
- test_ping();
- test_get_channel_info();
-
- grpc_shutdown();
- return 0;
-}
diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc
index d85cbb1d03..9c11c01021 100644
--- a/test/core/client_channel/resolvers/fake_resolver_test.cc
+++ b/test/core/client_channel/resolvers/fake_resolver_test.cc
@@ -55,6 +55,7 @@ typedef struct on_resolution_arg {
gpr_event ev;
} on_resolution_arg;
+// Callback to check the resolution result is as expected.
void on_resolution_cb(void* arg, grpc_error* error) {
on_resolution_arg* res = static_cast<on_resolution_arg*>(arg);
// We only check the addresses channel arg because that's the only one
@@ -71,85 +72,167 @@ void on_resolution_cb(void* arg, grpc_error* error) {
gpr_event_set(&res->ev, (void*)1);
}
-static void test_fake_resolver() {
- grpc_core::ExecCtx exec_ctx;
- grpc_combiner* combiner = grpc_combiner_create();
- // Create resolver.
- grpc_fake_resolver_response_generator* response_generator =
- grpc_fake_resolver_response_generator_create();
- grpc_resolver* resolver = build_fake_resolver(combiner, response_generator);
- GPR_ASSERT(resolver != nullptr);
-
- // Setup expectations.
- grpc_uri* uris[] = {grpc_uri_parse("ipv4:10.2.1.1:1234", true),
- grpc_uri_parse("ipv4:127.0.0.1:4321", true)};
- const char* balancer_names[] = {"name1", "name2"};
- const bool is_balancer[] = {true, false};
- grpc_lb_addresses* addresses = grpc_lb_addresses_create(3, nullptr);
- for (size_t i = 0; i < GPR_ARRAY_SIZE(uris); ++i) {
+// Create a new resolution containing 2 addresses.
+static grpc_channel_args* create_new_resolver_result() {
+ static size_t test_counter = 0;
+ const size_t num_addresses = 2;
+ char* uri_string;
+ char* balancer_name;
+ // Create grpc_lb_addresses.
+ grpc_lb_addresses* addresses =
+ grpc_lb_addresses_create(num_addresses, nullptr);
+ for (size_t i = 0; i < num_addresses; ++i) {
+ gpr_asprintf(&uri_string, "ipv4:127.0.0.1:100%" PRIuPTR,
+ test_counter * num_addresses + i);
+ grpc_uri* uri = grpc_uri_parse(uri_string, true);
+ gpr_asprintf(&balancer_name, "balancer%" PRIuPTR,
+ test_counter * num_addresses + i);
grpc_lb_addresses_set_address_from_uri(
- addresses, i, uris[i], is_balancer[i], balancer_names[i], nullptr);
- grpc_uri_destroy(uris[i]);
+ addresses, i, uri, bool(num_addresses % 2), balancer_name, nullptr);
+ gpr_free(balancer_name);
+ grpc_uri_destroy(uri);
+ gpr_free(uri_string);
}
+ // Convert grpc_lb_addresses to grpc_channel_args.
const grpc_arg addresses_arg =
grpc_lb_addresses_create_channel_arg(addresses);
grpc_channel_args* results =
grpc_channel_args_copy_and_add(nullptr, &addresses_arg, 1);
grpc_lb_addresses_destroy(addresses);
+ ++test_counter;
+ return results;
+}
+
+static on_resolution_arg create_on_resolution_arg(grpc_channel_args* results) {
on_resolution_arg on_res_arg;
memset(&on_res_arg, 0, sizeof(on_res_arg));
on_res_arg.expected_resolver_result = results;
gpr_event_init(&on_res_arg.ev);
+ return on_res_arg;
+}
+
+static void test_fake_resolver() {
+ grpc_core::ExecCtx exec_ctx;
+ grpc_combiner* combiner = grpc_combiner_create();
+ // Create resolver.
+ grpc_fake_resolver_response_generator* response_generator =
+ grpc_fake_resolver_response_generator_create();
+ grpc_resolver* resolver = build_fake_resolver(combiner, response_generator);
+ GPR_ASSERT(resolver != nullptr);
+ // Test 1: normal resolution.
+ // next_results != NULL, results_upon_error == NULL, last_used_results ==
+ // NULL. Expected response is next_results.
+ grpc_channel_args* results = create_new_resolver_result();
+ on_resolution_arg on_res_arg = create_on_resolution_arg(results);
grpc_closure* on_resolution = GRPC_CLOSURE_CREATE(
on_resolution_cb, &on_res_arg, grpc_combiner_scheduler(combiner));
-
- // Set resolver results and trigger first resolution. on_resolution_cb
- // performs the checks.
+ // Resolution won't be triggered until next_results is set.
+ grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
+ on_resolution);
grpc_fake_resolver_response_generator_set_response(response_generator,
results);
+ grpc_core::ExecCtx::Get()->Flush();
+ GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
+ grpc_timeout_seconds_to_deadline(5)) != nullptr);
+ // Test 2: update resolution.
+ // next_results != NULL, results_upon_error == NULL, last_used_results !=
+ // NULL. Expected response is next_results.
+ results = create_new_resolver_result();
+ grpc_channel_args* last_used_results = grpc_channel_args_copy(results);
+ on_res_arg = create_on_resolution_arg(results);
+ on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
+ grpc_combiner_scheduler(combiner));
+ // Resolution won't be triggered until next_results is set.
grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
on_resolution);
+ grpc_fake_resolver_response_generator_set_response(response_generator,
+ results);
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_seconds_to_deadline(5)) != nullptr);
-
- // Setup update.
- grpc_uri* uris_update[] = {grpc_uri_parse("ipv4:192.168.1.0:31416", true)};
- const char* balancer_names_update[] = {"name3"};
- const bool is_balancer_update[] = {false};
- grpc_lb_addresses* addresses_update = grpc_lb_addresses_create(1, nullptr);
- for (size_t i = 0; i < GPR_ARRAY_SIZE(uris_update); ++i) {
- grpc_lb_addresses_set_address_from_uri(addresses_update, i, uris_update[i],
- is_balancer_update[i],
- balancer_names_update[i], nullptr);
- grpc_uri_destroy(uris_update[i]);
- }
-
- grpc_arg addresses_update_arg =
- grpc_lb_addresses_create_channel_arg(addresses_update);
- grpc_channel_args* results_update =
- grpc_channel_args_copy_and_add(nullptr, &addresses_update_arg, 1);
- grpc_lb_addresses_destroy(addresses_update);
-
- // Setup expectations for the update.
- on_resolution_arg on_res_arg_update;
- memset(&on_res_arg_update, 0, sizeof(on_res_arg_update));
- on_res_arg_update.expected_resolver_result = results_update;
- gpr_event_init(&on_res_arg_update.ev);
- on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg_update,
+ // Test 3: fallback re-resolution.
+ // next_results == NULL, results_upon_error == NULL, last_used_results !=
+ // NULL. Expected response is last_used_results.
+ on_res_arg = create_on_resolution_arg(last_used_results);
+ on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
grpc_combiner_scheduler(combiner));
-
- // Set updated resolver results and trigger a second resolution.
+ grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
+ on_resolution);
+ // Trigger a re-resolution.
+ grpc_resolver_channel_saw_error_locked(resolver);
+ grpc_core::ExecCtx::Get()->Flush();
+ GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
+ grpc_timeout_seconds_to_deadline(5)) != nullptr);
+ // Test 4: normal re-resolution.
+ // next_results == NULL, results_upon_error != NULL, last_used_results !=
+ // NULL. Expected response is results_upon_error.
+ grpc_channel_args* results_upon_error = create_new_resolver_result();
+ on_res_arg =
+ create_on_resolution_arg(grpc_channel_args_copy(results_upon_error));
+ on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
+ grpc_combiner_scheduler(combiner));
+ grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
+ on_resolution);
+ // Set results_upon_error.
+ grpc_fake_resolver_response_generator_set_response_upon_error(
+ response_generator, results_upon_error);
+ // Flush here to guarantee that the response has been set.
+ grpc_core::ExecCtx::Get()->Flush();
+ // Trigger a re-resolution.
+ grpc_resolver_channel_saw_error_locked(resolver);
+ grpc_core::ExecCtx::Get()->Flush();
+ GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
+ grpc_timeout_seconds_to_deadline(5)) != nullptr);
+ // Test 5: repeat re-resolution.
+ // next_results == NULL, results_upon_error != NULL, last_used_results !=
+ // NULL. Expected response is results_upon_error.
+ on_res_arg = create_on_resolution_arg(results_upon_error);
+ on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
+ grpc_combiner_scheduler(combiner));
+ grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
+ on_resolution);
+ // Trigger a re-resolution.
+ grpc_resolver_channel_saw_error_locked(resolver);
+ grpc_core::ExecCtx::Get()->Flush();
+ GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
+ grpc_timeout_seconds_to_deadline(5)) != nullptr);
+ // Test 6: normal resolution.
+ // next_results != NULL, results_upon_error != NULL, last_used_results !=
+ // NULL. Expected response is next_results.
+ results = create_new_resolver_result();
+ last_used_results = grpc_channel_args_copy(results);
+ on_res_arg = create_on_resolution_arg(results);
+ on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
+ grpc_combiner_scheduler(combiner));
+ // Resolution won't be triggered until next_results is set.
+ grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
+ on_resolution);
grpc_fake_resolver_response_generator_set_response(response_generator,
- results_update);
- grpc_resolver_next_locked(resolver, &on_res_arg_update.resolver_result,
+ results);
+ grpc_core::ExecCtx::Get()->Flush();
+ GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
+ grpc_timeout_seconds_to_deadline(5)) != nullptr);
+ // Test 7: fallback re-resolution.
+ // next_results == NULL, results_upon_error == NULL, last_used_results !=
+ // NULL. Expected response is last_used_results.
+ on_res_arg = create_on_resolution_arg(last_used_results);
+ on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
+ grpc_combiner_scheduler(combiner));
+ grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
on_resolution);
+ // Reset results_upon_error.
+ grpc_fake_resolver_response_generator_set_response_upon_error(
+ response_generator, nullptr);
+ // Flush here to guarantee that results_upon_error has been reset.
+ grpc_core::ExecCtx::Get()->Flush();
+ // Trigger a re-resolution.
+ grpc_resolver_channel_saw_error_locked(resolver);
grpc_core::ExecCtx::Get()->Flush();
- GPR_ASSERT(gpr_event_wait(&on_res_arg_update.ev,
+ GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_seconds_to_deadline(5)) != nullptr);
-
- // Requesting a new resolution without re-senting the response shouldn't
- // trigger the resolution callback.
+ // Test 8: no-op.
+ // Requesting a new resolution without setting the response shouldn't trigger
+ // the resolution callback.
memset(&on_res_arg, 0, sizeof(on_res_arg));
grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
on_resolution);
@@ -157,10 +240,9 @@ static void test_fake_resolver() {
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr);
-
+ // Clean up.
GRPC_COMBINER_UNREF(combiner, "test_fake_resolver");
GRPC_RESOLVER_UNREF(resolver, "test_fake_resolver");
-
grpc_fake_resolver_response_generator_unref(response_generator);
}
diff --git a/test/core/compression/algorithm_test.cc b/test/core/compression/algorithm_test.cc
index 632077dd17..3dcddf3e67 100644
--- a/test/core/compression/algorithm_test.cc
+++ b/test/core/compression/algorithm_test.cc
@@ -28,7 +28,7 @@
#include "src/core/lib/transport/static_metadata.h"
#include "test/core/util/test_config.h"
-const uint32_t message_prefix_length = 8;
+const uint32_t message_prefix_length = 0;
const uint32_t stream_prefix_length = 7;
static void test_algorithm_mesh(void) {
int i;
diff --git a/test/core/compression/compression_test.cc b/test/core/compression/compression_test.cc
index c60aa6f38e..6522988c66 100644
--- a/test/core/compression/compression_test.cc
+++ b/test/core/compression/compression_test.cc
@@ -28,11 +28,10 @@
static void test_compression_algorithm_parse(void) {
size_t i;
- const char* valid_names[] = {"identity", "message/gzip", "message/deflate",
- "stream/gzip"};
+ const char* valid_names[] = {"identity", "gzip", "deflate", "stream/gzip"};
const grpc_compression_algorithm valid_algorithms[] = {
- GRPC_COMPRESS_NONE, GRPC_COMPRESS_MESSAGE_GZIP,
- GRPC_COMPRESS_MESSAGE_DEFLATE, GRPC_COMPRESS_STREAM_GZIP};
+ GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_DEFLATE,
+ GRPC_COMPRESS_STREAM_GZIP};
const char* invalid_names[] = {"gzip2", "foo", "", "2gzip"};
gpr_log(GPR_DEBUG, "test_compression_algorithm_parse");
@@ -61,11 +60,10 @@ static void test_compression_algorithm_name(void) {
int success;
const char* name;
size_t i;
- const char* valid_names[] = {"identity", "message/gzip", "message/deflate",
- "stream/gzip"};
+ const char* valid_names[] = {"identity", "gzip", "deflate", "stream/gzip"};
const grpc_compression_algorithm valid_algorithms[] = {
- GRPC_COMPRESS_NONE, GRPC_COMPRESS_MESSAGE_GZIP,
- GRPC_COMPRESS_MESSAGE_DEFLATE, GRPC_COMPRESS_STREAM_GZIP};
+ GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_DEFLATE,
+ GRPC_COMPRESS_STREAM_GZIP};
gpr_log(GPR_DEBUG, "test_compression_algorithm_name");
@@ -110,21 +108,21 @@ static void test_compression_algorithm_for_level(void) {
/* accept only gzip */
uint32_t accepted_encodings = 0;
GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_NONE); /* always */
- GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_MESSAGE_GZIP);
+ GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_GZIP);
GPR_ASSERT(GRPC_COMPRESS_NONE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_NONE,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_GZIP ==
+ GPR_ASSERT(GRPC_COMPRESS_GZIP ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_LOW,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_GZIP ==
+ GPR_ASSERT(GRPC_COMPRESS_GZIP ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_MED,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_GZIP ==
+ GPR_ASSERT(GRPC_COMPRESS_GZIP ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_HIGH,
accepted_encodings));
}
@@ -133,21 +131,21 @@ static void test_compression_algorithm_for_level(void) {
/* accept only deflate */
uint32_t accepted_encodings = 0;
GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_NONE); /* always */
- GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_MESSAGE_DEFLATE);
+ GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_DEFLATE);
GPR_ASSERT(GRPC_COMPRESS_NONE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_NONE,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_DEFLATE ==
+ GPR_ASSERT(GRPC_COMPRESS_DEFLATE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_LOW,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_DEFLATE ==
+ GPR_ASSERT(GRPC_COMPRESS_DEFLATE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_MED,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_DEFLATE ==
+ GPR_ASSERT(GRPC_COMPRESS_DEFLATE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_HIGH,
accepted_encodings));
}
@@ -156,22 +154,22 @@ static void test_compression_algorithm_for_level(void) {
/* accept gzip and deflate */
uint32_t accepted_encodings = 0;
GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_NONE); /* always */
- GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_MESSAGE_GZIP);
- GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_MESSAGE_DEFLATE);
+ GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_GZIP);
+ GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_DEFLATE);
GPR_ASSERT(GRPC_COMPRESS_NONE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_NONE,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_GZIP ==
+ GPR_ASSERT(GRPC_COMPRESS_GZIP ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_LOW,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_DEFLATE ==
+ GPR_ASSERT(GRPC_COMPRESS_DEFLATE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_MED,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_DEFLATE ==
+ GPR_ASSERT(GRPC_COMPRESS_DEFLATE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_HIGH,
accepted_encodings));
}
@@ -203,23 +201,23 @@ static void test_compression_algorithm_for_level(void) {
/* accept all algorithms */
uint32_t accepted_encodings = 0;
GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_NONE); /* always */
- GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_MESSAGE_GZIP);
- GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_MESSAGE_DEFLATE);
+ GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_GZIP);
+ GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_DEFLATE);
GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_STREAM_GZIP);
GPR_ASSERT(GRPC_COMPRESS_NONE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_NONE,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_GZIP ==
+ GPR_ASSERT(GRPC_COMPRESS_GZIP ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_LOW,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_DEFLATE ==
+ GPR_ASSERT(GRPC_COMPRESS_DEFLATE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_MED,
accepted_encodings));
- GPR_ASSERT(GRPC_COMPRESS_MESSAGE_DEFLATE ==
+ GPR_ASSERT(GRPC_COMPRESS_DEFLATE ==
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_HIGH,
accepted_encodings));
}
diff --git a/test/core/end2end/bad_server_response_test.cc b/test/core/end2end/bad_server_response_test.cc
index a8e5e291c8..2b98620164 100644
--- a/test/core/end2end/bad_server_response_test.cc
+++ b/test/core/end2end/bad_server_response_test.cc
@@ -27,10 +27,10 @@
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/slice/slice_internal.h"
diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc
index ca6d17e7c8..ff830b47cd 100644
--- a/test/core/end2end/connection_refused_test.cc
+++ b/test/core/end2end/connection_refused_test.cc
@@ -20,11 +20,11 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/service_config.h"
diff --git a/test/core/end2end/dualstack_socket_test.cc b/test/core/end2end/dualstack_socket_test.cc
index bb30547cd2..2dc72b885f 100644
--- a/test/core/end2end/dualstack_socket_test.cc
+++ b/test/core/end2end/dualstack_socket_test.cc
@@ -25,10 +25,10 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/resolve_address.h"
diff --git a/test/core/end2end/fixtures/h2_census.cc b/test/core/end2end/fixtures/h2_census.cc
index 49e0d4e13b..423764ad07 100644
--- a/test/core/end2end/fixtures/h2_census.cc
+++ b/test/core/end2end/fixtures/h2_census.cc
@@ -21,15 +21,16 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
+
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_compress.cc b/test/core/end2end/fixtures/h2_compress.cc
index c6a9bfa803..af7ddecd00 100644
--- a/test/core/end2end/fixtures/h2_compress.cc
+++ b/test/core/end2end/fixtures/h2_compress.cc
@@ -21,15 +21,16 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
+
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/util/port.h"
@@ -69,7 +70,7 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f,
grpc_channel_args_destroy(ffd->client_args_compression);
}
ffd->client_args_compression = grpc_channel_args_set_compression_algorithm(
- client_args, GRPC_COMPRESS_MESSAGE_GZIP);
+ client_args, GRPC_COMPRESS_GZIP);
f->client = grpc_insecure_channel_create(
ffd->localaddr, ffd->client_args_compression, nullptr);
}
@@ -83,7 +84,7 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f,
grpc_channel_args_destroy(ffd->server_args_compression);
}
ffd->server_args_compression = grpc_channel_args_set_compression_algorithm(
- server_args, GRPC_COMPRESS_MESSAGE_GZIP);
+ server_args, GRPC_COMPRESS_GZIP);
if (f->server) {
grpc_server_destroy(f->server);
}
diff --git a/test/core/end2end/fixtures/h2_fakesec.cc b/test/core/end2end/fixtures/h2_fakesec.cc
index 87d4668d50..bbf65fcd24 100644
--- a/test/core/end2end/fixtures/h2_fakesec.cc
+++ b/test/core/end2end/fixtures/h2_fakesec.cc
@@ -22,9 +22,10 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
+
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/security/credentials/fake/fake_credentials.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_full+pipe.cc b/test/core/end2end/fixtures/h2_full+pipe.cc
index 4a846c0151..88f24b937c 100644
--- a/test/core/end2end/fixtures/h2_full+pipe.cc
+++ b/test/core/end2end/fixtures/h2_full+pipe.cc
@@ -26,7 +26,6 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
@@ -35,6 +34,7 @@
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/iomgr/wakeup_fd_posix.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
diff --git a/test/core/end2end/fixtures/h2_full+trace.cc b/test/core/end2end/fixtures/h2_full+trace.cc
index 38edc2696b..4e0d66896b 100644
--- a/test/core/end2end/fixtures/h2_full+trace.cc
+++ b/test/core/end2end/fixtures/h2_full+trace.cc
@@ -26,7 +26,6 @@
#endif
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
@@ -36,6 +35,7 @@
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_full+workarounds.cc b/test/core/end2end/fixtures/h2_full+workarounds.cc
index 75c653917e..ce0fed6fee 100644
--- a/test/core/end2end/fixtures/h2_full+workarounds.cc
+++ b/test/core/end2end/fixtures/h2_full+workarounds.cc
@@ -21,16 +21,17 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/workaround_list.h>
+
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_full.cc b/test/core/end2end/fixtures/h2_full.cc
index 6f2a37cf22..4b96fa268a 100644
--- a/test/core/end2end/fixtures/h2_full.cc
+++ b/test/core/end2end/fixtures/h2_full.cc
@@ -21,7 +21,6 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
@@ -30,6 +29,7 @@
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_http_proxy.cc b/test/core/end2end/fixtures/h2_http_proxy.cc
index 38d1a82dda..da63f46018 100644
--- a/test/core/end2end/fixtures/h2_http_proxy.cc
+++ b/test/core/end2end/fixtures/h2_http_proxy.cc
@@ -21,7 +21,6 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
@@ -32,6 +31,7 @@
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/end2end/fixtures/http_proxy_fixture.h"
diff --git a/test/core/end2end/fixtures/h2_load_reporting.cc b/test/core/end2end/fixtures/h2_load_reporting.cc
index 44a73f9fd1..dddeef5862 100644
--- a/test/core/end2end/fixtures/h2_load_reporting.cc
+++ b/test/core/end2end/fixtures/h2_load_reporting.cc
@@ -21,7 +21,6 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
@@ -32,6 +31,7 @@
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_oauth2.cc b/test/core/end2end/fixtures/h2_oauth2.cc
index 5fed4434de..795e94a9e8 100644
--- a/test/core/end2end/fixtures/h2_oauth2.cc
+++ b/test/core/end2end/fixtures/h2_oauth2.cc
@@ -22,9 +22,10 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
+
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "test/core/end2end/data/ssl_test_data.h"
diff --git a/test/core/end2end/fixtures/h2_proxy.cc b/test/core/end2end/fixtures/h2_proxy.cc
index 60fa47d46d..4379cddf77 100644
--- a/test/core/end2end/fixtures/h2_proxy.cc
+++ b/test/core/end2end/fixtures/h2_proxy.cc
@@ -21,7 +21,6 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
@@ -30,6 +29,7 @@
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/end2end/fixtures/proxy.h"
diff --git a/test/core/end2end/fixtures/h2_ssl.cc b/test/core/end2end/fixtures/h2_ssl.cc
index 8c5c8a2f3f..bbcc88e4f3 100644
--- a/test/core/end2end/fixtures/h2_ssl.cc
+++ b/test/core/end2end/fixtures/h2_ssl.cc
@@ -22,11 +22,11 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/security/credentials/credentials.h"
diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.cc b/test/core/end2end/fixtures/h2_ssl_proxy.cc
index 3f0646cf0f..6b0b891b18 100644
--- a/test/core/end2end/fixtures/h2_ssl_proxy.cc
+++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc
@@ -22,11 +22,11 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/security/credentials/credentials.h"
diff --git a/test/core/end2end/fixtures/h2_uds.cc b/test/core/end2end/fixtures/h2_uds.cc
index c5869cf457..41045c278c 100644
--- a/test/core/end2end/fixtures/h2_uds.cc
+++ b/test/core/end2end/fixtures/h2_uds.cc
@@ -23,7 +23,6 @@
#include <unistd.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
@@ -33,6 +32,7 @@
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc
index 5bff1f1e6f..2d5e841aea 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.cc
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
@@ -26,13 +26,13 @@
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/http/parser.h"
#include "src/core/lib/iomgr/closure.h"
diff --git a/test/core/end2end/fixtures/inproc.cc b/test/core/end2end/fixtures/inproc.cc
index 2ef8139425..796ef67ddb 100644
--- a/test/core/end2end/fixtures/inproc.cc
+++ b/test/core/end2end/fixtures/inproc.cc
@@ -21,14 +21,15 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
+
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/inproc/inproc_transport.h"
#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/proxy.cc b/test/core/end2end/fixtures/proxy.cc
index d77dc2ca6b..7a35796e9c 100644
--- a/test/core/end2end/fixtures/proxy.cc
+++ b/test/core/end2end/fixtures/proxy.cc
@@ -21,11 +21,11 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/useful.h"
#include "test/core/util/port.h"
diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary
index a87e49ee52..3ed82e19bd 100644
--- a/test/core/end2end/fuzzers/hpack.dictionary
+++ b/test/core/end2end/fuzzers/hpack.dictionary
@@ -28,15 +28,13 @@
"\x1Egrpc.max_request_message_bytes"
"\x1Fgrpc.max_response_message_bytes"
"$/grpc.lb.v1.LoadBalancer/BalanceLoad"
-"\x0Fmessage/deflate"
-"\x0Cmessage/gzip"
+"\x07deflate"
+"\x04gzip"
"\x0Bstream/gzip"
"\x010"
"\x011"
"\x012"
"\x08identity"
-"\x04gzip"
-"\x07deflate"
"\x08trailers"
"\x10application/grpc"
"\x04POST"
diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc
index 9adb96e926..cd62c3f4e2 100644
--- a/test/core/end2end/h2_ssl_cert_test.cc
+++ b/test/core/end2end/h2_ssl_cert_test.cc
@@ -22,11 +22,11 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/security/credentials/credentials.h"
diff --git a/test/core/end2end/invalid_call_argument_test.cc b/test/core/end2end/invalid_call_argument_test.cc
index cb6b4c08ef..d2b26e7131 100644
--- a/test/core/end2end/invalid_call_argument_test.cc
+++ b/test/core/end2end/invalid_call_argument_test.cc
@@ -23,9 +23,9 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
+#include "src/core/lib/gpr/host_port.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/end2end/tests/compressed_payload.cc b/test/core/end2end/tests/compressed_payload.cc
index 39491d8196..63bf472906 100644
--- a/test/core/end2end/tests/compressed_payload.cc
+++ b/test/core/end2end/tests/compressed_payload.cc
@@ -382,9 +382,9 @@ static void request_with_payload_template(
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_NONE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
- GRPC_COMPRESS_MESSAGE_DEFLATE) != 0);
+ GRPC_COMPRESS_DEFLATE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
- GRPC_COMPRESS_MESSAGE_GZIP) != 0);
+ GRPC_COMPRESS_GZIP) != 0);
memset(ops, 0, sizeof(ops));
op = ops;
@@ -549,9 +549,8 @@ static void test_invoke_request_with_exceptionally_uncompressed_payload(
grpc_end2end_test_config config) {
request_with_payload_template(
config, "test_invoke_request_with_exceptionally_uncompressed_payload",
- GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_MESSAGE_GZIP,
- GRPC_COMPRESS_MESSAGE_GZIP, GRPC_COMPRESS_NONE,
- GRPC_COMPRESS_MESSAGE_GZIP, nullptr, false,
+ GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP,
+ GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, nullptr, false,
/* ignored */ GRPC_COMPRESS_LEVEL_NONE, false);
}
@@ -568,8 +567,8 @@ static void test_invoke_request_with_compressed_payload(
grpc_end2end_test_config config) {
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload", 0,
- GRPC_COMPRESS_MESSAGE_GZIP, GRPC_COMPRESS_MESSAGE_GZIP,
- GRPC_COMPRESS_MESSAGE_GZIP, GRPC_COMPRESS_MESSAGE_GZIP, nullptr, false,
+ GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP,
+ GRPC_COMPRESS_GZIP, nullptr, false,
/* ignored */ GRPC_COMPRESS_LEVEL_NONE, false);
}
@@ -577,8 +576,8 @@ static void test_invoke_request_with_send_message_before_initial_metadata(
grpc_end2end_test_config config) {
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload", 0,
- GRPC_COMPRESS_MESSAGE_GZIP, GRPC_COMPRESS_MESSAGE_GZIP,
- GRPC_COMPRESS_MESSAGE_GZIP, GRPC_COMPRESS_MESSAGE_GZIP, nullptr, false,
+ GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP,
+ GRPC_COMPRESS_GZIP, nullptr, false,
/* ignored */ GRPC_COMPRESS_LEVEL_NONE, true);
}
@@ -596,8 +595,7 @@ static void test_invoke_request_with_compressed_payload_md_override(
grpc_metadata identity_compression_override;
gzip_compression_override.key = GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST;
- gzip_compression_override.value =
- grpc_slice_from_static_string("message/gzip");
+ gzip_compression_override.value = grpc_slice_from_static_string("gzip");
memset(&gzip_compression_override.internal_data, 0,
sizeof(gzip_compression_override.internal_data));
@@ -610,32 +608,31 @@ static void test_invoke_request_with_compressed_payload_md_override(
/* Channel default NONE (aka IDENTITY), call override to GZIP */
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload_md_override_1", 0,
- GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_MESSAGE_GZIP,
+ GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP,
GRPC_COMPRESS_NONE, &gzip_compression_override, false,
/*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false);
/* Channel default DEFLATE, call override to GZIP */
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload_md_override_2", 0,
- GRPC_COMPRESS_MESSAGE_DEFLATE, GRPC_COMPRESS_NONE,
- GRPC_COMPRESS_MESSAGE_GZIP, GRPC_COMPRESS_NONE,
- &gzip_compression_override, false,
+ GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP,
+ GRPC_COMPRESS_NONE, &gzip_compression_override, false,
/*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false);
/* Channel default DEFLATE, call override to NONE (aka IDENTITY) */
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload_md_override_3", 0,
- GRPC_COMPRESS_MESSAGE_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE,
+ GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE,
GRPC_COMPRESS_NONE, &identity_compression_override, false,
/*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false);
}
static void test_invoke_request_with_disabled_algorithm(
grpc_end2end_test_config config) {
- request_for_disabled_algorithm(
- config, "test_invoke_request_with_disabled_algorithm", 0,
- GRPC_COMPRESS_MESSAGE_GZIP, GRPC_COMPRESS_MESSAGE_GZIP,
- GRPC_STATUS_UNIMPLEMENTED, nullptr);
+ request_for_disabled_algorithm(config,
+ "test_invoke_request_with_disabled_algorithm",
+ 0, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP,
+ GRPC_STATUS_UNIMPLEMENTED, nullptr);
}
void compressed_payload(grpc_end2end_test_config config) {
diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.cc b/test/core/end2end/tests/stream_compression_compressed_payload.cc
index d19a60f353..637b7b2422 100644
--- a/test/core/end2end/tests/stream_compression_compressed_payload.cc
+++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc
@@ -389,9 +389,9 @@ static void request_with_payload_template(
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_NONE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
- GRPC_COMPRESS_MESSAGE_DEFLATE) != 0);
+ GRPC_COMPRESS_DEFLATE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
- GRPC_COMPRESS_MESSAGE_GZIP) != 0);
+ GRPC_COMPRESS_GZIP) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_STREAM_GZIP) != 0);
GPR_ASSERT(GPR_BITCOUNT(grpc_call_test_only_get_encodings_accepted_by_peer(
diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc
index e801e2df14..edf03d8ffc 100644
--- a/test/core/end2end/tests/workaround_cronet_compression.cc
+++ b/test/core/end2end/tests/workaround_cronet_compression.cc
@@ -206,9 +206,9 @@ static void request_with_payload_template(
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_NONE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
- GRPC_COMPRESS_MESSAGE_DEFLATE) != 0);
+ GRPC_COMPRESS_DEFLATE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
- GRPC_COMPRESS_MESSAGE_GZIP) != 0);
+ GRPC_COMPRESS_GZIP) != 0);
memset(ops, 0, sizeof(ops));
op = ops;
@@ -364,16 +364,16 @@ typedef struct workaround_cronet_compression_config {
} workaround_cronet_compression_config;
static workaround_cronet_compression_config workaround_configs[] = {
- {nullptr, GRPC_COMPRESS_MESSAGE_GZIP},
+ {nullptr, GRPC_COMPRESS_GZIP},
{const_cast<char*>(
"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)"),
GRPC_COMPRESS_NONE},
{const_cast<char*>(
"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; chttp2; gentle)"),
- GRPC_COMPRESS_MESSAGE_GZIP},
+ GRPC_COMPRESS_GZIP},
{const_cast<char*>(
"grpc-objc/1.4.0 grpc-c/3.0.0-dev (ios; cronet_http; gentle)"),
- GRPC_COMPRESS_MESSAGE_GZIP}};
+ GRPC_COMPRESS_GZIP}};
static const size_t workaround_configs_num =
sizeof(workaround_configs) / sizeof(*workaround_configs);
@@ -382,8 +382,7 @@ static void test_workaround_cronet_compression(
for (uint32_t i = 0; i < workaround_configs_num; i++) {
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload", 0,
- GRPC_COMPRESS_MESSAGE_GZIP, GRPC_COMPRESS_MESSAGE_GZIP,
- GRPC_COMPRESS_MESSAGE_GZIP,
+ GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP,
workaround_configs[i].expected_algorithm_from_server, nullptr, false,
/* ignored */ GRPC_COMPRESS_LEVEL_NONE,
workaround_configs[i].user_agent_override);
diff --git a/test/core/fling/fling_stream_test.cc b/test/core/fling/fling_stream_test.cc
index b5a5ce816e..6b29486f22 100644
--- a/test/core/fling/fling_stream_test.cc
+++ b/test/core/fling/fling_stream_test.cc
@@ -20,9 +20,10 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/string_util.h>
#include <grpc/support/subprocess.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "test/core/util/port.h"
diff --git a/test/core/fling/fling_test.cc b/test/core/fling/fling_test.cc
index 3792e45c42..ceb9851bc9 100644
--- a/test/core/fling/fling_test.cc
+++ b/test/core/fling/fling_test.cc
@@ -20,9 +20,10 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/string_util.h>
#include <grpc/support/subprocess.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "test/core/util/port.h"
diff --git a/test/core/fling/server.cc b/test/core/fling/server.cc
index f3a8a1ccf8..328bd4edbd 100644
--- a/test/core/fling/server.cc
+++ b/test/core/fling/server.cc
@@ -31,9 +31,10 @@
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/profiling/timers.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/grpc_profiler.h"
diff --git a/test/core/gpr/host_port_test.cc b/test/core/gpr/host_port_test.cc
index 42dd56524f..b5d88b2b01 100644
--- a/test/core/gpr/host_port_test.cc
+++ b/test/core/gpr/host_port_test.cc
@@ -19,8 +19,9 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "test/core/util/test_config.h"
static void join_host_port_expect(const char* host, int port,
diff --git a/test/core/gprpp/orphanable_test.cc b/test/core/gprpp/orphanable_test.cc
index ff2f6d8bc2..ad6b9ac867 100644
--- a/test/core/gprpp/orphanable_test.cc
+++ b/test/core/gprpp/orphanable_test.cc
@@ -58,18 +58,19 @@ TEST(MakeOrphanable, WithParameters) {
EXPECT_EQ(5, foo->value());
}
-class Bar : public InternallyRefCounted {
+class Bar : public InternallyRefCounted<Bar> {
public:
Bar() : Bar(0) {}
explicit Bar(int value) : value_(value) {}
void Orphan() override { Unref(); }
int value() const { return value_; }
- void StartWork() { Ref(); }
- void FinishWork() { Unref(); }
+ void StartWork() { self_ref_ = Ref(); }
+ void FinishWork() { self_ref_.reset(); }
private:
int value_;
+ RefCountedPtr<Bar> self_ref_;
};
TEST(OrphanablePtr, InternallyRefCounted) {
@@ -82,19 +83,24 @@ TEST(OrphanablePtr, InternallyRefCounted) {
// things build properly in both debug and non-debug cases.
DebugOnlyTraceFlag baz_tracer(true, "baz");
-class Baz : public InternallyRefCountedWithTracing {
+class Baz : public InternallyRefCountedWithTracing<Baz> {
public:
Baz() : Baz(0) {}
explicit Baz(int value)
- : InternallyRefCountedWithTracing(&baz_tracer), value_(value) {}
+ : InternallyRefCountedWithTracing<Baz>(&baz_tracer), value_(value) {}
void Orphan() override { Unref(); }
int value() const { return value_; }
- void StartWork() { Ref(DEBUG_LOCATION, "work"); }
- void FinishWork() { Unref(DEBUG_LOCATION, "work"); }
+ void StartWork() { self_ref_ = Ref(DEBUG_LOCATION, "work"); }
+ void FinishWork() {
+ // This is a little ugly, but it makes the logged ref and unref match up.
+ self_ref_.release();
+ Unref(DEBUG_LOCATION, "work");
+ }
private:
int value_;
+ RefCountedPtr<Baz> self_ref_;
};
TEST(OrphanablePtr, InternallyRefCountedWithTracing) {
diff --git a/test/core/gprpp/ref_counted_ptr_test.cc b/test/core/gprpp/ref_counted_ptr_test.cc
index f1f13f3183..2e398a7722 100644
--- a/test/core/gprpp/ref_counted_ptr_test.cc
+++ b/test/core/gprpp/ref_counted_ptr_test.cc
@@ -30,7 +30,7 @@ namespace grpc_core {
namespace testing {
namespace {
-class Foo : public RefCounted {
+class Foo : public RefCounted<Foo> {
public:
Foo() : value_(0) {}
@@ -163,14 +163,15 @@ TEST(MakeRefCounted, Args) {
TraceFlag foo_tracer(true, "foo");
-class FooWithTracing : public RefCountedWithTracing {
+class FooWithTracing : public RefCountedWithTracing<FooWithTracing> {
public:
FooWithTracing() : RefCountedWithTracing(&foo_tracer) {}
};
TEST(RefCountedPtr, RefCountedWithTracing) {
RefCountedPtr<FooWithTracing> foo(New<FooWithTracing>());
- foo->Ref(DEBUG_LOCATION, "foo");
+ RefCountedPtr<FooWithTracing> foo2 = foo->Ref(DEBUG_LOCATION, "foo");
+ foo2.release();
foo->Unref(DEBUG_LOCATION, "foo");
}
diff --git a/test/core/gprpp/ref_counted_test.cc b/test/core/gprpp/ref_counted_test.cc
index b1b0fee5c0..f85a2e4675 100644
--- a/test/core/gprpp/ref_counted_test.cc
+++ b/test/core/gprpp/ref_counted_test.cc
@@ -27,7 +27,7 @@ namespace grpc_core {
namespace testing {
namespace {
-class Foo : public RefCounted {
+class Foo : public RefCounted<Foo> {
public:
Foo() {}
};
@@ -39,7 +39,8 @@ TEST(RefCounted, Basic) {
TEST(RefCounted, ExtraRef) {
Foo* foo = New<Foo>();
- foo->Ref();
+ RefCountedPtr<Foo> foop = foo->Ref();
+ foop.release();
foo->Unref();
foo->Unref();
}
@@ -48,17 +49,19 @@ TEST(RefCounted, ExtraRef) {
// things build properly in both debug and non-debug cases.
DebugOnlyTraceFlag foo_tracer(true, "foo");
-class FooWithTracing : public RefCountedWithTracing {
+class FooWithTracing : public RefCountedWithTracing<FooWithTracing> {
public:
FooWithTracing() : RefCountedWithTracing(&foo_tracer) {}
};
TEST(RefCountedWithTracing, Basic) {
FooWithTracing* foo = New<FooWithTracing>();
- foo->Ref(DEBUG_LOCATION, "extra_ref");
+ RefCountedPtr<FooWithTracing> foop = foo->Ref(DEBUG_LOCATION, "extra_ref");
+ foop.release();
foo->Unref(DEBUG_LOCATION, "extra_ref");
// Can use the no-argument methods, too.
- foo->Ref();
+ foop = foo->Ref();
+ foop.release();
foo->Unref();
foo->Unref(DEBUG_LOCATION, "original_ref");
}
diff --git a/test/core/http/BUILD b/test/core/http/BUILD
index 03b8f4edfe..be51ea0737 100644
--- a/test/core/http/BUILD
+++ b/test/core/http/BUILD
@@ -113,3 +113,16 @@ grpc_cc_test(
"//test/core/util:grpc_test_util",
],
)
+
+grpc_cc_test(
+ name = "format_request_test",
+ srcs = ["format_request_test.cc"],
+ language = "C++",
+ deps = [
+ "//:gpr",
+ "//:grpc",
+ "//test/core/end2end:ssl_test_data",
+ "//test/core/util:gpr_test_util",
+ "//test/core/util:grpc_test_util",
+ ],
+)
diff --git a/test/core/memory_usage/memory_usage_test.cc b/test/core/memory_usage/memory_usage_test.cc
index fb6d290130..f6316bda0b 100644
--- a/test/core/memory_usage/memory_usage_test.cc
+++ b/test/core/memory_usage/memory_usage_test.cc
@@ -20,9 +20,10 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/string_util.h>
#include <grpc/support/subprocess.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "test/core/util/port.h"
diff --git a/test/core/memory_usage/server.cc b/test/core/memory_usage/server.cc
index 45aeaea661..f5da3cb791 100644
--- a/test/core/memory_usage/server.cc
+++ b/test/core/memory_usage/server.cc
@@ -31,9 +31,10 @@
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/memory_counters.h"
#include "test/core/util/port.h"
diff --git a/test/core/surface/byte_buffer_reader_test.cc b/test/core/surface/byte_buffer_reader_test.cc
index 91662b027a..648a9d6986 100644
--- a/test/core/surface/byte_buffer_reader_test.cc
+++ b/test/core/surface/byte_buffer_reader_test.cc
@@ -109,7 +109,7 @@ static void test_read_corrupted_slice(void) {
LOG_TEST("test_read_corrupted_slice");
slice = grpc_slice_from_copied_string("test");
buffer = grpc_raw_byte_buffer_create(&slice, 1);
- buffer->data.raw.compression = GRPC_COMPRESS_MESSAGE_GZIP; /* lies! */
+ buffer->data.raw.compression = GRPC_COMPRESS_GZIP; /* lies! */
grpc_slice_unref(slice);
GPR_ASSERT(!grpc_byte_buffer_reader_init(&reader, buffer));
grpc_byte_buffer_destroy(buffer);
@@ -161,13 +161,13 @@ static void read_compressed_slice(grpc_compression_algorithm algorithm,
static void test_read_gzip_compressed_slice(void) {
const size_t INPUT_SIZE = 2048;
LOG_TEST("test_read_gzip_compressed_slice");
- read_compressed_slice(GRPC_COMPRESS_MESSAGE_GZIP, INPUT_SIZE);
+ read_compressed_slice(GRPC_COMPRESS_GZIP, INPUT_SIZE);
}
static void test_read_deflate_compressed_slice(void) {
const size_t INPUT_SIZE = 2048;
LOG_TEST("test_read_deflate_compressed_slice");
- read_compressed_slice(GRPC_COMPRESS_MESSAGE_DEFLATE, INPUT_SIZE);
+ read_compressed_slice(GRPC_COMPRESS_DEFLATE, INPUT_SIZE);
}
static void test_byte_buffer_from_reader(void) {
diff --git a/test/core/surface/num_external_connectivity_watchers_test.cc b/test/core/surface/num_external_connectivity_watchers_test.cc
index 9cdd299ae3..e48fd7fcf2 100644
--- a/test/core/surface/num_external_connectivity_watchers_test.cc
+++ b/test/core/surface/num_external_connectivity_watchers_test.cc
@@ -19,11 +19,11 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c
index d23a3861b4..a3e4246d2a 100644
--- a/test/core/surface/public_headers_must_be_c89.c
+++ b/test/core/surface/public_headers_must_be_c89.c
@@ -20,7 +20,6 @@
#include <grpc/byte_buffer_reader.h>
#include <grpc/census.h>
#include <grpc/compression.h>
-#include <grpc/compression_ruby.h>
#include <grpc/fork.h>
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
@@ -49,7 +48,6 @@
#include <grpc/support/atm.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/cpu.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
@@ -74,8 +72,6 @@ int main(int argc, char **argv) {
printf("%lx", (unsigned long) grpc_compression_options_enable_algorithm);
printf("%lx", (unsigned long) grpc_compression_options_disable_algorithm);
printf("%lx", (unsigned long) grpc_compression_options_is_algorithm_enabled);
- printf("%lx", (unsigned long) grpc_compression_algorithm_parse_ruby);
- printf("%lx", (unsigned long) grpc_compression_algorithm_name_ruby);
printf("%lx", (unsigned long) grpc_metadata_array_init);
printf("%lx", (unsigned long) grpc_metadata_array_destroy);
printf("%lx", (unsigned long) grpc_call_details_init);
@@ -252,8 +248,6 @@ int main(int argc, char **argv) {
printf("%lx", (unsigned long) gpr_cmdline_usage_string);
printf("%lx", (unsigned long) gpr_cpu_num_cores);
printf("%lx", (unsigned long) gpr_cpu_current_cpu);
- printf("%lx", (unsigned long) gpr_join_host_port);
- printf("%lx", (unsigned long) gpr_split_host_port);
printf("%lx", (unsigned long) gpr_log_severity_string);
printf("%lx", (unsigned long) gpr_log);
printf("%lx", (unsigned long) gpr_log_message);
diff --git a/test/core/surface/sequential_connectivity_test.cc b/test/core/surface/sequential_connectivity_test.cc
index ac49bd9823..1ac0a5ee13 100644
--- a/test/core/surface/sequential_connectivity_test.cc
+++ b/test/core/surface/sequential_connectivity_test.cc
@@ -19,11 +19,11 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
diff --git a/test/core/surface/server_chttp2_test.cc b/test/core/surface/server_chttp2_test.cc
index 96eaa6a7a9..f0412d01d9 100644
--- a/test/core/surface/server_chttp2_test.cc
+++ b/test/core/surface/server_chttp2_test.cc
@@ -19,9 +19,10 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/credentials/fake/fake_credentials.h"
#include "src/core/tsi/fake_transport_security.h"
diff --git a/test/core/surface/server_test.cc b/test/core/surface/server_test.cc
index 969b8cb11b..3b08efb563 100644
--- a/test/core/surface/server_test.cc
+++ b/test/core/surface/server_test.cc
@@ -19,9 +19,10 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/security/credentials/fake/fake_credentials.h"
#include "test/core/util/port.h"
diff --git a/test/core/util/reconnect_server.cc b/test/core/util/reconnect_server.cc
index bcafc4e898..b5a7749385 100644
--- a/test/core/util/reconnect_server.cc
+++ b/test/core/util/reconnect_server.cc
@@ -20,11 +20,12 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include <string.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/tcp_server.h"
diff --git a/test/core/util/test_tcp_server.cc b/test/core/util/test_tcp_server.cc
index 5f6af4e707..b1b5297f29 100644
--- a/test/core/util/test_tcp_server.cc
+++ b/test/core/util/test_tcp_server.cc
@@ -22,11 +22,12 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include <string.h>
+
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/tcp_server.h"
diff --git a/test/cpp/end2end/OWNERS b/test/cpp/end2end/OWNERS
new file mode 100644
index 0000000000..d87b3286a5
--- /dev/null
+++ b/test/cpp/end2end/OWNERS
@@ -0,0 +1,5 @@
+set noparent
+@vjpai
+@yang-g
+@y-zeng
+
diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc
index b85e286e5c..ee5adbc6fa 100644
--- a/test/cpp/end2end/client_lb_end2end_test.cc
+++ b/test/cpp/end2end/client_lb_end2end_test.cc
@@ -39,6 +39,7 @@
#include "src/core/ext/filters/client_channel/subchannel_index.h"
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gprpp/debug_location.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
@@ -162,44 +163,82 @@ class ClientLbEnd2endTest : public ::testing::Test {
grpc_lb_addresses_destroy(addresses);
}
+ void SetNextResolutionUponError(const std::vector<int>& ports) {
+ grpc_core::ExecCtx exec_ctx;
+ grpc_lb_addresses* addresses =
+ grpc_lb_addresses_create(ports.size(), nullptr);
+ for (size_t i = 0; i < ports.size(); ++i) {
+ char* lb_uri_str;
+ gpr_asprintf(&lb_uri_str, "ipv4:127.0.0.1:%d", ports[i]);
+ grpc_uri* lb_uri = grpc_uri_parse(lb_uri_str, true);
+ GPR_ASSERT(lb_uri != nullptr);
+ grpc_lb_addresses_set_address_from_uri(addresses, i, lb_uri,
+ false /* is balancer */,
+ "" /* balancer name */, nullptr);
+ grpc_uri_destroy(lb_uri);
+ gpr_free(lb_uri_str);
+ }
+ const grpc_arg fake_addresses =
+ grpc_lb_addresses_create_channel_arg(addresses);
+ grpc_channel_args* fake_result =
+ grpc_channel_args_copy_and_add(nullptr, &fake_addresses, 1);
+ grpc_fake_resolver_response_generator_set_response_upon_error(
+ response_generator_, fake_result);
+ grpc_channel_args_destroy(fake_result);
+ grpc_lb_addresses_destroy(addresses);
+ }
+
std::vector<int> GetServersPorts() {
std::vector<int> ports;
for (const auto& server : servers_) ports.push_back(server->port_);
return ports;
}
- void ResetStub(const grpc::string& lb_policy_name,
- ChannelArguments args = ChannelArguments()) {
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> BuildStub(
+ const std::shared_ptr<Channel>& channel) {
+ return grpc::testing::EchoTestService::NewStub(channel);
+ }
+
+ std::shared_ptr<Channel> BuildChannel(
+ const grpc::string& lb_policy_name,
+ ChannelArguments args = ChannelArguments()) {
if (lb_policy_name.size() > 0) {
args.SetLoadBalancingPolicyName(lb_policy_name);
} // else, default to pick first
args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
response_generator_);
- channel_ =
- CreateCustomChannel("fake:///", InsecureChannelCredentials(), args);
- stub_ = grpc::testing::EchoTestService::NewStub(channel_);
+ return CreateCustomChannel("fake:///", InsecureChannelCredentials(), args);
}
- bool SendRpc(EchoResponse* response = nullptr) {
+ bool SendRpc(
+ const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
+ EchoResponse* response = nullptr, int timeout_ms = 1000) {
const bool local_response = (response == nullptr);
if (local_response) response = new EchoResponse;
EchoRequest request;
request.set_message(kRequestMessage_);
ClientContext context;
- Status status = stub_->Echo(&context, request, response);
+ context.set_deadline(grpc_timeout_milliseconds_to_deadline(timeout_ms));
+ Status status = stub->Echo(&context, request, response);
if (local_response) delete response;
return status.ok();
}
- void CheckRpcSendOk() {
+ void CheckRpcSendOk(
+ const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
+ const grpc_core::DebugLocation& location) {
EchoResponse response;
- const bool success = SendRpc(&response);
- EXPECT_TRUE(success);
- EXPECT_EQ(response.message(), kRequestMessage_);
+ const bool success = SendRpc(stub, &response);
+ if (!success) abort();
+ ASSERT_TRUE(success) << "From " << location.file() << ":"
+ << location.line();
+ ASSERT_EQ(response.message(), kRequestMessage_)
+ << "From " << location.file() << ":" << location.line();
}
- void CheckRpcSendFailure() {
- const bool success = SendRpc();
+ void CheckRpcSendFailure(
+ const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub) {
+ const bool success = SendRpc(stub);
EXPECT_FALSE(success);
}
@@ -238,7 +277,7 @@ class ClientLbEnd2endTest : public ::testing::Test {
}
void Shutdown(bool join = true) {
- server_->Shutdown();
+ server_->Shutdown(grpc_timeout_milliseconds_to_deadline(0));
if (join) thread_->join();
}
};
@@ -247,9 +286,11 @@ class ClientLbEnd2endTest : public ::testing::Test {
for (const auto& server : servers_) server->service_.ResetCounters();
}
- void WaitForServer(size_t server_idx) {
+ void WaitForServer(
+ const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
+ size_t server_idx, const grpc_core::DebugLocation& location) {
do {
- CheckRpcSendOk();
+ CheckRpcSendOk(stub, location);
} while (servers_[server_idx]->service_.request_count() == 0);
ResetCounters();
}
@@ -280,7 +321,6 @@ class ClientLbEnd2endTest : public ::testing::Test {
}
const grpc::string server_host_;
- std::shared_ptr<Channel> channel_;
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::vector<std::unique_ptr<ServerData>> servers_;
grpc_fake_resolver_response_generator* response_generator_;
@@ -291,14 +331,15 @@ TEST_F(ClientLbEnd2endTest, PickFirst) {
// Start servers and send one RPC per server.
const int kNumServers = 3;
StartServers(kNumServers);
- ResetStub(""); // test that pick first is the default.
+ auto channel = BuildChannel(""); // test that pick first is the default.
+ auto stub = BuildStub(channel);
std::vector<int> ports;
for (size_t i = 0; i < servers_.size(); ++i) {
ports.emplace_back(servers_[i]->port_);
}
SetNextResolution(ports);
for (size_t i = 0; i < servers_.size(); ++i) {
- CheckRpcSendOk();
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
}
// All requests should have gone to a single server.
bool found = false;
@@ -312,7 +353,7 @@ TEST_F(ClientLbEnd2endTest, PickFirst) {
}
EXPECT_TRUE(found);
// Check LB policy name for the channel.
- EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName());
+ EXPECT_EQ("pick_first", channel->GetLoadBalancingPolicyName());
}
TEST_F(ClientLbEnd2endTest, PickFirstBackOffInitialReconnect) {
@@ -321,15 +362,16 @@ TEST_F(ClientLbEnd2endTest, PickFirstBackOffInitialReconnect) {
args.SetInt(GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS, kInitialBackOffMs);
const std::vector<int> ports = {grpc_pick_unused_port_or_die()};
const gpr_timespec t0 = gpr_now(GPR_CLOCK_MONOTONIC);
- ResetStub("pick_first", args);
+ auto channel = BuildChannel("pick_first", args);
+ auto stub = BuildStub(channel);
SetNextResolution(ports);
// The channel won't become connected (there's no server).
- ASSERT_FALSE(channel_->WaitForConnected(
+ ASSERT_FALSE(channel->WaitForConnected(
grpc_timeout_milliseconds_to_deadline(kInitialBackOffMs * 2)));
// Bring up a server on the chosen port.
StartServers(1, ports);
// Now it will.
- ASSERT_TRUE(channel_->WaitForConnected(
+ ASSERT_TRUE(channel->WaitForConnected(
grpc_timeout_milliseconds_to_deadline(kInitialBackOffMs * 2)));
const gpr_timespec t1 = gpr_now(GPR_CLOCK_MONOTONIC);
const grpc_millis waited_ms = gpr_time_to_millis(gpr_time_sub(t1, t0));
@@ -349,14 +391,15 @@ TEST_F(ClientLbEnd2endTest, PickFirstBackOffMinReconnect) {
constexpr int kMinReconnectBackOffMs = 1000;
args.SetInt(GRPC_ARG_MIN_RECONNECT_BACKOFF_MS, kMinReconnectBackOffMs);
const std::vector<int> ports = {grpc_pick_unused_port_or_die()};
- ResetStub("pick_first", args);
+ auto channel = BuildChannel("pick_first", args);
+ auto stub = BuildStub(channel);
SetNextResolution(ports);
// Make connection delay a 10% longer than it's willing to in order to make
// sure we are hitting the codepath that waits for the min reconnect backoff.
gpr_atm_rel_store(&g_connection_delay_ms, kMinReconnectBackOffMs * 1.10);
grpc_tcp_client_connect_impl = tcp_client_connect_with_delay;
const gpr_timespec t0 = gpr_now(GPR_CLOCK_MONOTONIC);
- channel_->WaitForConnected(
+ channel->WaitForConnected(
grpc_timeout_milliseconds_to_deadline(kMinReconnectBackOffMs * 2));
const gpr_timespec t1 = gpr_now(GPR_CLOCK_MONOTONIC);
const grpc_millis waited_ms = gpr_time_to_millis(gpr_time_sub(t1, t0));
@@ -371,14 +414,16 @@ TEST_F(ClientLbEnd2endTest, PickFirstUpdates) {
// Start servers and send one RPC per server.
const int kNumServers = 3;
StartServers(kNumServers);
- ResetStub("pick_first");
+ auto channel = BuildChannel("pick_first");
+ auto stub = BuildStub(channel);
+
std::vector<int> ports;
// Perform one RPC against the first server.
ports.emplace_back(servers_[0]->port_);
SetNextResolution(ports);
gpr_log(GPR_INFO, "****** SET [0] *******");
- CheckRpcSendOk();
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
EXPECT_EQ(servers_[0]->service_.request_count(), 1);
// An empty update will result in the channel going into TRANSIENT_FAILURE.
@@ -387,7 +432,7 @@ TEST_F(ClientLbEnd2endTest, PickFirstUpdates) {
gpr_log(GPR_INFO, "****** SET none *******");
grpc_connectivity_state channel_state;
do {
- channel_state = channel_->GetState(true /* try to connect */);
+ channel_state = channel->GetState(true /* try to connect */);
} while (channel_state == GRPC_CHANNEL_READY);
GPR_ASSERT(channel_state != GRPC_CHANNEL_READY);
servers_[0]->service_.ResetCounters();
@@ -397,7 +442,7 @@ TEST_F(ClientLbEnd2endTest, PickFirstUpdates) {
ports.emplace_back(servers_[1]->port_);
SetNextResolution(ports);
gpr_log(GPR_INFO, "****** SET [1] *******");
- WaitForServer(1);
+ WaitForServer(stub, 1, DEBUG_LOCATION);
EXPECT_EQ(servers_[0]->service_.request_count(), 0);
// And again for servers_[2]
@@ -405,26 +450,28 @@ TEST_F(ClientLbEnd2endTest, PickFirstUpdates) {
ports.emplace_back(servers_[2]->port_);
SetNextResolution(ports);
gpr_log(GPR_INFO, "****** SET [2] *******");
- WaitForServer(2);
+ WaitForServer(stub, 2, DEBUG_LOCATION);
EXPECT_EQ(servers_[0]->service_.request_count(), 0);
EXPECT_EQ(servers_[1]->service_.request_count(), 0);
// Check LB policy name for the channel.
- EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName());
+ EXPECT_EQ("pick_first", channel->GetLoadBalancingPolicyName());
}
TEST_F(ClientLbEnd2endTest, PickFirstUpdateSuperset) {
// Start servers and send one RPC per server.
const int kNumServers = 3;
StartServers(kNumServers);
- ResetStub("pick_first");
+ auto channel = BuildChannel("pick_first");
+ auto stub = BuildStub(channel);
+
std::vector<int> ports;
// Perform one RPC against the first server.
ports.emplace_back(servers_[0]->port_);
SetNextResolution(ports);
gpr_log(GPR_INFO, "****** SET [0] *******");
- CheckRpcSendOk();
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
EXPECT_EQ(servers_[0]->service_.request_count(), 1);
servers_[0]->service_.ResetCounters();
@@ -434,20 +481,21 @@ TEST_F(ClientLbEnd2endTest, PickFirstUpdateSuperset) {
ports.emplace_back(servers_[0]->port_);
SetNextResolution(ports);
gpr_log(GPR_INFO, "****** SET superset *******");
- CheckRpcSendOk();
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
// We stick to the previously connected server.
- WaitForServer(0);
+ WaitForServer(stub, 0, DEBUG_LOCATION);
EXPECT_EQ(0, servers_[1]->service_.request_count());
// Check LB policy name for the channel.
- EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName());
+ EXPECT_EQ("pick_first", channel->GetLoadBalancingPolicyName());
}
TEST_F(ClientLbEnd2endTest, PickFirstManyUpdates) {
// Start servers and send one RPC per server.
const int kNumServers = 3;
StartServers(kNumServers);
- ResetStub("pick_first");
+ auto channel = BuildChannel("pick_first");
+ auto stub = BuildStub(channel);
std::vector<int> ports;
for (size_t i = 0; i < servers_.size(); ++i) {
ports.emplace_back(servers_[i]->port_);
@@ -459,18 +507,19 @@ TEST_F(ClientLbEnd2endTest, PickFirstManyUpdates) {
std::shuffle(ports.begin(), ports.end(),
std::mt19937(std::random_device()()));
SetNextResolution(ports);
- if (i % 10 == 0) CheckRpcSendOk();
+ if (i % 10 == 0) CheckRpcSendOk(stub, DEBUG_LOCATION);
}
}
// Check LB policy name for the channel.
- EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName());
+ EXPECT_EQ("pick_first", channel->GetLoadBalancingPolicyName());
}
TEST_F(ClientLbEnd2endTest, RoundRobin) {
// Start servers and send one RPC per server.
const int kNumServers = 3;
StartServers(kNumServers);
- ResetStub("round_robin");
+ auto channel = BuildChannel("round_robin");
+ auto stub = BuildStub(channel);
std::vector<int> ports;
for (const auto& server : servers_) {
ports.emplace_back(server->port_);
@@ -478,15 +527,15 @@ TEST_F(ClientLbEnd2endTest, RoundRobin) {
SetNextResolution(ports);
// Wait until all backends are ready.
do {
- CheckRpcSendOk();
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
} while (!SeenAllServers());
ResetCounters();
// "Sync" to the end of the list. Next sequence of picks will start at the
// first server (index 0).
- WaitForServer(servers_.size() - 1);
+ WaitForServer(stub, servers_.size() - 1, DEBUG_LOCATION);
std::vector<int> connection_order;
for (size_t i = 0; i < servers_.size(); ++i) {
- CheckRpcSendOk();
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
UpdateConnectionOrder(servers_, &connection_order);
}
// Backends should be iterated over in the order in which the addresses were
@@ -494,22 +543,23 @@ TEST_F(ClientLbEnd2endTest, RoundRobin) {
const auto expected = std::vector<int>{0, 1, 2};
EXPECT_EQ(expected, connection_order);
// Check LB policy name for the channel.
- EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName());
+ EXPECT_EQ("round_robin", channel->GetLoadBalancingPolicyName());
}
TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
// Start servers and send one RPC per server.
const int kNumServers = 3;
StartServers(kNumServers);
- ResetStub("round_robin");
+ auto channel = BuildChannel("round_robin");
+ auto stub = BuildStub(channel);
std::vector<int> ports;
// Start with a single server.
ports.emplace_back(servers_[0]->port_);
SetNextResolution(ports);
- WaitForServer(0);
+ WaitForServer(stub, 0, DEBUG_LOCATION);
// Send RPCs. They should all go servers_[0]
- for (size_t i = 0; i < 10; ++i) CheckRpcSendOk();
+ for (size_t i = 0; i < 10; ++i) CheckRpcSendOk(stub, DEBUG_LOCATION);
EXPECT_EQ(10, servers_[0]->service_.request_count());
EXPECT_EQ(0, servers_[1]->service_.request_count());
EXPECT_EQ(0, servers_[2]->service_.request_count());
@@ -523,9 +573,9 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
// Wait until update has been processed, as signaled by the second backend
// receiving a request.
EXPECT_EQ(0, servers_[1]->service_.request_count());
- WaitForServer(1);
+ WaitForServer(stub, 1, DEBUG_LOCATION);
- for (size_t i = 0; i < 10; ++i) CheckRpcSendOk();
+ for (size_t i = 0; i < 10; ++i) CheckRpcSendOk(stub, DEBUG_LOCATION);
EXPECT_EQ(0, servers_[0]->service_.request_count());
EXPECT_EQ(10, servers_[1]->service_.request_count());
EXPECT_EQ(0, servers_[2]->service_.request_count());
@@ -535,9 +585,9 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
ports.clear();
ports.emplace_back(servers_[2]->port_);
SetNextResolution(ports);
- WaitForServer(2);
+ WaitForServer(stub, 2, DEBUG_LOCATION);
- for (size_t i = 0; i < 10; ++i) CheckRpcSendOk();
+ for (size_t i = 0; i < 10; ++i) CheckRpcSendOk(stub, DEBUG_LOCATION);
EXPECT_EQ(0, servers_[0]->service_.request_count());
EXPECT_EQ(0, servers_[1]->service_.request_count());
EXPECT_EQ(10, servers_[2]->service_.request_count());
@@ -549,12 +599,12 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
ports.emplace_back(servers_[1]->port_);
ports.emplace_back(servers_[2]->port_);
SetNextResolution(ports);
- WaitForServer(0);
- WaitForServer(1);
- WaitForServer(2);
+ WaitForServer(stub, 0, DEBUG_LOCATION);
+ WaitForServer(stub, 1, DEBUG_LOCATION);
+ WaitForServer(stub, 2, DEBUG_LOCATION);
// Send three RPCs, one per server.
- for (size_t i = 0; i < 3; ++i) CheckRpcSendOk();
+ for (size_t i = 0; i < 3; ++i) CheckRpcSendOk(stub, DEBUG_LOCATION);
EXPECT_EQ(1, servers_[0]->service_.request_count());
EXPECT_EQ(1, servers_[1]->service_.request_count());
EXPECT_EQ(1, servers_[2]->service_.request_count());
@@ -564,7 +614,7 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
SetNextResolution(ports);
grpc_connectivity_state channel_state;
do {
- channel_state = channel_->GetState(true /* try to connect */);
+ channel_state = channel->GetState(true /* try to connect */);
} while (channel_state == GRPC_CHANNEL_READY);
GPR_ASSERT(channel_state != GRPC_CHANNEL_READY);
servers_[0]->service_.ResetCounters();
@@ -573,26 +623,27 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
ports.clear();
ports.emplace_back(servers_[1]->port_);
SetNextResolution(ports);
- WaitForServer(1);
- channel_state = channel_->GetState(false /* try to connect */);
+ WaitForServer(stub, 1, DEBUG_LOCATION);
+ channel_state = channel->GetState(false /* try to connect */);
GPR_ASSERT(channel_state == GRPC_CHANNEL_READY);
// Check LB policy name for the channel.
- EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName());
+ EXPECT_EQ("round_robin", channel->GetLoadBalancingPolicyName());
}
TEST_F(ClientLbEnd2endTest, RoundRobinUpdateInError) {
const int kNumServers = 3;
StartServers(kNumServers);
- ResetStub("round_robin");
+ auto channel = BuildChannel("round_robin");
+ auto stub = BuildStub(channel);
std::vector<int> ports;
// Start with a single server.
ports.emplace_back(servers_[0]->port_);
SetNextResolution(ports);
- WaitForServer(0);
+ WaitForServer(stub, 0, DEBUG_LOCATION);
// Send RPCs. They should all go to servers_[0]
- for (size_t i = 0; i < 10; ++i) SendRpc();
+ for (size_t i = 0; i < 10; ++i) SendRpc(stub);
EXPECT_EQ(10, servers_[0]->service_.request_count());
EXPECT_EQ(0, servers_[1]->service_.request_count());
EXPECT_EQ(0, servers_[2]->service_.request_count());
@@ -603,11 +654,11 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdateInError) {
ports.emplace_back(servers_[1]->port_);
ports.emplace_back(servers_[2]->port_);
SetNextResolution(ports);
- WaitForServer(0);
- WaitForServer(2);
+ WaitForServer(stub, 0, DEBUG_LOCATION);
+ WaitForServer(stub, 2, DEBUG_LOCATION);
// Send three RPCs, one per server.
- for (size_t i = 0; i < kNumServers; ++i) SendRpc();
+ for (size_t i = 0; i < kNumServers; ++i) SendRpc(stub);
// The server in shutdown shouldn't receive any.
EXPECT_EQ(0, servers_[1]->service_.request_count());
}
@@ -616,7 +667,8 @@ TEST_F(ClientLbEnd2endTest, RoundRobinManyUpdates) {
// Start servers and send one RPC per server.
const int kNumServers = 3;
StartServers(kNumServers);
- ResetStub("round_robin");
+ auto channel = BuildChannel("round_robin");
+ auto stub = BuildStub(channel);
std::vector<int> ports;
for (size_t i = 0; i < servers_.size(); ++i) {
ports.emplace_back(servers_[i]->port_);
@@ -625,10 +677,10 @@ TEST_F(ClientLbEnd2endTest, RoundRobinManyUpdates) {
std::shuffle(ports.begin(), ports.end(),
std::mt19937(std::random_device()()));
SetNextResolution(ports);
- if (i % 10 == 0) CheckRpcSendOk();
+ if (i % 10 == 0) CheckRpcSendOk(stub, DEBUG_LOCATION);
}
// Check LB policy name for the channel.
- EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName());
+ EXPECT_EQ("round_robin", channel->GetLoadBalancingPolicyName());
}
TEST_F(ClientLbEnd2endTest, RoundRobinConcurrentUpdates) {
@@ -639,16 +691,21 @@ TEST_F(ClientLbEnd2endTest, RoundRobinConcurrentUpdates) {
TEST_F(ClientLbEnd2endTest, RoundRobinReresolve) {
// Start servers and send one RPC per server.
const int kNumServers = 3;
- std::vector<int> ports;
+ std::vector<int> first_ports;
+ std::vector<int> second_ports;
for (int i = 0; i < kNumServers; ++i) {
- ports.push_back(grpc_pick_unused_port_or_die());
+ first_ports.push_back(grpc_pick_unused_port_or_die());
}
- StartServers(kNumServers, ports);
- ResetStub("round_robin");
- SetNextResolution(ports);
+ for (int i = 0; i < kNumServers; ++i) {
+ second_ports.push_back(grpc_pick_unused_port_or_die());
+ }
+ StartServers(kNumServers, first_ports);
+ auto channel = BuildChannel("round_robin");
+ auto stub = BuildStub(channel);
+ SetNextResolution(first_ports);
// Send a number of RPCs, which succeed.
for (size_t i = 0; i < 100; ++i) {
- CheckRpcSendOk();
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
}
// Kill all servers
gpr_log(GPR_INFO, "****** ABOUT TO KILL SERVERS *******");
@@ -658,18 +715,25 @@ TEST_F(ClientLbEnd2endTest, RoundRobinReresolve) {
gpr_log(GPR_INFO, "****** SERVERS KILLED *******");
gpr_log(GPR_INFO, "****** SENDING DOOMED REQUESTS *******");
// Client requests should fail. Send enough to tickle all subchannels.
- for (size_t i = 0; i < servers_.size(); ++i) CheckRpcSendFailure();
+ for (size_t i = 0; i < servers_.size(); ++i) CheckRpcSendFailure(stub);
gpr_log(GPR_INFO, "****** DOOMED REQUESTS SENT *******");
- // Bring servers back up on the same port (we aren't recreating the channel).
+ // Bring servers back up on a different set of ports. We need to do this to be
+ // sure that the eventual success is *not* due to subchannel reconnection
+ // attempts and that an actual re-resolution has happened as a result of the
+ // RR policy going into transient failure when all its subchannels become
+ // unavailable (in transient failure as well).
gpr_log(GPR_INFO, "****** RESTARTING SERVERS *******");
- StartServers(kNumServers, ports);
+ StartServers(kNumServers, second_ports);
+ // Don't notify of the update. Wait for the LB policy's re-resolution to
+ // "pull" the new ports.
+ SetNextResolutionUponError(second_ports);
gpr_log(GPR_INFO, "****** SERVERS RESTARTED *******");
gpr_log(GPR_INFO, "****** SENDING REQUEST TO SUCCEED *******");
// Client request should eventually (but still fairly soon) succeed.
const gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5);
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
while (gpr_time_cmp(deadline, now) > 0) {
- if (SendRpc()) break;
+ if (SendRpc(stub)) break;
now = gpr_now(GPR_CLOCK_MONOTONIC);
}
GPR_ASSERT(gpr_time_cmp(deadline, now) > 0);
@@ -679,11 +743,13 @@ TEST_F(ClientLbEnd2endTest, RoundRobinSingleReconnect) {
const int kNumServers = 3;
StartServers(kNumServers);
const auto ports = GetServersPorts();
- ResetStub("round_robin");
+ auto channel = BuildChannel("round_robin");
+ auto stub = BuildStub(channel);
SetNextResolution(ports);
- for (size_t i = 0; i < kNumServers; ++i) WaitForServer(i);
+ for (size_t i = 0; i < kNumServers; ++i)
+ WaitForServer(stub, i, DEBUG_LOCATION);
for (size_t i = 0; i < servers_.size(); ++i) {
- CheckRpcSendOk();
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
EXPECT_EQ(1, servers_[i]->service_.request_count()) << "for backend #" << i;
}
// One request should have gone to each server.
@@ -695,10 +761,14 @@ TEST_F(ClientLbEnd2endTest, RoundRobinSingleReconnect) {
servers_[0]->Shutdown(true);
// Client request still succeed. May need retrying if RR had returned a pick
// before noticing the change in the server's connectivity.
- while (!SendRpc())
+ while (!SendRpc(stub)) {
; // Retry until success.
+ }
+ gpr_log(GPR_INFO, "------------------------------------------------------");
// Send a bunch of RPCs that should succeed.
- for (int i = 0; i < 10 * kNumServers; ++i) CheckRpcSendOk();
+ for (int i = 0; i < 10 * kNumServers; ++i) {
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
+ }
const auto post_death = servers_[0]->service_.request_count();
// No requests have gone to the deceased server.
EXPECT_EQ(pre_death, post_death);
@@ -708,7 +778,7 @@ TEST_F(ClientLbEnd2endTest, RoundRobinSingleReconnect) {
// the server managed to start before the RR policy retried the subchannel) or
// after the subchannel retry delay otherwise (RR's subchannel retried before
// the server was fully back up).
- WaitForServer(0);
+ WaitForServer(stub, 0, DEBUG_LOCATION);
}
} // namespace
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index 578f26e9c2..967db4c57c 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -350,7 +350,7 @@ static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs,
char bytes[8] = {'\0', '\1', '\2', '\3', '\4', '\5', '\6', (char)i};
context.AddMetadata("custom-bin", grpc::string(bytes, 8));
}
- context.set_compression_algorithm(GRPC_COMPRESS_MESSAGE_GZIP);
+ context.set_compression_algorithm(GRPC_COMPRESS_GZIP);
Status s = stub->Echo(&context, request, &response);
EXPECT_EQ(response.message(), request.message());
EXPECT_TRUE(s.ok());
diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc
index be99a1aea4..53e86addef 100644
--- a/test/cpp/end2end/filter_end2end_test.cc
+++ b/test/cpp/end2end/filter_end2end_test.cc
@@ -175,7 +175,8 @@ class FilterEnd2endTest : public ::testing::Test {
// The string needs to be long enough to test heap-based slice.
send_request.set_message("Hello world. Hello world. Hello world.");
std::unique_ptr<GenericClientAsyncReaderWriter> call =
- generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1));
+ generic_stub_->PrepareCall(&cli_ctx, kMethodName, &cli_cq_);
+ call->StartCall(tag(1));
client_ok(1);
std::unique_ptr<ByteBuffer> send_buffer =
SerializeToByteBuffer(&send_request);
@@ -265,10 +266,11 @@ TEST_F(FilterEnd2endTest, SimpleBidiStreaming) {
GenericServerContext srv_ctx;
GenericServerAsyncReaderWriter srv_stream(&srv_ctx);
- cli_ctx.set_compression_algorithm(GRPC_COMPRESS_MESSAGE_GZIP);
+ cli_ctx.set_compression_algorithm(GRPC_COMPRESS_GZIP);
send_request.set_message("Hello");
std::unique_ptr<GenericClientAsyncReaderWriter> cli_stream =
- generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1));
+ generic_stub_->PrepareCall(&cli_ctx, kMethodName, &cli_cq_);
+ cli_stream->StartCall(tag(1));
client_ok(1);
generic_service_.RequestCall(&srv_ctx, &srv_stream, srv_cq_.get(),
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index bf432844cb..dac5faed8f 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -125,7 +125,8 @@ class GenericEnd2endTest : public ::testing::Test {
}
std::unique_ptr<GenericClientAsyncReaderWriter> call =
- generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1));
+ generic_stub_->PrepareCall(&cli_ctx, kMethodName, &cli_cq_);
+ call->StartCall(tag(1));
client_ok(1);
std::unique_ptr<ByteBuffer> send_buffer =
SerializeToByteBuffer(&send_request);
@@ -268,10 +269,11 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) {
GenericServerContext srv_ctx;
GenericServerAsyncReaderWriter srv_stream(&srv_ctx);
- cli_ctx.set_compression_algorithm(GRPC_COMPRESS_MESSAGE_GZIP);
+ cli_ctx.set_compression_algorithm(GRPC_COMPRESS_GZIP);
send_request.set_message("Hello");
std::unique_ptr<GenericClientAsyncReaderWriter> cli_stream =
- generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1));
+ generic_stub_->PrepareCall(&cli_ctx, kMethodName, &cli_cq_);
+ cli_stream->StartCall(tag(1));
client_ok(1);
generic_service_.RequestCall(&srv_ctx, &srv_stream, srv_cq_.get(),
diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc
index 78527587cf..5591acf880 100644
--- a/test/cpp/end2end/grpclb_end2end_test.cc
+++ b/test/cpp/end2end/grpclb_end2end_test.cc
@@ -454,8 +454,8 @@ class GrpclbEnd2endTest : public ::testing::Test {
grpc::string balancer_name;
};
- void SetNextResolution(const std::vector<AddressData>& address_data) {
- grpc_core::ExecCtx exec_ctx;
+ grpc_lb_addresses* CreateLbAddressesFromAddressDataList(
+ const std::vector<AddressData>& address_data) {
grpc_lb_addresses* addresses =
grpc_lb_addresses_create(address_data.size(), nullptr);
for (size_t i = 0; i < address_data.size(); ++i) {
@@ -469,6 +469,13 @@ class GrpclbEnd2endTest : public ::testing::Test {
grpc_uri_destroy(lb_uri);
gpr_free(lb_uri_str);
}
+ return addresses;
+ }
+
+ void SetNextResolution(const std::vector<AddressData>& address_data) {
+ grpc_core::ExecCtx exec_ctx;
+ grpc_lb_addresses* addresses =
+ CreateLbAddressesFromAddressDataList(address_data);
grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
grpc_channel_args fake_result = {1, &fake_addresses};
grpc_fake_resolver_response_generator_set_response(response_generator_,
@@ -476,6 +483,18 @@ class GrpclbEnd2endTest : public ::testing::Test {
grpc_lb_addresses_destroy(addresses);
}
+ void SetNextResolutionUponError(
+ const std::vector<AddressData>& address_data) {
+ grpc_core::ExecCtx exec_ctx;
+ grpc_lb_addresses* addresses =
+ CreateLbAddressesFromAddressDataList(address_data);
+ grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
+ grpc_channel_args fake_result = {1, &fake_addresses};
+ grpc_fake_resolver_response_generator_set_response_upon_error(
+ response_generator_, &fake_result);
+ grpc_lb_addresses_destroy(addresses);
+ }
+
const std::vector<int> GetBackendPorts(const size_t start_index = 0) const {
std::vector<int> backend_ports;
for (size_t i = start_index; i < backend_servers_.size(); ++i) {
diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc
index a1ce4ebc81..2951a2ebcf 100644
--- a/test/cpp/end2end/server_builder_plugin_test.cc
+++ b/test/cpp/end2end/server_builder_plugin_test.cc
@@ -251,7 +251,7 @@ TEST_P(ServerBuilderPluginTest, PluginWithServiceTest) {
EchoResponse response;
request.set_message("Hello hello hello hello");
ClientContext context;
- context.set_compression_algorithm(GRPC_COMPRESS_MESSAGE_GZIP);
+ context.set_compression_algorithm(GRPC_COMPRESS_GZIP);
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(response.message(), request.message());
EXPECT_TRUE(s.ok());
diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc
index d241594af1..4a9fd7ce76 100644
--- a/test/cpp/grpclb/grpclb_test.cc
+++ b/test/cpp/grpclb/grpclb_test.cc
@@ -27,7 +27,6 @@
#include <grpc/grpc.h>
#include <grpc/impl/codegen/byte_buffer_reader.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
@@ -41,6 +40,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tmpfile.h"
#include "src/core/lib/iomgr/sockaddr.h"
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index eab59c72ab..3051afa86b 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -188,7 +188,7 @@ bool InteropClient::PerformLargeUnary(SimpleRequest* request,
request->mutable_payload()->set_body(payload.c_str(), kLargeRequestSize);
if (request->has_expect_compressed()) {
if (request->expect_compressed().value()) {
- context.set_compression_algorithm(GRPC_COMPRESS_MESSAGE_GZIP);
+ context.set_compression_algorithm(GRPC_COMPRESS_GZIP);
} else {
context.set_compression_algorithm(GRPC_COMPRESS_NONE);
}
@@ -496,7 +496,7 @@ bool InteropClient::DoClientCompressedStreaming() {
StreamingInputCallRequest request;
StreamingInputCallResponse response;
- context.set_compression_algorithm(GRPC_COMPRESS_MESSAGE_GZIP);
+ context.set_compression_algorithm(GRPC_COMPRESS_GZIP);
std::unique_ptr<ClientWriter<StreamingInputCallRequest>> stream(
serviceStub_.Get()->StreamingInputCall(&context, &response));
diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc
index 563b7abb5e..ae155b65f9 100644
--- a/test/cpp/interop/interop_test.cc
+++ b/test/cpp/interop/interop_test.cc
@@ -31,12 +31,12 @@
#include <gflags/gflags.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "test/core/util/port.h"
#include "test/cpp/util/test_config.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h
index d73caa01c8..fdc04e51c6 100644
--- a/test/cpp/microbenchmarks/fullstack_fixtures.h
+++ b/test/cpp/microbenchmarks/fullstack_fixtures.h
@@ -61,6 +61,15 @@ class FixtureConfiguration {
class BaseFixture : public TrackCounters {};
+// Special tag to be used in Server shutdown. This tag is *NEVER* returned when
+// Cq->Next() API is called (This is because FinalizeResult() function in this
+// class always returns 'false'). This is intentional and makes writing shutdown
+// code easier.
+class ShutdownTag : public internal::CompletionQueueTag {
+ public:
+ bool FinalizeResult(void** tag, bool* status) { return false; }
+};
+
class FullstackFixture : public BaseFixture {
public:
FullstackFixture(Service* service, const FixtureConfiguration& config,
@@ -84,7 +93,11 @@ class FullstackFixture : public BaseFixture {
}
virtual ~FullstackFixture() {
- server_->Shutdown(gpr_inf_past(GPR_CLOCK_MONOTONIC));
+ // Dummy shutdown tag (this tag is swallowed by cq->Next() and is not
+ // returned to the user) see ShutdownTag definition for more details
+ ShutdownTag shutdown_tag;
+ grpc_server_shutdown_and_notify(server_->c_server(), cq_->cq(),
+ &shutdown_tag);
cq_->Shutdown();
void* tag;
bool ok;
@@ -208,7 +221,11 @@ class EndpointPairFixture : public BaseFixture {
}
virtual ~EndpointPairFixture() {
- server_->Shutdown(gpr_inf_past(GPR_CLOCK_MONOTONIC));
+ // Dummy shutdown tag (this tag is swallowed by cq->Next() and is not
+ // returned to the user) see ShutdownTag definition for more details
+ ShutdownTag shutdown_tag;
+ grpc_server_shutdown_and_notify(server_->c_server(), cq_->cq(),
+ &shutdown_tag);
cq_->Shutdown();
void* tag;
bool ok;
diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc
index 8b5523f01a..aad2fa5f75 100644
--- a/test/cpp/naming/resolver_component_test.cc
+++ b/test/cpp/naming/resolver_component_test.cc
@@ -18,7 +18,6 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
@@ -38,6 +37,7 @@
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/executor.h"
diff --git a/test/cpp/performance/BUILD b/test/cpp/performance/BUILD
new file mode 100644
index 0000000000..4fe95d5905
--- /dev/null
+++ b/test/cpp/performance/BUILD
@@ -0,0 +1,34 @@
+# Copyright 2017 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.
+
+licenses(["notice"]) # Apache v2
+
+load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
+
+grpc_package(name = "test/cpp/performance")
+
+grpc_cc_test(
+ name = "writes_per_rpc_test",
+ srcs = ["writes_per_rpc_test.cc"],
+ external_deps = [
+ "gtest",
+ ],
+ deps = [
+ "//:gpr",
+ "//:grpc",
+ "//:grpc++",
+ "//src/proto/grpc/testing:echo_proto",
+ "//test/core/util:grpc_test_util_base",
+ ],
+)
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index a2ddbeb508..8c1d9417fa 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -30,10 +30,10 @@
#include <grpc++/server_builder.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/profiling/timers.h"
#include "src/proto/grpc/testing/services.grpc.pb.h"
#include "test/cpp/qps/client.h"
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index a809a27e3c..4e0d266d77 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -27,11 +27,11 @@
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/profiling/timers.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc
index 4c9ab0ea43..215a7bfbc9 100644
--- a/test/cpp/qps/qps_worker.cc
+++ b/test/cpp/qps/qps_worker.cc
@@ -32,9 +32,9 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cpu.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/proto/grpc/testing/services.pb.h"
#include "test/core/util/grpc_profiler.h"
#include "test/core/util/histogram.h"
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 72ae772147..b88b88445c 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -32,9 +32,9 @@
#include <grpc++/support/config.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/completion_queue.h"
#include "src/proto/grpc/testing/services.grpc.pb.h"
#include "test/core/util/test_config.h"
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index ea89a30e2e..19cbb53445 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -24,8 +24,8 @@
#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
+#include "src/core/lib/gpr/host_port.h"
#include "src/proto/grpc/testing/services.grpc.pb.h"
#include "test/cpp/qps/server.h"
#include "test/cpp/qps/usage_timer.h"
diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc
index 4f1a20c727..3b0bb9eeba 100644
--- a/test/cpp/util/cli_call.cc
+++ b/test/cpp/util/cli_call.cc
@@ -60,7 +60,8 @@ CliCall::CliCall(std::shared_ptr<grpc::Channel> channel,
ctx_.AddMetadata(iter->first, iter->second);
}
}
- call_ = stub_->Call(&ctx_, method, &cq_, tag(1));
+ call_ = stub_->PrepareCall(&ctx_, method, &cq_);
+ call_->StartCall(tag(1));
void* got_tag;
bool ok;
cq_.Next(&got_tag, &ok);
diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc
index 0f77934672..42b1f4e75c 100644
--- a/test/cpp/util/proto_reflection_descriptor_database.cc
+++ b/test/cpp/util/proto_reflection_descriptor_database.cc
@@ -43,6 +43,11 @@ ProtoReflectionDescriptorDatabase::~ProtoReflectionDescriptorDatabase() {
stream_->WritesDone();
Status status = stream_->Finish();
if (!status.ok()) {
+ if (status.error_code() == StatusCode::UNIMPLEMENTED) {
+ gpr_log(GPR_INFO,
+ "Reflection request not implemented; "
+ "is the ServerReflection service enabled?");
+ }
gpr_log(GPR_INFO,
"ServerReflectionInfo rpc failed. Error code: %d, details: %s",
(int)status.error_code(), status.error_message().c_str());
@@ -64,7 +69,9 @@ bool ProtoReflectionDescriptorDatabase::FindFileByName(
request.set_file_by_filename(filename);
ServerReflectionResponse response;
- DoOneRequest(request, response);
+ if (!DoOneRequest(request, response)) {
+ return false;
+ }
if (response.message_response_case() ==
ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) {
@@ -109,7 +116,9 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol(
request.set_file_containing_symbol(symbol_name);
ServerReflectionResponse response;
- DoOneRequest(request, response);
+ if (!DoOneRequest(request, response)) {
+ return false;
+ }
if (response.message_response_case() ==
ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) {
@@ -163,7 +172,9 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension(
field_number);
ServerReflectionResponse response;
- DoOneRequest(request, response);
+ if (!DoOneRequest(request, response)) {
+ return false;
+ }
if (response.message_response_case() ==
ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) {
@@ -213,7 +224,9 @@ bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers(
request.set_all_extension_numbers_of_type(extendee_type);
ServerReflectionResponse response;
- DoOneRequest(request, response);
+ if (!DoOneRequest(request, response)) {
+ return false;
+ }
if (response.message_response_case() ==
ServerReflectionResponse::MessageResponseCase::
@@ -245,7 +258,9 @@ bool ProtoReflectionDescriptorDatabase::GetServices(
request.set_list_services("");
ServerReflectionResponse response;
- DoOneRequest(request, response);
+ if (!DoOneRequest(request, response)) {
+ return false;
+ }
if (response.message_response_case() ==
ServerReflectionResponse::MessageResponseCase::kListServicesResponse) {
diff --git a/test/distrib/cpp/run_distrib_test_cmake.bat b/test/distrib/cpp/run_distrib_test_cmake.bat
index f920768ae3..8eb3b201b1 100644
--- a/test/distrib/cpp/run_distrib_test_cmake.bat
+++ b/test/distrib/cpp/run_distrib_test_cmake.bat
@@ -54,7 +54,7 @@ cd ../../../..
cd cmake
mkdir build
cd build
-cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DOPENSSL_ROOT_DIR=%OPENSSL_DIR% -DOPENSSL_INCLUDE_DIR=%OPENSSL_DIR%/include -DZLIB_LIBRARY=%INSTALL_DIR%/lib/zlibstatic.lib -DZLIB_INCLUDE_DIR=%INSTALL_DIR%/include -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DCMAKE_BUILD_TYPE=Release ../.. || goto :error
+cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DOPENSSL_ROOT_DIR=%OPENSSL_DIR% -DZLIB_ROOT=%INSTALL_DIR% -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DCMAKE_BUILD_TYPE=Release ../.. || goto :error
cmake --build . --config Release --target install || goto :error
cd ../..
@@ -64,7 +64,7 @@ mkdir cmake
cd cmake
mkdir build
cd build
-cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DOPENSSL_ROOT_DIR=%OPENSSL_DIR% -DOPENSSL_INCLUDE_DIR=%OPENSSL_DIR%/include ../.. || goto :error
+cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DOPENSSL_ROOT_DIR=%OPENSSL_DIR% -DZLIB_ROOT=%INSTALL_DIR% ../.. || goto :error
cmake --build . --config Release || goto :error
cd ../../../../..
diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py
index d4c0052b28..066f28416d 100755
--- a/tools/codegen/core/gen_static_metadata.py
+++ b/tools/codegen/core/gen_static_metadata.py
@@ -54,8 +54,8 @@ CONFIG = [
# well known method names
'/grpc.lb.v1.LoadBalancer/BalanceLoad',
# compression algorithm names
- 'message/deflate',
- 'message/gzip',
+ 'deflate',
+ 'gzip',
'stream/gzip',
# metadata elements
('grpc-status', '0'),
diff --git a/tools/distrib/clang_format_code.sh b/tools/distrib/clang_format_code.sh
index 9233a230c9..cd7553e917 100755
--- a/tools/distrib/clang_format_code.sh
+++ b/tools/distrib/clang_format_code.sh
@@ -25,7 +25,9 @@ then
docker build -t grpc_clang_format tools/dockerfile/grpc_clang_format
# run clang-format against the checked out codebase
- docker run -e TEST=$TEST -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_FORMAT_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code -t grpc_clang_format /clang_format_all_the_things.sh
+ # when modifying the checked-out files, the current user will be impersonated
+ # so that the updated files don't end up being owned by "root".
+ docker run -e TEST="$TEST" -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_FORMAT_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code --user "$(id -u):$(id -g)" -t grpc_clang_format /clang_format_all_the_things.sh
else
CLANG_FORMAT_ROOT="${REPO_ROOT}" tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
fi
diff --git a/tools/distrib/clang_tidy_code.sh b/tools/distrib/clang_tidy_code.sh
index 5da86aa277..9262b6bd3e 100755
--- a/tools/distrib/clang_tidy_code.sh
+++ b/tools/distrib/clang_tidy_code.sh
@@ -27,7 +27,9 @@ then
docker build -t grpc_clang_tidy tools/dockerfile/grpc_clang_tidy
# run clang-tidy against the checked out codebase
- docker run -e TEST=$TEST -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_TIDY_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code -t grpc_clang_tidy /clang_tidy_all_the_things.sh "$@"
+ # when modifying the checked-out files, the current user will be impersonated
+ # so that the updated files don't end up being owned by "root".
+ docker run -e TEST="$TEST" -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_TIDY_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code --user "$(id -u):$(id -g)" -t grpc_clang_tidy /clang_tidy_all_the_things.sh "$@"
else
CLANG_TIDY_ROOT="${REPO_ROOT}" tools/dockerfile/grpc_clang_tidy/clang_tidy_all_the_things.sh "$@"
fi
diff --git a/tools/dockerfile/grpc_clang_format/Dockerfile b/tools/dockerfile/grpc_clang_format/Dockerfile
index 8801315bc9..ecdc52ee31 100644
--- a/tools/dockerfile/grpc_clang_format/Dockerfile
+++ b/tools/dockerfile/grpc_clang_format/Dockerfile
@@ -23,4 +23,9 @@ RUN ln -s /clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/clang-tidy /usr/local/b
ENV CLANG_TIDY=clang-tidy
ADD clang_format_all_the_things.sh /
+
+# When running locally, we'll be impersonating the current user, so we need
+# to make the script runnable by everyone.
+RUN chmod a+rx /clang_format_all_the_things.sh
+
CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"]
diff --git a/tools/dockerfile/grpc_clang_tidy/Dockerfile b/tools/dockerfile/grpc_clang_tidy/Dockerfile
index 9d9d70185b..eeba455341 100644
--- a/tools/dockerfile/grpc_clang_tidy/Dockerfile
+++ b/tools/dockerfile/grpc_clang_tidy/Dockerfile
@@ -38,4 +38,9 @@ RUN pip install virtualenv
RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.0.post1 six==1.10.0 twisted==17.5.0
ADD clang_tidy_all_the_things.sh /
+
+# When running locally, we'll be impersonating the current user, so we need
+# to make the script runnable by everyone.
+RUN chmod a+rx /clang_tidy_all_the_things.sh
+
CMD ["echo 'Run with tools/distrib/clang_tidy_code.sh'"]
diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++
index 29034ca8d9..979839ad3e 100644
--- a/tools/doxygen/Doxyfile.c++
+++ b/tools/doxygen/Doxyfile.c++
@@ -875,7 +875,6 @@ include/grpc++/support/time.h \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/compression.h \
-include/grpc/compression_ruby.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
@@ -912,7 +911,6 @@ include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
-include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index 356bda0fd5..2659e7e3d5 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -876,7 +876,6 @@ include/grpc++/support/time.h \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/compression.h \
-include/grpc/compression_ruby.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
@@ -913,7 +912,6 @@ include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
-include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
@@ -954,6 +952,7 @@ src/core/lib/debug/trace.h \
src/core/lib/gpr/arena.h \
src/core/lib/gpr/env.h \
src/core/lib/gpr/fork.h \
+src/core/lib/gpr/host_port.h \
src/core/lib/gpr/mpscq.h \
src/core/lib/gpr/murmur_hash.h \
src/core/lib/gpr/spinlock.h \
diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core
index 6c5bf0fe2b..de349232ed 100644
--- a/tools/doxygen/Doxyfile.core
+++ b/tools/doxygen/Doxyfile.core
@@ -801,7 +801,6 @@ include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/census.h \
include/grpc/compression.h \
-include/grpc/compression_ruby.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
@@ -852,7 +851,6 @@ include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
-include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index 9614a31c17..91c3eb745c 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -801,7 +801,6 @@ include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/census.h \
include/grpc/compression.h \
-include/grpc/compression_ruby.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
@@ -852,7 +851,6 @@ include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
-include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
@@ -1053,7 +1051,6 @@ src/core/lib/compression/algorithm_metadata.h \
src/core/lib/compression/compression.cc \
src/core/lib/compression/compression_internal.cc \
src/core/lib/compression/compression_internal.h \
-src/core/lib/compression/compression_ruby.cc \
src/core/lib/compression/message_compress.cc \
src/core/lib/compression/message_compress.h \
src/core/lib/compression/stream_compression.cc \
@@ -1085,6 +1082,7 @@ src/core/lib/gpr/env_windows.cc \
src/core/lib/gpr/fork.cc \
src/core/lib/gpr/fork.h \
src/core/lib/gpr/host_port.cc \
+src/core/lib/gpr/host_port.h \
src/core/lib/gpr/log.cc \
src/core/lib/gpr/log_android.cc \
src/core/lib/gpr/log_linux.cc \
diff --git a/tools/internal_ci/helper_scripts/prepare_build_linux_rc b/tools/internal_ci/helper_scripts/prepare_build_linux_rc
index 8715d6c8e0..74bbc85d72 100644
--- a/tools/internal_ci/helper_scripts/prepare_build_linux_rc
+++ b/tools/internal_ci/helper_scripts/prepare_build_linux_rc
@@ -27,11 +27,6 @@ echo 'DOCKER_OPTS="${DOCKER_OPTS} --graph=/tmpfs/docker"' | sudo tee --append /e
echo 'DOCKER_OPTS="${DOCKER_OPTS} --registry-mirror=https://mirror.gcr.io"' | sudo tee --append /etc/default/docker
sudo service docker restart
-# Populate xdg-cache-home to workaround https://github.com/grpc/grpc/issues/11968
-sudo mkdir -p /tmp/xdg-cache-home
-PYTHONWARNINGS=ignore XDG_CACHE_HOME=/tmp/xdg-cache-home sudo -E pip install setuptools wheel
-PYTHONWARNINGS=ignore XDG_CACHE_HOME=/tmp/xdg-cache-home sudo -E pip install coverage==4.4 pylint==1.6.5
-
# Download Docker images from DockerHub
export DOCKERHUB_ORGANIZATION=grpctesting
diff --git a/tools/internal_ci/linux/grpc_build_submodule_at_head.sh b/tools/internal_ci/linux/grpc_build_submodule_at_head.sh
index e203a62b08..e68a2897f6 100755
--- a/tools/internal_ci/linux/grpc_build_submodule_at_head.sh
+++ b/tools/internal_ci/linux/grpc_build_submodule_at_head.sh
@@ -23,9 +23,8 @@ cd $(dirname $0)/../../..
source tools/internal_ci/helper_scripts/prepare_build_linux_rc
# Update submodule and commit it so changes are passed to Docker
-(cd third_party/$RUN_TESTS_FLAGS && git pull origin master)
+(cd third_party/$RUN_TESTS_FLAGS && git fetch --all && git checkout origin/master)
tools/buildgen/generate_projects.sh
git -c user.name='foo' -c user.email='foo@google.com' commit -a -m 'Update submodule'
tools/run_tests/run_tests_matrix.py -f linux --inner_jobs 4 -j 4 --internal_ci --build_only
-
diff --git a/tools/internal_ci/linux/grpc_full_performance_master.sh b/tools/internal_ci/linux/grpc_full_performance_master.sh
index 18468395f6..4eddc18731 100755
--- a/tools/internal_ci/linux/grpc_full_performance_master.sh
+++ b/tools/internal_ci/linux/grpc_full_performance_master.sh
@@ -26,7 +26,7 @@ tools/run_tests/run_performance_tests.py \
--category scalable \
--remote_worker_host grpc-kokoro-performance-server-8core grpc-kokoro-performance-client-8core grpc-kokoro-performance-client2-8core \
-u kbuilder \
- --bq_result_table performance_test.kokoro_performance_experiment \
+ --bq_result_table performance_test.performance_experiment \
--xml_report reports/8core/sponge_log.xml \
|| EXIT_CODE=1
@@ -40,7 +40,7 @@ tools/run_tests/run_performance_tests.py \
--category scalable \
--remote_worker_host grpc-kokoro-performance-server-32core grpc-kokoro-performance-client-32core grpc-kokoro-performance-client2-32core \
-u kbuilder \
- --bq_result_table performance_test.kokoro_performance_experiment_32core \
+ --bq_result_table performance_test.performance_experiment_32core \
--xml_report reports/32core/sponge_log.xml \
|| EXIT_CODE=1
@@ -52,7 +52,7 @@ tools/run_tests/run_performance_tests.py \
-l csharp \
--category scalable \
--remote_worker_host grpc-kokoro-performance-windows1 grpc-kokoro-performance-windows2 \
- --bq_result_table performance_test.kokoro_performance_experiment_windows \
+ --bq_result_table performance_test.performance_experiment_windows \
--xml_report reports/windows/sponge_log.xml \
|| EXIT_CODE=1
diff --git a/tools/internal_ci/linux/grpc_full_performance_release.cfg b/tools/internal_ci/linux/grpc_full_performance_release.cfg
new file mode 100644
index 0000000000..e9a4bcdcaf
--- /dev/null
+++ b/tools/internal_ci/linux/grpc_full_performance_release.cfg
@@ -0,0 +1,25 @@
+# Copyright 2017 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.
+
+# Config file for the internal CI (in protobuf text format)
+
+# Location of the continuous shell script in repository.
+build_file: "grpc/tools/internal_ci/linux/grpc_full_performance_release.sh"
+timeout_mins: 600
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ regex: "**/perf_reports/**"
+ }
+}
diff --git a/tools/internal_ci/linux/grpc_full_performance_release.sh b/tools/internal_ci/linux/grpc_full_performance_release.sh
new file mode 100755
index 0000000000..a31cea281f
--- /dev/null
+++ b/tools/internal_ci/linux/grpc_full_performance_release.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+# Copyright 2017 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.
+set -ex
+
+# Enter the gRPC repo root
+cd $(dirname $0)/../../..
+
+source tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc
+
+# run 8core client vs 8core server
+tools/run_tests/run_performance_tests.py \
+ -l c++ csharp ruby java python go php7 php7_protobuf_c \
+ --netperf \
+ --category scalable \
+ --remote_worker_host grpc-kokoro-performance-server-8core grpc-kokoro-performance-client-8core grpc-kokoro-performance-client2-8core \
+ -u kbuilder \
+ --bq_result_table performance_released.performance_experiment \
+ --xml_report reports/8core/sponge_log.xml \
+ || EXIT_CODE=1
+
+# prevent pushing leftover build files to remote hosts in the next step.
+git clean -fdxq -e reports
+
+# scalability with 32cores (and upload to a different BQ table)
+tools/run_tests/run_performance_tests.py \
+ -l c++ java csharp go \
+ --netperf \
+ --category scalable \
+ --remote_worker_host grpc-kokoro-performance-server-32core grpc-kokoro-performance-client-32core grpc-kokoro-performance-client2-32core \
+ -u kbuilder \
+ --bq_result_table performance_released.performance_experiment_32core \
+ --xml_report reports/32core/sponge_log.xml \
+ || EXIT_CODE=1
+
+# prevent pushing leftover build files to remote hosts in the next step.
+git clean -fdxq -e reports
+
+# selected scenarios on Windows
+tools/run_tests/run_performance_tests.py \
+ -l csharp \
+ --category scalable \
+ --remote_worker_host grpc-kokoro-performance-windows1 grpc-kokoro-performance-windows2 \
+ --bq_result_table performance_released.performance_experiment_windows \
+ --xml_report reports/windows/sponge_log.xml \
+ || EXIT_CODE=1
+
+exit $EXIT_CODE
diff --git a/tools/run_tests/artifacts/build_artifact_python.bat b/tools/run_tests/artifacts/build_artifact_python.bat
index 3a0564129c..d277668c94 100644
--- a/tools/run_tests/artifacts/build_artifact_python.bat
+++ b/tools/run_tests/artifacts/build_artifact_python.bat
@@ -16,7 +16,8 @@
set PATH=C:\%1;C:\%1\scripts;C:\msys64\mingw%2\bin;C:\tools\msys64\mingw%2\bin;%PATH%
pip install --upgrade six
-pip install --upgrade setuptools
+@rem some artifacts are broken for setuptools 38.5.0. See https://github.com/grpc/grpc/issues/14317
+pip install --upgrade setuptools==38.2.4
pip install -rrequirements.txt
set GRPC_PYTHON_BUILD_WITH_CYTHON=1
diff --git a/tools/run_tests/dockerize/build_docker_and_run_tests.sh b/tools/run_tests/dockerize/build_docker_and_run_tests.sh
index 8dca05ea35..21eccbaac9 100755
--- a/tools/run_tests/dockerize/build_docker_and_run_tests.sh
+++ b/tools/run_tests/dockerize/build_docker_and_run_tests.sh
@@ -25,10 +25,6 @@ cd -
# Ensure existence of ccache directory
mkdir -p /tmp/ccache
-# Ensure existence of the home directory for XDG caches (e.g. what pip uses for
-# its cache location now that --download-cache is deprecated).
-mkdir -p /tmp/xdg-cache-home
-
# Inputs
# DOCKERFILE_DIR - Directory in which Dockerfile file is located.
# DOCKER_RUN_SCRIPT - Script to run under docker (relative to grpc repo root)
@@ -61,7 +57,6 @@ docker run \
-e "config=$config" \
-e "arch=$arch" \
-e CCACHE_DIR=/tmp/ccache \
- -e XDG_CACHE_HOME=/tmp/xdg-cache-home \
-e THIS_IS_REALLY_NEEDED='see https://github.com/docker/docker/issues/14203 for why docker is awful' \
-e HOST_GIT_ROOT="$git_root" \
-e LOCAL_GIT_ROOT=$docker_instance_git_root \
@@ -79,7 +74,6 @@ docker run \
-v "$git_root:$docker_instance_git_root" \
-v /tmp/ccache:/tmp/ccache \
-v /tmp/npm-cache:/tmp/npm-cache \
- -v /tmp/xdg-cache-home:/tmp/xdg-cache-home \
-w /var/local/git/grpc \
--name="$CONTAINER_NAME" \
"$DOCKER_IMAGE_NAME" \
diff --git a/tools/run_tests/dockerize/docker_run_tests.sh b/tools/run_tests/dockerize/docker_run_tests.sh
index df9d3d1ca2..89ee315fd2 100755
--- a/tools/run_tests/dockerize/docker_run_tests.sh
+++ b/tools/run_tests/dockerize/docker_run_tests.sh
@@ -22,10 +22,6 @@ export CONFIG=$config
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer
export PATH=$PATH:/usr/bin/llvm-symbolizer
-# Ensure that programs depending on current-user-ownership of cache directories
-# are satisfied (it's being mounted from outside the image).
-chown "$(whoami)" "$XDG_CACHE_HOME"
-
mkdir -p /var/local/git
git clone /var/local/jenkins/grpc /var/local/git/grpc
# clone gRPC submodules, use data from locally cloned submodules where possible
diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json
index 8067748fed..120ce3f990 100644
--- a/tools/run_tests/generated/sources_and_headers.json
+++ b/tools/run_tests/generated/sources_and_headers.json
@@ -1484,23 +1484,6 @@
"headers": [],
"is_filegroup": false,
"language": "c",
- "name": "lb_policies_test",
- "src": [
- "test/core/client_channel/lb_policies_test.cc"
- ],
- "third_party": false,
- "type": "target"
- },
- {
- "deps": [
- "gpr",
- "gpr_test_util",
- "grpc",
- "grpc_test_util"
- ],
- "headers": [],
- "is_filegroup": false,
- "language": "c",
"name": "load_file_test",
"src": [
"test/core/iomgr/load_file_test.cc"
@@ -5145,6 +5128,24 @@
"headers": [],
"is_filegroup": false,
"language": "c",
+ "name": "duplicate_header_bad_client_test",
+ "src": [
+ "test/core/bad_client/tests/duplicate_header.cc"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
+ "bad_client_test",
+ "gpr",
+ "gpr_test_util",
+ "grpc_test_util_unsecure",
+ "grpc_unsecure"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c",
"name": "head_of_line_blocking_bad_client_test",
"src": [
"test/core/bad_client/tests/head_of_line_blocking.cc"
@@ -8228,7 +8229,6 @@
"include/grpc/support/atm_windows.h",
"include/grpc/support/cmdline.h",
"include/grpc/support/cpu.h",
- "include/grpc/support/host_port.h",
"include/grpc/support/log.h",
"include/grpc/support/log_windows.h",
"include/grpc/support/port_platform.h",
@@ -8248,6 +8248,7 @@
"src/core/lib/gpr/arena.h",
"src/core/lib/gpr/env.h",
"src/core/lib/gpr/fork.h",
+ "src/core/lib/gpr/host_port.h",
"src/core/lib/gpr/mpscq.h",
"src/core/lib/gpr/murmur_hash.h",
"src/core/lib/gpr/spinlock.h",
@@ -8276,7 +8277,6 @@
"include/grpc/support/atm_windows.h",
"include/grpc/support/cmdline.h",
"include/grpc/support/cpu.h",
- "include/grpc/support/host_port.h",
"include/grpc/support/log.h",
"include/grpc/support/log_windows.h",
"include/grpc/support/port_platform.h",
@@ -8296,6 +8296,7 @@
"src/core/lib/gpr/arena.h",
"src/core/lib/gpr/env.h",
"src/core/lib/gpr/fork.h",
+ "src/core/lib/gpr/host_port.h",
"src/core/lib/gpr/mpscq.h",
"src/core/lib/gpr/murmur_hash.h",
"src/core/lib/gpr/spinlock.h",
@@ -8407,7 +8408,6 @@
"src/core/lib/channel/handshaker_registry.cc",
"src/core/lib/compression/compression.cc",
"src/core/lib/compression/compression_internal.cc",
- "src/core/lib/compression/compression_ruby.cc",
"src/core/lib/compression/message_compress.cc",
"src/core/lib/compression/stream_compression.cc",
"src/core/lib/compression/stream_compression_gzip.cc",
@@ -8545,7 +8545,6 @@
"include/grpc/byte_buffer.h",
"include/grpc/byte_buffer_reader.h",
"include/grpc/compression.h",
- "include/grpc/compression_ruby.h",
"include/grpc/fork.h",
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
@@ -8688,7 +8687,6 @@
"include/grpc/byte_buffer.h",
"include/grpc/byte_buffer_reader.h",
"include/grpc/compression.h",
- "include/grpc/compression_ruby.h",
"include/grpc/fork.h",
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json
index 077b4a8ed9..c17d4c5a93 100644
--- a/tools/run_tests/generated/tests.json
+++ b/tools/run_tests/generated/tests.json
@@ -4715,6 +4715,32 @@
"flaky": false,
"gtest": false,
"language": "c",
+ "name": "duplicate_header_bad_client_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ],
+ "uses_polling": true
+ },
+ {
+ "args": [],
+ "benchmark": false,
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
+ "exclude_iomgrs": [
+ "uv"
+ ],
+ "flaky": false,
+ "gtest": false,
+ "language": "c",
"name": "head_of_line_blocking_bad_client_test",
"platforms": [
"linux",
diff --git a/tools/run_tests/performance/OWNERS b/tools/run_tests/performance/OWNERS
index 98c81529f3..fc1d6eec9c 100644
--- a/tools/run_tests/performance/OWNERS
+++ b/tools/run_tests/performance/OWNERS
@@ -6,4 +6,4 @@ set noparent
@ncteisen
@matt-kwong
-@ctiller
+@jtattermusch