Merge branch 'master' of https://github.com/grpc/grpc into docfix

pull/14394/head
Srini Polavarapu 7 years ago
commit 89f70d163b
  1. 43
      BUILD
  2. 231
      CMakeLists.txt
  3. 279
      Makefile
  4. 77
      build.yaml
  5. 7
      config.m4
  6. 7
      config.w32
  7. 38
      gRPC-C++.podspec
  8. 31
      gRPC-Core.podspec
  9. 22
      grpc.def
  10. 20
      grpc.gemspec
  11. 18
      grpc.gyp
  12. 1
      include/grpc++/server_builder.h
  13. 8
      include/grpc/module.modulemap
  14. 20
      package.xml
  15. 30
      src/core/ext/filters/client_channel/client_channel.cc
  16. 14
      src/core/ext/filters/client_channel/client_channel_plugin.cc
  17. 21
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  18. 5
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
  19. 2
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
  20. 5
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
  21. 1
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
  22. 58
      src/core/ext/filters/client_channel/resolver.cc
  23. 153
      src/core/ext/filters/client_channel/resolver.h
  24. 507
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  25. 1
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
  26. 1
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  27. 449
      src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
  28. 326
      src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
  29. 77
      src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
  30. 250
      src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
  31. 40
      src/core/ext/filters/client_channel/resolver_factory.cc
  32. 65
      src/core/ext/filters/client_channel/resolver_factory.h
  33. 200
      src/core/ext/filters/client_channel/resolver_registry.cc
  34. 85
      src/core/ext/filters/client_channel/resolver_registry.h
  35. 19
      src/core/ext/filters/client_channel/retry_throttle.cc
  36. 1
      src/core/ext/filters/client_channel/subchannel.cc
  37. 58
      src/core/ext/filters/client_channel/subchannel_index.cc
  38. 3
      src/core/ext/transport/chttp2/alpn/alpn.cc
  39. 8
      src/core/ext/transport/chttp2/client/insecure/channel_create.cc
  40. 8
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
  41. 1
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  42. 2
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  43. 1
      src/core/ext/transport/chttp2/transport/flow_control.cc
  44. 2
      src/core/ext/transport/chttp2/transport/flow_control.h
  45. 1
      src/core/ext/transport/chttp2/transport/frame_data.cc
  46. 1
      src/core/ext/transport/chttp2/transport/frame_settings.cc
  47. 1
      src/core/ext/transport/chttp2/transport/hpack_encoder.cc
  48. 1
      src/core/ext/transport/chttp2/transport/hpack_parser.cc
  49. 2
      src/core/ext/transport/chttp2/transport/http2_settings.cc
  50. 1
      src/core/ext/transport/chttp2/transport/stream_map.cc
  51. 1
      src/core/ext/transport/chttp2/transport/writing.cc
  52. 1
      src/core/ext/transport/cronet/transport/cronet_transport.cc
  53. 118
      src/core/lib/avl/avl.cc
  54. 60
      src/core/lib/avl/avl.h
  55. 2
      src/core/lib/backoff/backoff.cc
  56. 2
      src/core/lib/channel/channel_args.cc
  57. 2
      src/core/lib/compression/compression.cc
  58. 2
      src/core/lib/compression/compression_internal.cc
  59. 2
      src/core/lib/debug/stats.cc
  60. 3
      src/core/lib/debug/stats_data.cc
  61. 1
      src/core/lib/gpr/arena.cc
  62. 3
      src/core/lib/gpr/atm.cc
  63. 3
      src/core/lib/gpr/cpu_posix.cc
  64. 2
      src/core/lib/gpr/env_linux.cc
  65. 8
      src/core/lib/gpr/env_windows.cc
  66. 2
      src/core/lib/gpr/fork.cc
  67. 3
      src/core/lib/gpr/string.cc
  68. 2
      src/core/lib/gpr/thd_posix.cc
  69. 12
      src/core/lib/gpr/tls.h
  70. 6
      src/core/lib/gpr/tls_gcc.h
  71. 6
      src/core/lib/gpr/tls_msvc.h
  72. 2
      src/core/lib/gpr/tls_pthread.cc
  73. 6
      src/core/lib/gpr/tls_pthread.h
  74. 6
      src/core/lib/gpr/useful.h
  75. 1
      src/core/lib/http/format_request.cc
  76. 1
      src/core/lib/http/httpcli.cc
  77. 3
      src/core/lib/http/parser.cc
  78. 2
      src/core/lib/iomgr/error.cc
  79. 4
      src/core/lib/iomgr/ev_epoll1_linux.cc
  80. 4
      src/core/lib/iomgr/ev_epollex_linux.cc
  81. 4
      src/core/lib/iomgr/ev_epollsig_linux.cc
  82. 4
      src/core/lib/iomgr/ev_poll_posix.cc
  83. 2
      src/core/lib/iomgr/ev_posix.cc
  84. 2
      src/core/lib/iomgr/exec_ctx.h
  85. 4
      src/core/lib/iomgr/executor.cc
  86. 1
      src/core/lib/iomgr/fork_posix.cc
  87. 1
      src/core/lib/iomgr/iocp_windows.cc
  88. 2
      src/core/lib/iomgr/iomgr.cc
  89. 2
      src/core/lib/iomgr/resolve_address_posix.cc
  90. 2
      src/core/lib/iomgr/resolve_address_uv.cc
  91. 2
      src/core/lib/iomgr/resource_quota.cc
  92. 2
      src/core/lib/iomgr/socket_factory_posix.cc
  93. 6
      src/core/lib/iomgr/socket_mutator.cc
  94. 1
      src/core/lib/iomgr/tcp_client_windows.cc
  95. 2
      src/core/lib/iomgr/tcp_posix.cc
  96. 1
      src/core/lib/iomgr/tcp_server_posix.cc
  97. 2
      src/core/lib/iomgr/tcp_windows.cc
  98. 5
      src/core/lib/iomgr/timer_generic.cc
  99. 3
      src/core/lib/iomgr/timer_heap.cc
  100. 3
      src/core/lib/iomgr/unix_sockets_posix.cc
  101. Some files were not shown because too many files have changed in this diff Show More

43
BUILD

@ -66,14 +66,11 @@ GPR_PUBLIC_HDRS = [
"include/grpc/support/atm_gcc_atomic.h",
"include/grpc/support/atm_gcc_sync.h",
"include/grpc/support/atm_windows.h",
"include/grpc/support/avl.h",
"include/grpc/support/cmdline.h",
"include/grpc/support/cpu.h",
"include/grpc/support/log.h",
"include/grpc/support/log_windows.h",
"include/grpc/support/port_platform.h",
"include/grpc/support/string_util.h",
"include/grpc/support/subprocess.h",
"include/grpc/support/sync.h",
"include/grpc/support/sync_custom.h",
"include/grpc/support/sync_generic.h",
@ -81,11 +78,6 @@ GPR_PUBLIC_HDRS = [
"include/grpc/support/sync_windows.h",
"include/grpc/support/thd.h",
"include/grpc/support/time.h",
"include/grpc/support/tls.h",
"include/grpc/support/tls_gcc.h",
"include/grpc/support/tls_msvc.h",
"include/grpc/support/tls_pthread.h",
"include/grpc/support/useful.h",
]
GRPC_PUBLIC_HDRS = [
@ -451,13 +443,9 @@ 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",
"src/core/lib/gpr/avl.cc",
"src/core/lib/gpr/cmdline.cc",
"src/core/lib/gpr/cpu_iphone.cc",
"src/core/lib/gpr/cpu_linux.cc",
"src/core/lib/gpr/cpu_posix.cc",
@ -478,8 +466,6 @@ grpc_cc_library(
"src/core/lib/gpr/string_posix.cc",
"src/core/lib/gpr/string_util_windows.cc",
"src/core/lib/gpr/string_windows.cc",
"src/core/lib/gpr/subprocess_posix.cc",
"src/core/lib/gpr/subprocess_windows.cc",
"src/core/lib/gpr/sync.cc",
"src/core/lib/gpr/sync_posix.cc",
"src/core/lib/gpr/sync_windows.cc",
@ -495,9 +481,10 @@ 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",
@ -509,7 +496,13 @@ grpc_cc_library(
"src/core/lib/gpr/string_windows.h",
"src/core/lib/gpr/thd_internal.h",
"src/core/lib/gpr/time_precise.h",
"src/core/lib/gpr/tls.h",
"src/core/lib/gpr/tls_gcc.h",
"src/core/lib/gpr/tls_msvc.h",
"src/core/lib/gpr/tls_pthread.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,
@ -562,14 +555,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",
],
@ -598,9 +591,9 @@ grpc_cc_library(
public_hdrs = ["src/core/lib/gprpp/orphanable.h"],
deps = [
"debug_location",
"ref_counted_ptr",
"gpr++_base",
"grpc_trace",
"ref_counted_ptr",
],
)
@ -610,9 +603,9 @@ grpc_cc_library(
public_hdrs = ["src/core/lib/gprpp/ref_counted.h"],
deps = [
"debug_location",
"ref_counted_ptr",
"gpr++_base",
"grpc_trace",
"ref_counted_ptr",
],
)
@ -628,6 +621,7 @@ grpc_cc_library(
grpc_cc_library(
name = "grpc_base_c",
srcs = [
"src/core/lib/avl/avl.cc",
"src/core/lib/backoff/backoff.cc",
"src/core/lib/channel/channel_args.cc",
"src/core/lib/channel/channel_stack.cc",
@ -762,6 +756,7 @@ grpc_cc_library(
"src/core/lib/transport/transport_op_string.cc",
],
hdrs = [
"src/core/lib/avl/avl.h",
"src/core/lib/backoff/backoff.h",
"src/core/lib/channel/channel_args.h",
"src/core/lib/channel/channel_stack.h",
@ -888,8 +883,8 @@ grpc_cc_library(
language = "c++",
public_hdrs = GRPC_PUBLIC_HDRS,
deps = [
"gpr_base",
"gpr++_base",
"gpr_base",
"grpc_codegen",
"grpc_trace",
],
@ -950,7 +945,6 @@ grpc_cc_library(
"src/core/ext/filters/client_channel/proxy_mapper.cc",
"src/core/ext/filters/client_channel/proxy_mapper_registry.cc",
"src/core/ext/filters/client_channel/resolver.cc",
"src/core/ext/filters/client_channel/resolver_factory.cc",
"src/core/ext/filters/client_channel/resolver_registry.cc",
"src/core/ext/filters/client_channel/retry_throttle.cc",
"src/core/ext/filters/client_channel/subchannel.cc",
@ -980,8 +974,11 @@ grpc_cc_library(
],
language = "c++",
deps = [
"gpr_base",
"grpc_base",
"grpc_deadline_filter",
"inlined_vector",
"orphanable",
"ref_counted",
"ref_counted_ptr",
],

@ -213,6 +213,7 @@ add_dependencies(buildtests_c algorithm_test)
add_dependencies(buildtests_c alloc_test)
add_dependencies(buildtests_c alpn_test)
add_dependencies(buildtests_c arena_test)
add_dependencies(buildtests_c avl_test)
add_dependencies(buildtests_c bad_server_response_test)
add_dependencies(buildtests_c bin_decoder_test)
add_dependencies(buildtests_c bin_encoder_test)
@ -221,6 +222,7 @@ add_dependencies(buildtests_c channel_create_test)
add_dependencies(buildtests_c chttp2_hpack_encoder_test)
add_dependencies(buildtests_c chttp2_stream_map_test)
add_dependencies(buildtests_c chttp2_varint_test)
add_dependencies(buildtests_c cmdline_test)
add_dependencies(buildtests_c combiner_test)
add_dependencies(buildtests_c compression_test)
add_dependencies(buildtests_c concurrent_connectivity_test)
@ -257,8 +259,6 @@ endif()
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_c goaway_server_test)
endif()
add_dependencies(buildtests_c gpr_avl_test)
add_dependencies(buildtests_c gpr_cmdline_test)
add_dependencies(buildtests_c gpr_cpu_test)
add_dependencies(buildtests_c gpr_env_test)
add_dependencies(buildtests_c gpr_host_port_test)
@ -628,8 +628,6 @@ add_library(gpr
src/core/lib/gpr/alloc.cc
src/core/lib/gpr/arena.cc
src/core/lib/gpr/atm.cc
src/core/lib/gpr/avl.cc
src/core/lib/gpr/cmdline.cc
src/core/lib/gpr/cpu_iphone.cc
src/core/lib/gpr/cpu_linux.cc
src/core/lib/gpr/cpu_posix.cc
@ -650,8 +648,6 @@ add_library(gpr
src/core/lib/gpr/string_posix.cc
src/core/lib/gpr/string_util_windows.cc
src/core/lib/gpr/string_windows.cc
src/core/lib/gpr/subprocess_posix.cc
src/core/lib/gpr/subprocess_windows.cc
src/core/lib/gpr/sync.cc
src/core/lib/gpr/sync_posix.cc
src/core/lib/gpr/sync_windows.cc
@ -704,14 +700,11 @@ foreach(_hdr
include/grpc/support/atm_gcc_atomic.h
include/grpc/support/atm_gcc_sync.h
include/grpc/support/atm_windows.h
include/grpc/support/avl.h
include/grpc/support/cmdline.h
include/grpc/support/cpu.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/subprocess.h
include/grpc/support/sync.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
@ -719,11 +712,6 @@ foreach(_hdr
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/support/tls.h
include/grpc/support/tls_gcc.h
include/grpc/support/tls_msvc.h
include/grpc/support/tls_pthread.h
include/grpc/support/useful.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
include/grpc/impl/codegen/atm_gcc_sync.h
@ -793,6 +781,7 @@ endif (gRPC_BUILD_TESTS)
add_library(grpc
src/core/lib/surface/init.cc
src/core/lib/avl/avl.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
@ -1002,7 +991,6 @@ add_library(grpc
src/core/ext/filters/client_channel/proxy_mapper.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver_factory.cc
src/core/ext/filters/client_channel/resolver_registry.cc
src/core/ext/filters/client_channel/retry_throttle.cc
src/core/ext/filters/client_channel/subchannel.cc
@ -1133,6 +1121,7 @@ endif()
add_library(grpc_cronet
src/core/lib/surface/init.cc
src/core/lib/avl/avl.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
@ -1313,7 +1302,6 @@ add_library(grpc_cronet
src/core/ext/filters/client_channel/proxy_mapper.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver_factory.cc
src/core/ext/filters/client_channel/resolver_registry.cc
src/core/ext/filters/client_channel/retry_throttle.cc
src/core/ext/filters/client_channel/subchannel.cc
@ -1454,8 +1442,12 @@ add_library(grpc_test_util
test/core/util/port_isolated_runtime_environment.cc
test/core/util/port_server_client.cc
test/core/util/slice_splitter.cc
test/core/util/subprocess_posix.cc
test/core/util/subprocess_windows.cc
test/core/util/tracer_util.cc
test/core/util/trickle_endpoint.cc
test/core/util/cmdline.cc
src/core/lib/avl/avl.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
@ -1605,7 +1597,6 @@ add_library(grpc_test_util
src/core/ext/filters/client_channel/proxy_mapper.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver_factory.cc
src/core/ext/filters/client_channel/resolver_registry.cc
src/core/ext/filters/client_channel/retry_throttle.cc
src/core/ext/filters/client_channel/subchannel.cc
@ -1672,14 +1663,23 @@ target_link_libraries(grpc_test_util
)
foreach(_hdr
include/grpc/impl/codegen/byte_buffer.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/slice.h
include/grpc/impl/codegen/status.h
include/grpc/support/alloc.h
include/grpc/support/atm.h
include/grpc/support/atm_gcc_atomic.h
include/grpc/support/atm_gcc_sync.h
include/grpc/support/atm_windows.h
include/grpc/support/cpu.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/sync.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
include/grpc/support/sync_posix.h
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
include/grpc/impl/codegen/atm_gcc_sync.h
@ -1693,6 +1693,14 @@ foreach(_hdr
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
include/grpc/impl/codegen/sync_windows.h
include/grpc/impl/codegen/byte_buffer.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/slice.h
include/grpc/impl/codegen/status.h
)
string(REPLACE "include/" "" _path ${_hdr})
get_filename_component(_path ${_path} PATH)
@ -1721,8 +1729,12 @@ add_library(grpc_test_util_unsecure
test/core/util/port_isolated_runtime_environment.cc
test/core/util/port_server_client.cc
test/core/util/slice_splitter.cc
test/core/util/subprocess_posix.cc
test/core/util/subprocess_windows.cc
test/core/util/tracer_util.cc
test/core/util/trickle_endpoint.cc
test/core/util/cmdline.cc
src/core/lib/avl/avl.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
@ -1872,7 +1884,6 @@ add_library(grpc_test_util_unsecure
src/core/ext/filters/client_channel/proxy_mapper.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver_factory.cc
src/core/ext/filters/client_channel/resolver_registry.cc
src/core/ext/filters/client_channel/retry_throttle.cc
src/core/ext/filters/client_channel/subchannel.cc
@ -1939,14 +1950,23 @@ target_link_libraries(grpc_test_util_unsecure
)
foreach(_hdr
include/grpc/impl/codegen/byte_buffer.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/slice.h
include/grpc/impl/codegen/status.h
include/grpc/support/alloc.h
include/grpc/support/atm.h
include/grpc/support/atm_gcc_atomic.h
include/grpc/support/atm_gcc_sync.h
include/grpc/support/atm_windows.h
include/grpc/support/cpu.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/sync.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
include/grpc/support/sync_posix.h
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
include/grpc/impl/codegen/atm_gcc_sync.h
@ -1960,6 +1980,14 @@ foreach(_hdr
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
include/grpc/impl/codegen/sync_windows.h
include/grpc/impl/codegen/byte_buffer.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/propagation_bits.h
include/grpc/impl/codegen/slice.h
include/grpc/impl/codegen/status.h
)
string(REPLACE "include/" "" _path ${_hdr})
get_filename_component(_path ${_path} PATH)
@ -1973,6 +2001,7 @@ endif (gRPC_BUILD_TESTS)
add_library(grpc_unsecure
src/core/lib/surface/init.cc
src/core/lib/surface/init_unsecure.cc
src/core/lib/avl/avl.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
@ -2155,7 +2184,6 @@ add_library(grpc_unsecure
src/core/ext/filters/client_channel/proxy_mapper.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver_factory.cc
src/core/ext/filters/client_channel/resolver_registry.cc
src/core/ext/filters/client_channel/retry_throttle.cc
src/core/ext/filters/client_channel/subchannel.cc
@ -2486,14 +2514,11 @@ foreach(_hdr
include/grpc/support/atm_gcc_atomic.h
include/grpc/support/atm_gcc_sync.h
include/grpc/support/atm_windows.h
include/grpc/support/avl.h
include/grpc/support/cmdline.h
include/grpc/support/cpu.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/subprocess.h
include/grpc/support/sync.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
@ -2501,11 +2526,6 @@ foreach(_hdr
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/support/tls.h
include/grpc/support/tls_gcc.h
include/grpc/support/tls_msvc.h
include/grpc/support/tls_pthread.h
include/grpc/support/useful.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
include/grpc/impl/codegen/atm_gcc_sync.h
@ -2703,6 +2723,7 @@ add_library(grpc++_cronet
src/core/ext/transport/chttp2/transport/stream_map.cc
src/core/ext/transport/chttp2/transport/varint.cc
src/core/ext/transport/chttp2/transport/writing.cc
src/core/lib/avl/avl.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
src/core/lib/channel/channel_stack.cc
@ -2857,7 +2878,6 @@ add_library(grpc++_cronet
src/core/ext/filters/client_channel/proxy_mapper.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver_factory.cc
src/core/ext/filters/client_channel/resolver_registry.cc
src/core/ext/filters/client_channel/retry_throttle.cc
src/core/ext/filters/client_channel/subchannel.cc
@ -2958,14 +2978,11 @@ foreach(_hdr
include/grpc/support/atm_gcc_atomic.h
include/grpc/support/atm_gcc_sync.h
include/grpc/support/atm_windows.h
include/grpc/support/avl.h
include/grpc/support/cmdline.h
include/grpc/support/cpu.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/subprocess.h
include/grpc/support/sync.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
@ -2973,11 +2990,6 @@ foreach(_hdr
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/support/tls.h
include/grpc/support/tls_gcc.h
include/grpc/support/tls_msvc.h
include/grpc/support/tls_pthread.h
include/grpc/support/useful.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
include/grpc/impl/codegen/atm_gcc_sync.h
@ -3687,14 +3699,11 @@ foreach(_hdr
include/grpc/support/atm_gcc_atomic.h
include/grpc/support/atm_gcc_sync.h
include/grpc/support/atm_windows.h
include/grpc/support/avl.h
include/grpc/support/cmdline.h
include/grpc/support/cpu.h
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/subprocess.h
include/grpc/support/sync.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
@ -3702,11 +3711,6 @@ foreach(_hdr
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/support/tls.h
include/grpc/support/tls_gcc.h
include/grpc/support/tls_msvc.h
include/grpc/support/tls_pthread.h
include/grpc/support/useful.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
include/grpc/impl/codegen/atm_gcc_sync.h
@ -4825,6 +4829,32 @@ target_link_libraries(arena_test
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(avl_test
test/core/avl/avl_test.cc
)
target_include_directories(avl_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(avl_test
${_gRPC_ALLTARGETS_LIBRARIES}
gpr_test_util
gpr
grpc
)
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(bad_server_response_test
test/core/end2end/bad_server_response_test.cc
)
@ -5070,6 +5100,32 @@ target_link_libraries(chttp2_varint_test
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(cmdline_test
test/core/util/cmdline_test.cc
)
target_include_directories(cmdline_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(cmdline_test
${_gRPC_ALLTARGETS_LIBRARIES}
gpr
gpr_test_util
grpc_test_util
)
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(combiner_test
test/core/iomgr/combiner_test.cc
)
@ -5626,56 +5682,6 @@ endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(gpr_avl_test
test/core/gpr/avl_test.cc
)
target_include_directories(gpr_avl_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(gpr_avl_test
${_gRPC_ALLTARGETS_LIBRARIES}
gpr_test_util
gpr
)
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(gpr_cmdline_test
test/core/gpr/cmdline_test.cc
)
target_include_directories(gpr_cmdline_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(gpr_cmdline_test
${_gRPC_ALLTARGETS_LIBRARIES}
gpr_test_util
gpr
)
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(gpr_cpu_test
test/core/gpr/cpu_test.cc
)
@ -6218,6 +6224,7 @@ endif (gRPC_BUILD_TESTS)
add_executable(grpc_create_jwt
test/core/security/create_jwt.cc
test/core/util/cmdline.cc
)
@ -6388,6 +6395,7 @@ endif (gRPC_BUILD_TESTS)
add_executable(grpc_print_google_default_creds_token
test/core/security/print_google_default_creds_token.cc
test/core/util/cmdline.cc
)
@ -6474,6 +6482,7 @@ endif (gRPC_BUILD_TESTS)
add_executable(grpc_verify_jwt
test/core/security/verify_jwt.cc
test/core/util/cmdline.cc
)
@ -6860,7 +6869,9 @@ target_include_directories(json_rewrite
target_link_libraries(json_rewrite
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
grpc
gpr_test_util
gpr
)

@ -955,6 +955,7 @@ alloc_test: $(BINDIR)/$(CONFIG)/alloc_test
alpn_test: $(BINDIR)/$(CONFIG)/alpn_test
api_fuzzer: $(BINDIR)/$(CONFIG)/api_fuzzer
arena_test: $(BINDIR)/$(CONFIG)/arena_test
avl_test: $(BINDIR)/$(CONFIG)/avl_test
bad_server_response_test: $(BINDIR)/$(CONFIG)/bad_server_response_test
bin_decoder_test: $(BINDIR)/$(CONFIG)/bin_decoder_test
bin_encoder_test: $(BINDIR)/$(CONFIG)/bin_encoder_test
@ -965,6 +966,7 @@ chttp2_hpack_encoder_test: $(BINDIR)/$(CONFIG)/chttp2_hpack_encoder_test
chttp2_stream_map_test: $(BINDIR)/$(CONFIG)/chttp2_stream_map_test
chttp2_varint_test: $(BINDIR)/$(CONFIG)/chttp2_varint_test
client_fuzzer: $(BINDIR)/$(CONFIG)/client_fuzzer
cmdline_test: $(BINDIR)/$(CONFIG)/cmdline_test
combiner_test: $(BINDIR)/$(CONFIG)/combiner_test
compression_test: $(BINDIR)/$(CONFIG)/compression_test
concurrent_connectivity_test: $(BINDIR)/$(CONFIG)/concurrent_connectivity_test
@ -985,8 +987,6 @@ fling_server: $(BINDIR)/$(CONFIG)/fling_server
fling_stream_test: $(BINDIR)/$(CONFIG)/fling_stream_test
fling_test: $(BINDIR)/$(CONFIG)/fling_test
goaway_server_test: $(BINDIR)/$(CONFIG)/goaway_server_test
gpr_avl_test: $(BINDIR)/$(CONFIG)/gpr_avl_test
gpr_cmdline_test: $(BINDIR)/$(CONFIG)/gpr_cmdline_test
gpr_cpu_test: $(BINDIR)/$(CONFIG)/gpr_cpu_test
gpr_env_test: $(BINDIR)/$(CONFIG)/gpr_env_test
gpr_host_port_test: $(BINDIR)/$(CONFIG)/gpr_host_port_test
@ -1372,6 +1372,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/alloc_test \
$(BINDIR)/$(CONFIG)/alpn_test \
$(BINDIR)/$(CONFIG)/arena_test \
$(BINDIR)/$(CONFIG)/avl_test \
$(BINDIR)/$(CONFIG)/bad_server_response_test \
$(BINDIR)/$(CONFIG)/bin_decoder_test \
$(BINDIR)/$(CONFIG)/bin_encoder_test \
@ -1380,6 +1381,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/chttp2_hpack_encoder_test \
$(BINDIR)/$(CONFIG)/chttp2_stream_map_test \
$(BINDIR)/$(CONFIG)/chttp2_varint_test \
$(BINDIR)/$(CONFIG)/cmdline_test \
$(BINDIR)/$(CONFIG)/combiner_test \
$(BINDIR)/$(CONFIG)/compression_test \
$(BINDIR)/$(CONFIG)/concurrent_connectivity_test \
@ -1400,8 +1402,6 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/fling_stream_test \
$(BINDIR)/$(CONFIG)/fling_test \
$(BINDIR)/$(CONFIG)/goaway_server_test \
$(BINDIR)/$(CONFIG)/gpr_avl_test \
$(BINDIR)/$(CONFIG)/gpr_cmdline_test \
$(BINDIR)/$(CONFIG)/gpr_cpu_test \
$(BINDIR)/$(CONFIG)/gpr_env_test \
$(BINDIR)/$(CONFIG)/gpr_host_port_test \
@ -1812,6 +1812,8 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/alpn_test || ( echo test alpn_test failed ; exit 1 )
$(E) "[RUN] Testing arena_test"
$(Q) $(BINDIR)/$(CONFIG)/arena_test || ( echo test arena_test failed ; exit 1 )
$(E) "[RUN] Testing avl_test"
$(Q) $(BINDIR)/$(CONFIG)/avl_test || ( echo test avl_test failed ; exit 1 )
$(E) "[RUN] Testing bad_server_response_test"
$(Q) $(BINDIR)/$(CONFIG)/bad_server_response_test || ( echo test bad_server_response_test failed ; exit 1 )
$(E) "[RUN] Testing bin_decoder_test"
@ -1828,6 +1830,8 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/chttp2_stream_map_test || ( echo test chttp2_stream_map_test failed ; exit 1 )
$(E) "[RUN] Testing chttp2_varint_test"
$(Q) $(BINDIR)/$(CONFIG)/chttp2_varint_test || ( echo test chttp2_varint_test failed ; exit 1 )
$(E) "[RUN] Testing cmdline_test"
$(Q) $(BINDIR)/$(CONFIG)/cmdline_test || ( echo test cmdline_test failed ; exit 1 )
$(E) "[RUN] Testing combiner_test"
$(Q) $(BINDIR)/$(CONFIG)/combiner_test || ( echo test combiner_test failed ; exit 1 )
$(E) "[RUN] Testing compression_test"
@ -1864,10 +1868,6 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/fling_test || ( echo test fling_test failed ; exit 1 )
$(E) "[RUN] Testing goaway_server_test"
$(Q) $(BINDIR)/$(CONFIG)/goaway_server_test || ( echo test goaway_server_test failed ; exit 1 )
$(E) "[RUN] Testing gpr_avl_test"
$(Q) $(BINDIR)/$(CONFIG)/gpr_avl_test || ( echo test gpr_avl_test failed ; exit 1 )
$(E) "[RUN] Testing gpr_cmdline_test"
$(Q) $(BINDIR)/$(CONFIG)/gpr_cmdline_test || ( echo test gpr_cmdline_test failed ; exit 1 )
$(E) "[RUN] Testing gpr_cpu_test"
$(Q) $(BINDIR)/$(CONFIG)/gpr_cpu_test || ( echo test gpr_cpu_test failed ; exit 1 )
$(E) "[RUN] Testing gpr_env_test"
@ -2876,8 +2876,6 @@ LIBGPR_SRC = \
src/core/lib/gpr/alloc.cc \
src/core/lib/gpr/arena.cc \
src/core/lib/gpr/atm.cc \
src/core/lib/gpr/avl.cc \
src/core/lib/gpr/cmdline.cc \
src/core/lib/gpr/cpu_iphone.cc \
src/core/lib/gpr/cpu_linux.cc \
src/core/lib/gpr/cpu_posix.cc \
@ -2898,8 +2896,6 @@ LIBGPR_SRC = \
src/core/lib/gpr/string_posix.cc \
src/core/lib/gpr/string_util_windows.cc \
src/core/lib/gpr/string_windows.cc \
src/core/lib/gpr/subprocess_posix.cc \
src/core/lib/gpr/subprocess_windows.cc \
src/core/lib/gpr/sync.cc \
src/core/lib/gpr/sync_posix.cc \
src/core/lib/gpr/sync_windows.cc \
@ -2924,14 +2920,11 @@ PUBLIC_HEADERS_C += \
include/grpc/support/atm_gcc_atomic.h \
include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/avl.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/subprocess.h \
include/grpc/support/sync.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
@ -2939,11 +2932,6 @@ PUBLIC_HEADERS_C += \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/support/tls.h \
include/grpc/support/tls_gcc.h \
include/grpc/support/tls_msvc.h \
include/grpc/support/tls_pthread.h \
include/grpc/support/useful.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
include/grpc/impl/codegen/atm_gcc_sync.h \
@ -3022,6 +3010,7 @@ endif
LIBGRPC_SRC = \
src/core/lib/surface/init.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
@ -3231,7 +3220,6 @@ LIBGRPC_SRC = \
src/core/ext/filters/client_channel/proxy_mapper.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver_factory.cc \
src/core/ext/filters/client_channel/resolver_registry.cc \
src/core/ext/filters/client_channel/retry_throttle.cc \
src/core/ext/filters/client_channel/subchannel.cc \
@ -3364,6 +3352,7 @@ endif
LIBGRPC_CRONET_SRC = \
src/core/lib/surface/init.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
@ -3544,7 +3533,6 @@ LIBGRPC_CRONET_SRC = \
src/core/ext/filters/client_channel/proxy_mapper.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver_factory.cc \
src/core/ext/filters/client_channel/resolver_registry.cc \
src/core/ext/filters/client_channel/retry_throttle.cc \
src/core/ext/filters/client_channel/subchannel.cc \
@ -3686,8 +3674,12 @@ LIBGRPC_TEST_UTIL_SRC = \
test/core/util/port_isolated_runtime_environment.cc \
test/core/util/port_server_client.cc \
test/core/util/slice_splitter.cc \
test/core/util/subprocess_posix.cc \
test/core/util/subprocess_windows.cc \
test/core/util/tracer_util.cc \
test/core/util/trickle_endpoint.cc \
test/core/util/cmdline.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
@ -3837,7 +3829,6 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/ext/filters/client_channel/proxy_mapper.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver_factory.cc \
src/core/ext/filters/client_channel/resolver_registry.cc \
src/core/ext/filters/client_channel/retry_throttle.cc \
src/core/ext/filters/client_channel/subchannel.cc \
@ -3873,14 +3864,23 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/ext/filters/http/server/http_server_filter.cc \
PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/byte_buffer.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/slice.h \
include/grpc/impl/codegen/status.h \
include/grpc/support/alloc.h \
include/grpc/support/atm.h \
include/grpc/support/atm_gcc_atomic.h \
include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/cpu.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
include/grpc/impl/codegen/atm_gcc_sync.h \
@ -3894,6 +3894,14 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
include/grpc/impl/codegen/sync_windows.h \
include/grpc/impl/codegen/byte_buffer.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/slice.h \
include/grpc/impl/codegen/status.h \
LIBGRPC_TEST_UTIL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_TEST_UTIL_SRC))))
@ -3946,8 +3954,12 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
test/core/util/port_isolated_runtime_environment.cc \
test/core/util/port_server_client.cc \
test/core/util/slice_splitter.cc \
test/core/util/subprocess_posix.cc \
test/core/util/subprocess_windows.cc \
test/core/util/tracer_util.cc \
test/core/util/trickle_endpoint.cc \
test/core/util/cmdline.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
@ -4097,7 +4109,6 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
src/core/ext/filters/client_channel/proxy_mapper.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver_factory.cc \
src/core/ext/filters/client_channel/resolver_registry.cc \
src/core/ext/filters/client_channel/retry_throttle.cc \
src/core/ext/filters/client_channel/subchannel.cc \
@ -4133,14 +4144,23 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
src/core/ext/filters/http/server/http_server_filter.cc \
PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/byte_buffer.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/slice.h \
include/grpc/impl/codegen/status.h \
include/grpc/support/alloc.h \
include/grpc/support/atm.h \
include/grpc/support/atm_gcc_atomic.h \
include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/cpu.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
include/grpc/impl/codegen/atm_gcc_sync.h \
@ -4154,6 +4174,14 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
include/grpc/impl/codegen/sync_windows.h \
include/grpc/impl/codegen/byte_buffer.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/slice.h \
include/grpc/impl/codegen/status.h \
LIBGRPC_TEST_UTIL_UNSECURE_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_TEST_UTIL_UNSECURE_SRC))))
@ -4178,6 +4206,7 @@ endif
LIBGRPC_UNSECURE_SRC = \
src/core/lib/surface/init.cc \
src/core/lib/surface/init_unsecure.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
@ -4360,7 +4389,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/filters/client_channel/proxy_mapper.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver_factory.cc \
src/core/ext/filters/client_channel/resolver_registry.cc \
src/core/ext/filters/client_channel/retry_throttle.cc \
src/core/ext/filters/client_channel/subchannel.cc \
@ -4644,14 +4672,11 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/atm_gcc_atomic.h \
include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/avl.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/subprocess.h \
include/grpc/support/sync.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
@ -4659,11 +4684,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/support/tls.h \
include/grpc/support/tls_gcc.h \
include/grpc/support/tls_msvc.h \
include/grpc/support/tls_pthread.h \
include/grpc/support/useful.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
include/grpc/impl/codegen/atm_gcc_sync.h \
@ -4909,6 +4929,7 @@ LIBGRPC++_CRONET_SRC = \
src/core/ext/transport/chttp2/transport/stream_map.cc \
src/core/ext/transport/chttp2/transport/varint.cc \
src/core/ext/transport/chttp2/transport/writing.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
@ -5063,7 +5084,6 @@ LIBGRPC++_CRONET_SRC = \
src/core/ext/filters/client_channel/proxy_mapper.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver_factory.cc \
src/core/ext/filters/client_channel/resolver_registry.cc \
src/core/ext/filters/client_channel/retry_throttle.cc \
src/core/ext/filters/client_channel/subchannel.cc \
@ -5129,14 +5149,11 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/atm_gcc_atomic.h \
include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/avl.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/subprocess.h \
include/grpc/support/sync.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
@ -5144,11 +5161,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/support/tls.h \
include/grpc/support/tls_gcc.h \
include/grpc/support/tls_msvc.h \
include/grpc/support/tls_pthread.h \
include/grpc/support/useful.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
include/grpc/impl/codegen/atm_gcc_sync.h \
@ -5847,14 +5859,11 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/atm_gcc_atomic.h \
include/grpc/support/atm_gcc_sync.h \
include/grpc/support/atm_windows.h \
include/grpc/support/avl.h \
include/grpc/support/cmdline.h \
include/grpc/support/cpu.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/subprocess.h \
include/grpc/support/sync.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
@ -5862,11 +5871,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/support/tls.h \
include/grpc/support/tls_gcc.h \
include/grpc/support/tls_msvc.h \
include/grpc/support/tls_pthread.h \
include/grpc/support/useful.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
include/grpc/impl/codegen/atm_gcc_sync.h \
@ -9399,6 +9403,38 @@ endif
endif
AVL_TEST_SRC = \
test/core/avl/avl_test.cc \
AVL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(AVL_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/avl_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/avl_test: $(AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/avl_test
endif
$(OBJDIR)/$(CONFIG)/test/core/avl/avl_test.o: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a
deps_avl_test: $(AVL_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(AVL_TEST_OBJS:.o=.dep)
endif
endif
BAD_SERVER_RESPONSE_TEST_SRC = \
test/core/end2end/bad_server_response_test.cc \
@ -9719,6 +9755,38 @@ endif
endif
CMDLINE_TEST_SRC = \
test/core/util/cmdline_test.cc \
CMDLINE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CMDLINE_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/cmdline_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/cmdline_test: $(CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/cmdline_test
endif
$(OBJDIR)/$(CONFIG)/test/core/util/cmdline_test.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a
deps_cmdline_test: $(CMDLINE_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(CMDLINE_TEST_OBJS:.o=.dep)
endif
endif
COMBINER_TEST_SRC = \
test/core/iomgr/combiner_test.cc \
@ -10362,70 +10430,6 @@ endif
endif
GPR_AVL_TEST_SRC = \
test/core/gpr/avl_test.cc \
GPR_AVL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_AVL_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/gpr_avl_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/gpr_avl_test: $(GPR_AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(GPR_AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_avl_test
endif
$(OBJDIR)/$(CONFIG)/test/core/gpr/avl_test.o: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_gpr_avl_test: $(GPR_AVL_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(GPR_AVL_TEST_OBJS:.o=.dep)
endif
endif
GPR_CMDLINE_TEST_SRC = \
test/core/gpr/cmdline_test.cc \
GPR_CMDLINE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_CMDLINE_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/gpr_cmdline_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/gpr_cmdline_test: $(GPR_CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(GPR_CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_cmdline_test
endif
$(OBJDIR)/$(CONFIG)/test/core/gpr/cmdline_test.o: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_gpr_cmdline_test: $(GPR_CMDLINE_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(GPR_CMDLINE_TEST_OBJS:.o=.dep)
endif
endif
GPR_CPU_TEST_SRC = \
test/core/gpr/cpu_test.cc \
@ -11100,6 +11104,7 @@ endif
GRPC_CREATE_JWT_SRC = \
test/core/security/create_jwt.cc \
test/core/util/cmdline.cc \
GRPC_CREATE_JWT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_CREATE_JWT_SRC))))
ifeq ($(NO_SECURE),true)
@ -11121,6 +11126,8 @@ endif
$(OBJDIR)/$(CONFIG)/test/core/security/create_jwt.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/cmdline.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_grpc_create_jwt: $(GRPC_CREATE_JWT_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
@ -11292,6 +11299,7 @@ endif
GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_SRC = \
test/core/security/print_google_default_creds_token.cc \
test/core/util/cmdline.cc \
GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_SRC))))
ifeq ($(NO_SECURE),true)
@ -11313,6 +11321,8 @@ endif
$(OBJDIR)/$(CONFIG)/test/core/security/print_google_default_creds_token.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/cmdline.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_grpc_print_google_default_creds_token: $(GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
@ -11388,6 +11398,7 @@ endif
GRPC_VERIFY_JWT_SRC = \
test/core/security/verify_jwt.cc \
test/core/util/cmdline.cc \
GRPC_VERIFY_JWT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_VERIFY_JWT_SRC))))
ifeq ($(NO_SECURE),true)
@ -11409,6 +11420,8 @@ endif
$(OBJDIR)/$(CONFIG)/test/core/security/verify_jwt.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/cmdline.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_grpc_verify_jwt: $(GRPC_VERIFY_JWT_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
@ -11950,14 +11963,14 @@ else
$(BINDIR)/$(CONFIG)/json_rewrite: $(JSON_REWRITE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(BINDIR)/$(CONFIG)/json_rewrite: $(JSON_REWRITE_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) $(JSON_REWRITE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_rewrite
$(Q) $(LD) $(LDFLAGS) $(JSON_REWRITE_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)/json_rewrite
endif
$(OBJDIR)/$(CONFIG)/test/core/json/json_rewrite.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/json/json_rewrite.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_json_rewrite: $(JSON_REWRITE_OBJS:.o=.dep)

@ -24,13 +24,18 @@ filegroups:
uses:
- grpc_base
- nanopb
- name: cmdline
headers:
- test/core/util/cmdline.h
src:
- test/core/util/cmdline.cc
uses:
- gpr_base_headers
- name: gpr_base
src:
- src/core/lib/gpr/alloc.cc
- src/core/lib/gpr/arena.cc
- src/core/lib/gpr/atm.cc
- src/core/lib/gpr/avl.cc
- src/core/lib/gpr/cmdline.cc
- src/core/lib/gpr/cpu_iphone.cc
- src/core/lib/gpr/cpu_linux.cc
- src/core/lib/gpr/cpu_posix.cc
@ -51,8 +56,6 @@ filegroups:
- src/core/lib/gpr/string_posix.cc
- src/core/lib/gpr/string_util_windows.cc
- src/core/lib/gpr/string_windows.cc
- src/core/lib/gpr/subprocess_posix.cc
- src/core/lib/gpr/subprocess_windows.cc
- src/core/lib/gpr/sync.cc
- src/core/lib/gpr/sync_posix.cc
- src/core/lib/gpr/sync_windows.cc
@ -79,14 +82,11 @@ filegroups:
- include/grpc/support/atm_gcc_atomic.h
- include/grpc/support/atm_gcc_sync.h
- include/grpc/support/atm_windows.h
- include/grpc/support/avl.h
- include/grpc/support/cmdline.h
- include/grpc/support/cpu.h
- include/grpc/support/log.h
- include/grpc/support/log_windows.h
- include/grpc/support/port_platform.h
- include/grpc/support/string_util.h
- include/grpc/support/subprocess.h
- include/grpc/support/sync.h
- include/grpc/support/sync_custom.h
- include/grpc/support/sync_generic.h
@ -94,11 +94,6 @@ filegroups:
- include/grpc/support/sync_windows.h
- include/grpc/support/thd.h
- include/grpc/support/time.h
- include/grpc/support/tls.h
- include/grpc/support/tls_gcc.h
- include/grpc/support/tls_msvc.h
- include/grpc/support/tls_pthread.h
- include/grpc/support/useful.h
headers:
- src/core/lib/gpr/arena.h
- src/core/lib/gpr/env.h
@ -111,7 +106,12 @@ filegroups:
- src/core/lib/gpr/string_windows.h
- src/core/lib/gpr/thd_internal.h
- src/core/lib/gpr/time_precise.h
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tls_gcc.h
- src/core/lib/gpr/tls_msvc.h
- src/core/lib/gpr/tls_pthread.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/abstract.h
- src/core/lib/gprpp/atomic.h
- src/core/lib/gprpp/atomic_with_atm.h
@ -150,6 +150,7 @@ filegroups:
- grpc++_codegen_base
- name: grpc_base
src:
- src/core/lib/avl/avl.cc
- src/core/lib/backoff/backoff.cc
- src/core/lib/channel/channel_args.cc
- src/core/lib/channel/channel_stack.cc
@ -305,6 +306,7 @@ filegroups:
- include/grpc/status.h
- include/grpc/support/workaround_list.h
headers:
- src/core/lib/avl/avl.h
- src/core/lib/backoff/backoff.h
- src/core/lib/channel/channel_args.h
- src/core/lib/channel/channel_stack.h
@ -471,7 +473,6 @@ filegroups:
- src/core/ext/filters/client_channel/proxy_mapper.cc
- src/core/ext/filters/client_channel/proxy_mapper_registry.cc
- src/core/ext/filters/client_channel/resolver.cc
- src/core/ext/filters/client_channel/resolver_factory.cc
- src/core/ext/filters/client_channel/resolver_registry.cc
- src/core/ext/filters/client_channel/retry_throttle.cc
- src/core/ext/filters/client_channel/subchannel.cc
@ -721,6 +722,7 @@ filegroups:
- test/core/util/port.h
- test/core/util/port_server_client.h
- test/core/util/slice_splitter.h
- test/core/util/subprocess.h
- test/core/util/tracer_util.h
- test/core/util/trickle_endpoint.h
src:
@ -740,12 +742,15 @@ filegroups:
- test/core/util/port_isolated_runtime_environment.cc
- test/core/util/port_server_client.cc
- test/core/util/slice_splitter.cc
- test/core/util/subprocess_posix.cc
- test/core/util/subprocess_windows.cc
- test/core/util/tracer_util.cc
- test/core/util/trickle_endpoint.cc
deps:
- gpr_test_util
- gpr
uses:
- cmdline
- grpc_base
- grpc_client_channel
- grpc_transport_chttp2
@ -1760,6 +1765,16 @@ targets:
- gpr_test_util
- gpr
uses_polling: false
- name: avl_test
build: test
language: c
src:
- test/core/avl/avl_test.cc
deps:
- gpr_test_util
- gpr
- grpc
uses_polling: false
- name: bad_server_response_test
build: test
language: c
@ -1867,6 +1882,16 @@ targets:
- test/core/end2end/fuzzers/client_fuzzer_corpus
dict: test/core/end2end/fuzzers/hpack.dictionary
maxlen: 2048
- name: cmdline_test
build: test
language: c
src:
- test/core/util/cmdline_test.cc
deps:
- gpr
- gpr_test_util
- grpc_test_util
uses_polling: false
- name: combiner_test
cpu_cost: 10
build: test
@ -2128,24 +2153,6 @@ targets:
- mac
- linux
- posix
- name: gpr_avl_test
build: test
language: c
src:
- test/core/gpr/avl_test.cc
deps:
- gpr_test_util
- gpr
uses_polling: false
- name: gpr_cmdline_test
build: test
language: c
src:
- test/core/gpr/cmdline_test.cc
deps:
- gpr_test_util
- gpr
uses_polling: false
- name: gpr_cpu_test
cpu_cost: 30
build: test
@ -2364,6 +2371,8 @@ targets:
deps:
- grpc
- gpr
filegroups:
- cmdline
secure: true
uses_polling: false
- name: grpc_credentials_test
@ -2432,6 +2441,8 @@ targets:
deps:
- grpc
- gpr
filegroups:
- cmdline
uses_polling: false
- name: grpc_security_connector_test
build: test
@ -2461,6 +2472,8 @@ targets:
deps:
- grpc
- gpr
filegroups:
- cmdline
uses_polling: false
- name: handshake_client
build: test
@ -2675,7 +2688,9 @@ targets:
src:
- test/core/json/json_rewrite.cc
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
uses_polling: false
- name: json_rewrite_test

@ -42,8 +42,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/gpr/alloc.cc \
src/core/lib/gpr/arena.cc \
src/core/lib/gpr/atm.cc \
src/core/lib/gpr/avl.cc \
src/core/lib/gpr/cmdline.cc \
src/core/lib/gpr/cpu_iphone.cc \
src/core/lib/gpr/cpu_linux.cc \
src/core/lib/gpr/cpu_posix.cc \
@ -64,8 +62,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/gpr/string_posix.cc \
src/core/lib/gpr/string_util_windows.cc \
src/core/lib/gpr/string_windows.cc \
src/core/lib/gpr/subprocess_posix.cc \
src/core/lib/gpr/subprocess_windows.cc \
src/core/lib/gpr/sync.cc \
src/core/lib/gpr/sync_posix.cc \
src/core/lib/gpr/sync_windows.cc \
@ -84,6 +80,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/profiling/basic_timers.cc \
src/core/lib/profiling/stap_timers.cc \
src/core/lib/surface/init.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
src/core/lib/channel/channel_stack.cc \
@ -293,7 +290,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/filters/client_channel/proxy_mapper.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver_factory.cc \
src/core/ext/filters/client_channel/resolver_registry.cc \
src/core/ext/filters/client_channel/retry_throttle.cc \
src/core/ext/filters/client_channel/subchannel.cc \
@ -625,6 +621,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/secure)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/transport)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/inproc)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/avl)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/backoff)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/compression)

@ -19,8 +19,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\gpr\\alloc.cc " +
"src\\core\\lib\\gpr\\arena.cc " +
"src\\core\\lib\\gpr\\atm.cc " +
"src\\core\\lib\\gpr\\avl.cc " +
"src\\core\\lib\\gpr\\cmdline.cc " +
"src\\core\\lib\\gpr\\cpu_iphone.cc " +
"src\\core\\lib\\gpr\\cpu_linux.cc " +
"src\\core\\lib\\gpr\\cpu_posix.cc " +
@ -41,8 +39,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\gpr\\string_posix.cc " +
"src\\core\\lib\\gpr\\string_util_windows.cc " +
"src\\core\\lib\\gpr\\string_windows.cc " +
"src\\core\\lib\\gpr\\subprocess_posix.cc " +
"src\\core\\lib\\gpr\\subprocess_windows.cc " +
"src\\core\\lib\\gpr\\sync.cc " +
"src\\core\\lib\\gpr\\sync_posix.cc " +
"src\\core\\lib\\gpr\\sync_windows.cc " +
@ -61,6 +57,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\profiling\\basic_timers.cc " +
"src\\core\\lib\\profiling\\stap_timers.cc " +
"src\\core\\lib\\surface\\init.cc " +
"src\\core\\lib\\avl\\avl.cc " +
"src\\core\\lib\\backoff\\backoff.cc " +
"src\\core\\lib\\channel\\channel_args.cc " +
"src\\core\\lib\\channel\\channel_stack.cc " +
@ -270,7 +267,6 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\filters\\client_channel\\proxy_mapper.cc " +
"src\\core\\ext\\filters\\client_channel\\proxy_mapper_registry.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver_factory.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver_registry.cc " +
"src\\core\\ext\\filters\\client_channel\\retry_throttle.cc " +
"src\\core\\ext\\filters\\client_channel\\subchannel.cc " +
@ -637,6 +633,7 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\transport");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\inproc");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\avl");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\backoff");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\channel");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\compression");

@ -214,7 +214,12 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/thd_internal.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
'src/core/lib/gprpp/atomic_with_atm.h',
@ -296,6 +301,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/deadline/deadline_filter.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/inproc/inproc_transport.h',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_stack.h',
@ -460,7 +466,12 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/thd_internal.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
'src/core/lib/gprpp/atomic_with_atm.h',
@ -468,6 +479,7 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/manual_constructor.h',
'src/core/lib/gprpp/memory.h',
'src/core/lib/profiling/timers.h',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_stack.h',
@ -629,8 +641,34 @@ Pod::Spec.new do |s|
'test/core/util/port.h',
'test/core/util/port_server_client.h',
'test/core/util/slice_splitter.h',
'test/core/util/subprocess.h',
'test/core/util/tracer_util.h',
'test/core/util/trickle_endpoint.h',
'test/core/util/cmdline.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',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/thd_internal.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
'src/core/lib/gprpp/atomic_with_atm.h',
'src/core/lib/gprpp/atomic_with_std.h',
'src/core/lib/gprpp/manual_constructor.h',
'src/core/lib/gprpp/memory.h',
'src/core/lib/profiling/timers.h',
'src/core/ext/filters/client_channel/backup_poller.h',
'src/core/ext/filters/client_channel/client_channel.h',
'src/core/ext/filters/client_channel/client_channel_factory.h',

@ -114,14 +114,11 @@ Pod::Spec.new do |s|
'include/grpc/support/atm_gcc_atomic.h',
'include/grpc/support/atm_gcc_sync.h',
'include/grpc/support/atm_windows.h',
'include/grpc/support/avl.h',
'include/grpc/support/cmdline.h',
'include/grpc/support/cpu.h',
'include/grpc/support/log.h',
'include/grpc/support/log_windows.h',
'include/grpc/support/port_platform.h',
'include/grpc/support/string_util.h',
'include/grpc/support/subprocess.h',
'include/grpc/support/sync.h',
'include/grpc/support/sync_custom.h',
'include/grpc/support/sync_generic.h',
@ -129,11 +126,6 @@ Pod::Spec.new do |s|
'include/grpc/support/sync_windows.h',
'include/grpc/support/thd.h',
'include/grpc/support/time.h',
'include/grpc/support/tls.h',
'include/grpc/support/tls_gcc.h',
'include/grpc/support/tls_msvc.h',
'include/grpc/support/tls_pthread.h',
'include/grpc/support/useful.h',
'include/grpc/impl/codegen/atm.h',
'include/grpc/impl/codegen/atm_gcc_atomic.h',
'include/grpc/impl/codegen/atm_gcc_sync.h',
@ -202,7 +194,12 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/thd_internal.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
'src/core/lib/gprpp/atomic_with_atm.h',
@ -213,8 +210,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/alloc.cc',
'src/core/lib/gpr/arena.cc',
'src/core/lib/gpr/atm.cc',
'src/core/lib/gpr/avl.cc',
'src/core/lib/gpr/cmdline.cc',
'src/core/lib/gpr/cpu_iphone.cc',
'src/core/lib/gpr/cpu_linux.cc',
'src/core/lib/gpr/cpu_posix.cc',
@ -235,8 +230,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_posix.cc',
'src/core/lib/gpr/string_util_windows.cc',
'src/core/lib/gpr/string_windows.cc',
'src/core/lib/gpr/subprocess_posix.cc',
'src/core/lib/gpr/subprocess_windows.cc',
'src/core/lib/gpr/sync.cc',
'src/core/lib/gpr/sync_posix.cc',
'src/core/lib/gpr/sync_windows.cc',
@ -328,6 +321,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/deadline/deadline_filter.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/inproc/inproc_transport.h',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_stack.h',
@ -470,6 +464,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/lib/surface/init.cc',
'src/core/lib/avl/avl.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
@ -679,7 +674,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/proxy_mapper.cc',
'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
'src/core/ext/filters/client_channel/resolver.cc',
'src/core/ext/filters/client_channel/resolver_factory.cc',
'src/core/ext/filters/client_channel/resolver_registry.cc',
'src/core/ext/filters/client_channel/retry_throttle.cc',
'src/core/ext/filters/client_channel/subchannel.cc',
@ -729,7 +723,12 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/thd_internal.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
'src/core/lib/gprpp/atomic_with_atm.h',
@ -811,6 +810,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/deadline/deadline_filter.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/inproc/inproc_transport.h',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_stack.h',
@ -1000,8 +1000,11 @@ Pod::Spec.new do |s|
'test/core/util/port_isolated_runtime_environment.cc',
'test/core/util/port_server_client.cc',
'test/core/util/slice_splitter.cc',
'test/core/util/subprocess_posix.cc',
'test/core/util/subprocess_windows.cc',
'test/core/util/tracer_util.cc',
'test/core/util/trickle_endpoint.cc',
'test/core/util/cmdline.cc',
'test/core/end2end/data/ssl_test_data.h',
'test/core/security/oauth2_utils.h',
'test/core/end2end/cq_verifier.h',
@ -1018,8 +1021,10 @@ Pod::Spec.new do |s|
'test/core/util/port.h',
'test/core/util/port_server_client.h',
'test/core/util/slice_splitter.h',
'test/core/util/subprocess.h',
'test/core/util/tracer_util.h',
'test/core/util/trickle_endpoint.h',
'test/core/util/cmdline.h',
'test/core/end2end/end2end_tests.cc',
'test/core/end2end/end2end_test_utils.cc',
'test/core/end2end/tests/authority_not_supported.cc',

@ -176,23 +176,6 @@ EXPORTS
gpr_free_aligned
gpr_set_allocation_functions
gpr_get_allocation_functions
gpr_avl_create
gpr_avl_ref
gpr_avl_unref
gpr_avl_add
gpr_avl_remove
gpr_avl_get
gpr_avl_maybe_get
gpr_avl_is_empty
gpr_cmdline_create
gpr_cmdline_add_int
gpr_cmdline_add_flag
gpr_cmdline_add_string
gpr_cmdline_on_extra_arg
gpr_cmdline_set_survive_failure
gpr_cmdline_parse
gpr_cmdline_destroy
gpr_cmdline_usage_string
gpr_cpu_num_cores
gpr_cpu_current_cpu
gpr_log_severity_string
@ -204,11 +187,6 @@ EXPORTS
gpr_format_message
gpr_strdup
gpr_asprintf
gpr_subprocess_binary_extension
gpr_subprocess_create
gpr_subprocess_destroy
gpr_subprocess_join
gpr_subprocess_interrupt
gpr_mu_init
gpr_mu_destroy
gpr_mu_lock

@ -49,14 +49,11 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/support/atm_gcc_atomic.h )
s.files += %w( include/grpc/support/atm_gcc_sync.h )
s.files += %w( include/grpc/support/atm_windows.h )
s.files += %w( include/grpc/support/avl.h )
s.files += %w( include/grpc/support/cmdline.h )
s.files += %w( include/grpc/support/cpu.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 )
s.files += %w( include/grpc/support/string_util.h )
s.files += %w( include/grpc/support/subprocess.h )
s.files += %w( include/grpc/support/sync.h )
s.files += %w( include/grpc/support/sync_custom.h )
s.files += %w( include/grpc/support/sync_generic.h )
@ -64,11 +61,6 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/support/sync_windows.h )
s.files += %w( include/grpc/support/thd.h )
s.files += %w( include/grpc/support/time.h )
s.files += %w( include/grpc/support/tls.h )
s.files += %w( include/grpc/support/tls_gcc.h )
s.files += %w( include/grpc/support/tls_msvc.h )
s.files += %w( include/grpc/support/tls_pthread.h )
s.files += %w( include/grpc/support/useful.h )
s.files += %w( include/grpc/impl/codegen/atm.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h )
@ -93,7 +85,12 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/string_windows.h )
s.files += %w( src/core/lib/gpr/thd_internal.h )
s.files += %w( src/core/lib/gpr/time_precise.h )
s.files += %w( src/core/lib/gpr/tls.h )
s.files += %w( src/core/lib/gpr/tls_gcc.h )
s.files += %w( src/core/lib/gpr/tls_msvc.h )
s.files += %w( src/core/lib/gpr/tls_pthread.h )
s.files += %w( src/core/lib/gpr/tmpfile.h )
s.files += %w( src/core/lib/gpr/useful.h )
s.files += %w( src/core/lib/gprpp/abstract.h )
s.files += %w( src/core/lib/gprpp/atomic.h )
s.files += %w( src/core/lib/gprpp/atomic_with_atm.h )
@ -104,8 +101,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/alloc.cc )
s.files += %w( src/core/lib/gpr/arena.cc )
s.files += %w( src/core/lib/gpr/atm.cc )
s.files += %w( src/core/lib/gpr/avl.cc )
s.files += %w( src/core/lib/gpr/cmdline.cc )
s.files += %w( src/core/lib/gpr/cpu_iphone.cc )
s.files += %w( src/core/lib/gpr/cpu_linux.cc )
s.files += %w( src/core/lib/gpr/cpu_posix.cc )
@ -126,8 +121,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/string_posix.cc )
s.files += %w( src/core/lib/gpr/string_util_windows.cc )
s.files += %w( src/core/lib/gpr/string_windows.cc )
s.files += %w( src/core/lib/gpr/subprocess_posix.cc )
s.files += %w( src/core/lib/gpr/subprocess_windows.cc )
s.files += %w( src/core/lib/gpr/sync.cc )
s.files += %w( src/core/lib/gpr/sync_posix.cc )
s.files += %w( src/core/lib/gpr/sync_windows.cc )
@ -254,6 +247,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/deadline/deadline_filter.h )
s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h )
s.files += %w( src/core/ext/transport/inproc/inproc_transport.h )
s.files += %w( src/core/lib/avl/avl.h )
s.files += %w( src/core/lib/backoff/backoff.h )
s.files += %w( src/core/lib/channel/channel_args.h )
s.files += %w( src/core/lib/channel/channel_stack.h )
@ -400,6 +394,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h )
s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h )
s.files += %w( src/core/lib/surface/init.cc )
s.files += %w( src/core/lib/avl/avl.cc )
s.files += %w( src/core/lib/backoff/backoff.cc )
s.files += %w( src/core/lib/channel/channel_args.cc )
s.files += %w( src/core/lib/channel/channel_stack.cc )
@ -609,7 +604,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/client_channel/proxy_mapper.cc )
s.files += %w( src/core/ext/filters/client_channel/proxy_mapper_registry.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver_factory.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver_registry.cc )
s.files += %w( src/core/ext/filters/client_channel/retry_throttle.cc )
s.files += %w( src/core/ext/filters/client_channel/subchannel.cc )

@ -164,8 +164,6 @@
'src/core/lib/gpr/alloc.cc',
'src/core/lib/gpr/arena.cc',
'src/core/lib/gpr/atm.cc',
'src/core/lib/gpr/avl.cc',
'src/core/lib/gpr/cmdline.cc',
'src/core/lib/gpr/cpu_iphone.cc',
'src/core/lib/gpr/cpu_linux.cc',
'src/core/lib/gpr/cpu_posix.cc',
@ -186,8 +184,6 @@
'src/core/lib/gpr/string_posix.cc',
'src/core/lib/gpr/string_util_windows.cc',
'src/core/lib/gpr/string_windows.cc',
'src/core/lib/gpr/subprocess_posix.cc',
'src/core/lib/gpr/subprocess_windows.cc',
'src/core/lib/gpr/sync.cc',
'src/core/lib/gpr/sync_posix.cc',
'src/core/lib/gpr/sync_windows.cc',
@ -225,6 +221,7 @@
],
'sources': [
'src/core/lib/surface/init.cc',
'src/core/lib/avl/avl.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
@ -434,7 +431,6 @@
'src/core/ext/filters/client_channel/proxy_mapper.cc',
'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
'src/core/ext/filters/client_channel/resolver.cc',
'src/core/ext/filters/client_channel/resolver_factory.cc',
'src/core/ext/filters/client_channel/resolver_registry.cc',
'src/core/ext/filters/client_channel/retry_throttle.cc',
'src/core/ext/filters/client_channel/subchannel.cc',
@ -517,8 +513,12 @@
'test/core/util/port_isolated_runtime_environment.cc',
'test/core/util/port_server_client.cc',
'test/core/util/slice_splitter.cc',
'test/core/util/subprocess_posix.cc',
'test/core/util/subprocess_windows.cc',
'test/core/util/tracer_util.cc',
'test/core/util/trickle_endpoint.cc',
'test/core/util/cmdline.cc',
'src/core/lib/avl/avl.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
@ -668,7 +668,6 @@
'src/core/ext/filters/client_channel/proxy_mapper.cc',
'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
'src/core/ext/filters/client_channel/resolver.cc',
'src/core/ext/filters/client_channel/resolver_factory.cc',
'src/core/ext/filters/client_channel/resolver_registry.cc',
'src/core/ext/filters/client_channel/retry_throttle.cc',
'src/core/ext/filters/client_channel/subchannel.cc',
@ -729,8 +728,12 @@
'test/core/util/port_isolated_runtime_environment.cc',
'test/core/util/port_server_client.cc',
'test/core/util/slice_splitter.cc',
'test/core/util/subprocess_posix.cc',
'test/core/util/subprocess_windows.cc',
'test/core/util/tracer_util.cc',
'test/core/util/trickle_endpoint.cc',
'test/core/util/cmdline.cc',
'src/core/lib/avl/avl.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
@ -880,7 +883,6 @@
'src/core/ext/filters/client_channel/proxy_mapper.cc',
'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
'src/core/ext/filters/client_channel/resolver.cc',
'src/core/ext/filters/client_channel/resolver_factory.cc',
'src/core/ext/filters/client_channel/resolver_registry.cc',
'src/core/ext/filters/client_channel/retry_throttle.cc',
'src/core/ext/filters/client_channel/subchannel.cc',
@ -925,6 +927,7 @@
'sources': [
'src/core/lib/surface/init.cc',
'src/core/lib/surface/init_unsecure.cc',
'src/core/lib/avl/avl.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
@ -1107,7 +1110,6 @@
'src/core/ext/filters/client_channel/proxy_mapper.cc',
'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
'src/core/ext/filters/client_channel/resolver.cc',
'src/core/ext/filters/client_channel/resolver_factory.cc',
'src/core/ext/filters/client_channel/resolver_registry.cc',
'src/core/ext/filters/client_channel/retry_throttle.cc',
'src/core/ext/filters/client_channel/subchannel.cc',

@ -30,7 +30,6 @@
#include <grpc++/support/config.h>
#include <grpc/compression.h>
#include <grpc/support/cpu.h>
#include <grpc/support/useful.h>
#include <grpc/support/workaround_list.h>
struct grpc_resource_quota;

@ -4,20 +4,15 @@ framework module grpc {
header "support/alloc.h"
header "support/atm.h"
header "support/avl.h"
header "support/cmdline.h"
header "support/cpu.h"
header "support/log.h"
header "support/log_windows.h"
header "support/port_platform.h"
header "support/string_util.h"
header "support/subprocess.h"
header "support/sync.h"
header "support/sync_generic.h"
header "support/thd.h"
header "support/time.h"
header "support/tls.h"
header "support/useful.h"
header "impl/codegen/atm.h"
header "impl/codegen/fork.h"
header "impl/codegen/gpr_slice.h"
@ -61,9 +56,6 @@ framework module grpc {
textual header "support/sync_custom.h"
textual header "support/sync_posix.h"
textual header "support/sync_windows.h"
textual header "support/tls_gcc.h"
textual header "support/tls_msvc.h"
textual header "support/tls_pthread.h"
textual header "impl/codegen/atm_gcc_atomic.h"
textual header "impl/codegen/atm_gcc_sync.h"
textual header "impl/codegen/atm_windows.h"

@ -56,14 +56,11 @@
<file baseinstalldir="/" name="include/grpc/support/atm_gcc_atomic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/atm_gcc_sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/atm_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/avl.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/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" />
<file baseinstalldir="/" name="include/grpc/support/string_util.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/subprocess.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_custom.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_generic.h" role="src" />
@ -71,11 +68,6 @@
<file baseinstalldir="/" name="include/grpc/support/sync_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/thd.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/time.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/tls.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/tls_gcc.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/tls_msvc.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/tls_pthread.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/useful.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_gcc_atomic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_gcc_sync.h" role="src" />
@ -100,7 +92,12 @@
<file baseinstalldir="/" name="src/core/lib/gpr/string_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/thd_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/time_precise.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tls.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tls_gcc.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tls_msvc.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tls_pthread.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tmpfile.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/useful.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/abstract.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/atomic.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/atomic_with_atm.h" role="src" />
@ -111,8 +108,6 @@
<file baseinstalldir="/" name="src/core/lib/gpr/alloc.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/arena.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/atm.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/avl.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/cmdline.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/cpu_iphone.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/cpu_linux.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/cpu_posix.cc" role="src" />
@ -133,8 +128,6 @@
<file baseinstalldir="/" name="src/core/lib/gpr/string_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string_util_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/subprocess_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/subprocess_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/sync.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/sync_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/sync_windows.cc" role="src" />
@ -261,6 +254,7 @@
<file baseinstalldir="/" name="src/core/ext/filters/deadline/deadline_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/chttp2_connector.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/inproc/inproc_transport.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/avl/avl.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/backoff/backoff.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.h" role="src" />
@ -407,6 +401,7 @@
<file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/init.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/avl/avl.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/backoff/backoff.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.cc" role="src" />
@ -616,7 +611,6 @@
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/proxy_mapper.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/proxy_mapper_registry.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver_factory.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver_registry.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/retry_throttle.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/subchannel.cc" role="src" />

@ -29,7 +29,6 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
#include "src/core/ext/filters/client_channel/backup_poller.h"
#include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
@ -165,7 +164,7 @@ struct external_connectivity_watcher;
typedef struct client_channel_channel_data {
/** resolver for this channel */
grpc_resolver* resolver;
grpc_core::OrphanablePtr<grpc_core::Resolver> resolver;
/** have we started resolving this channel */
bool started_resolving;
/** is deadline checking enabled? */
@ -300,8 +299,8 @@ static void start_resolving_locked(channel_data* chand) {
GPR_ASSERT(!chand->started_resolving);
chand->started_resolving = true;
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
grpc_resolver_next_locked(chand->resolver, &chand->resolver_result,
&chand->on_resolver_result_changed);
chand->resolver->NextLocked(&chand->resolver_result,
&chand->on_resolver_result_changed);
}
typedef struct {
@ -378,7 +377,7 @@ static void request_reresolution_locked(void* arg, grpc_error* error) {
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p: started name re-resolving", chand);
}
grpc_resolver_channel_saw_error_locked(chand->resolver);
chand->resolver->RequestReresolutionLocked();
// Give back the closure to the LB policy.
grpc_lb_policy_set_reresolve_closure_locked(chand->lb_policy, &args->closure);
}
@ -568,9 +567,7 @@ static void on_resolver_result_changed_locked(void* arg, grpc_error* error) {
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p: shutting down resolver", chand);
}
grpc_resolver_shutdown_locked(chand->resolver);
GRPC_RESOLVER_UNREF(chand->resolver, "channel");
chand->resolver = nullptr;
chand->resolver.reset();
}
set_channel_connectivity_state_locked(
chand, GRPC_CHANNEL_SHUTDOWN,
@ -606,8 +603,8 @@ static void on_resolver_result_changed_locked(void* arg, grpc_error* error) {
set_channel_connectivity_state_locked(
chand, state, GRPC_ERROR_REF(state_error), "new_lb+resolver");
}
grpc_resolver_next_locked(chand->resolver, &chand->resolver_result,
&chand->on_resolver_result_changed);
chand->resolver->NextLocked(&chand->resolver_result,
&chand->on_resolver_result_changed);
GRPC_ERROR_UNREF(state_error);
}
}
@ -648,9 +645,7 @@ static void start_transport_op_locked(void* arg, grpc_error* error_ignored) {
set_channel_connectivity_state_locked(
chand, GRPC_CHANNEL_SHUTDOWN,
GRPC_ERROR_REF(op->disconnect_with_error), "disconnect");
grpc_resolver_shutdown_locked(chand->resolver);
GRPC_RESOLVER_UNREF(chand->resolver, "channel");
chand->resolver = nullptr;
chand->resolver.reset();
if (!chand->started_resolving) {
grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures,
GRPC_ERROR_REF(op->disconnect_with_error));
@ -759,7 +754,7 @@ static grpc_error* cc_init_channel_elem(grpc_channel_element* elem,
grpc_proxy_mappers_map_name(arg->value.string, args->channel_args,
&proxy_name, &new_args);
// Instantiate resolver.
chand->resolver = grpc_resolver_create(
chand->resolver = grpc_core::ResolverRegistry::CreateResolver(
proxy_name != nullptr ? proxy_name : arg->value.string,
new_args != nullptr ? new_args : args->channel_args,
chand->interested_parties, chand->combiner);
@ -774,9 +769,8 @@ static grpc_error* cc_init_channel_elem(grpc_channel_element* elem,
}
static void shutdown_resolver_locked(void* arg, grpc_error* error) {
grpc_resolver* resolver = (grpc_resolver*)arg;
grpc_resolver_shutdown_locked(resolver);
GRPC_RESOLVER_UNREF(resolver, "channel");
grpc_core::Resolver* resolver = static_cast<grpc_core::Resolver*>(arg);
resolver->Orphan();
}
/* Destructor for channel_data */
@ -784,7 +778,7 @@ static void cc_destroy_channel_elem(grpc_channel_element* elem) {
channel_data* chand = (channel_data*)elem->channel_data;
if (chand->resolver != nullptr) {
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_CREATE(shutdown_resolver_locked, chand->resolver,
GRPC_CLOSURE_CREATE(shutdown_resolver_locked, chand->resolver.release(),
grpc_combiner_scheduler(chand->combiner)),
GRPC_ERROR_NONE);
}

@ -49,14 +49,14 @@ static bool set_default_host_if_unset(grpc_channel_stack_builder* builder,
return true;
}
}
char* default_authority = grpc_get_default_authority(
grpc_channel_stack_builder_get_target(builder));
if (default_authority != nullptr) {
grpc_core::UniquePtr<char> default_authority =
grpc_core::ResolverRegistry::GetDefaultAuthority(
grpc_channel_stack_builder_get_target(builder));
if (default_authority.get() != nullptr) {
grpc_arg arg = grpc_channel_arg_string_create(
(char*)GRPC_ARG_DEFAULT_AUTHORITY, default_authority);
(char*)GRPC_ARG_DEFAULT_AUTHORITY, default_authority.get());
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
grpc_channel_stack_builder_set_channel_arguments(builder, new_args);
gpr_free(default_authority);
grpc_channel_args_destroy(new_args);
}
return true;
@ -64,7 +64,7 @@ static bool set_default_host_if_unset(grpc_channel_stack_builder* builder,
void grpc_client_channel_init(void) {
grpc_lb_policy_registry_init();
grpc_resolver_registry_init();
grpc_core::ResolverRegistry::Builder::InitRegistry();
grpc_retry_throttle_map_init();
grpc_proxy_mapper_registry_init();
grpc_register_http_proxy_mapper();
@ -82,6 +82,6 @@ void grpc_client_channel_shutdown(void) {
grpc_channel_init_shutdown();
grpc_proxy_mapper_registry_shutdown();
grpc_retry_throttle_map_shutdown();
grpc_resolver_registry_shutdown();
grpc_core::ResolverRegistry::Builder::ShutdownRegistry();
grpc_lb_policy_registry_shutdown();
}

@ -108,6 +108,7 @@
#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/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
@ -242,7 +243,8 @@ typedef struct glb_lb_policy {
glb_lb_call_data* lb_calld;
/** response generator to inject address updates into \a lb_channel */
grpc_fake_resolver_response_generator* response_generator;
grpc_core::RefCountedPtr<grpc_core::FakeResolverResponseGenerator>
response_generator;
/** the RR policy to use of the backend servers returned by the LB server */
grpc_lb_policy* rr_policy;
@ -872,7 +874,7 @@ static int balancer_name_cmp_fn(void* a, void* b) {
* - \a args: other args inherited from the grpclb policy. */
static grpc_channel_args* build_lb_channel_args(
const grpc_lb_addresses* addresses,
grpc_fake_resolver_response_generator* response_generator,
grpc_core::FakeResolverResponseGenerator* response_generator,
const grpc_channel_args* args) {
size_t num_grpclb_addrs = 0;
for (size_t i = 0; i < addresses->num_addresses; ++i) {
@ -941,7 +943,8 @@ static void glb_destroy(grpc_lb_policy* pol) {
if (glb_policy->fallback_backend_addresses != nullptr) {
grpc_lb_addresses_destroy(glb_policy->fallback_backend_addresses);
}
grpc_fake_resolver_response_generator_unref(glb_policy->response_generator);
// TODO(roth): Remove this once the LB policy becomes a C++ object.
glb_policy->response_generator.reset();
grpc_subchannel_index_unref();
gpr_free(glb_policy);
}
@ -1701,9 +1704,8 @@ static void glb_update_locked(grpc_lb_policy* policy,
// Propagate updates to the LB channel (pick_first) through the fake
// resolver.
grpc_channel_args* lb_channel_args = build_lb_channel_args(
addresses, glb_policy->response_generator, args->args);
grpc_fake_resolver_response_generator_set_response(
glb_policy->response_generator, lb_channel_args);
addresses, glb_policy->response_generator.get(), args->args);
glb_policy->response_generator->SetResponse(lb_channel_args);
grpc_channel_args_destroy(lb_channel_args);
// Start watching the LB channel connectivity for connection, if not
// already doing so.
@ -1858,17 +1860,16 @@ static grpc_lb_policy* glb_create(grpc_lb_policy_factory* factory,
/* Create a client channel over them to communicate with a LB service */
glb_policy->response_generator =
grpc_fake_resolver_response_generator_create();
grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
grpc_channel_args* lb_channel_args = build_lb_channel_args(
addresses, glb_policy->response_generator, args->args);
addresses, glb_policy->response_generator.get(), args->args);
char* uri_str;
gpr_asprintf(&uri_str, "fake:///%s", glb_policy->server_name);
glb_policy->lb_channel = grpc_lb_policy_grpclb_create_lb_channel(
uri_str, args->client_channel_factory, lb_channel_args);
/* Propagate initial resolution */
grpc_fake_resolver_response_generator_set_response(
glb_policy->response_generator, lb_channel_args);
glb_policy->response_generator->SetResponse(lb_channel_args);
grpc_channel_args_destroy(lb_channel_args);
gpr_free(uri_str);
if (glb_policy->lb_channel == nullptr) {

@ -37,10 +37,11 @@ grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args(
grpc_slice_hash_table* targets_info,
grpc_fake_resolver_response_generator* response_generator,
grpc_core::FakeResolverResponseGenerator* response_generator,
const grpc_channel_args* args) {
const grpc_arg to_add[] = {
grpc_fake_resolver_response_generator_arg(response_generator)};
grpc_core::FakeResolverResponseGenerator::MakeChannelArg(
response_generator)};
/* We remove:
*
* - The channel arg for the LB policy name, since we want to use the default

@ -37,7 +37,7 @@ grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args(
grpc_slice_hash_table* targets_info,
grpc_fake_resolver_response_generator* response_generator,
grpc_core::FakeResolverResponseGenerator* response_generator,
const grpc_channel_args* args);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CHANNEL_H \

@ -63,11 +63,12 @@ grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args(
grpc_slice_hash_table* targets_info,
grpc_fake_resolver_response_generator* response_generator,
grpc_core::FakeResolverResponseGenerator* response_generator,
const grpc_channel_args* args) {
const grpc_arg to_add[] = {
grpc_lb_targets_info_create_channel_arg(targets_info),
grpc_fake_resolver_response_generator_arg(response_generator)};
grpc_core::FakeResolverResponseGenerator::MakeChannelArg(
response_generator)};
/* We remove:
*
* - The channel arg for the LB policy name, since we want to use the default

@ -24,7 +24,6 @@
#include <grpc/support/atm.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
#include "src/core/lib/channel/channel_args.h"

@ -22,58 +22,12 @@
grpc_core::DebugOnlyTraceFlag grpc_trace_resolver_refcount(false,
"resolver_refcount");
void grpc_resolver_init(grpc_resolver* resolver,
const grpc_resolver_vtable* vtable,
grpc_combiner* combiner) {
resolver->vtable = vtable;
resolver->combiner = GRPC_COMBINER_REF(combiner, "resolver");
gpr_ref_init(&resolver->refs, 1);
}
namespace grpc_core {
#ifndef NDEBUG
void grpc_resolver_ref(grpc_resolver* resolver, const char* file, int line,
const char* reason) {
if (grpc_trace_resolver_refcount.enabled()) {
gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"RESOLVER:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", resolver,
old_refs, old_refs + 1, reason);
}
#else
void grpc_resolver_ref(grpc_resolver* resolver) {
#endif
gpr_ref(&resolver->refs);
}
Resolver::Resolver(grpc_combiner* combiner)
: InternallyRefCountedWithTracing(&grpc_trace_resolver_refcount),
combiner_(GRPC_COMBINER_REF(combiner, "resolver")) {}
#ifndef NDEBUG
void grpc_resolver_unref(grpc_resolver* resolver, const char* file, int line,
const char* reason) {
if (grpc_trace_resolver_refcount.enabled()) {
gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"RESOLVER:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", resolver,
old_refs, old_refs - 1, reason);
}
#else
void grpc_resolver_unref(grpc_resolver* resolver) {
#endif
if (gpr_unref(&resolver->refs)) {
grpc_combiner* combiner = resolver->combiner;
resolver->vtable->destroy(resolver);
GRPC_COMBINER_UNREF(combiner, "resolver");
}
}
Resolver::~Resolver() { GRPC_COMBINER_UNREF(combiner_, "resolver"); }
void grpc_resolver_shutdown_locked(grpc_resolver* resolver) {
resolver->vtable->shutdown_locked(resolver);
}
void grpc_resolver_channel_saw_error_locked(grpc_resolver* resolver) {
resolver->vtable->channel_saw_error_locked(resolver);
}
void grpc_resolver_next_locked(grpc_resolver* resolver,
grpc_channel_args** result,
grpc_closure* on_complete) {
resolver->vtable->next_locked(resolver, result, on_complete);
}
} // namespace grpc_core

@ -19,67 +19,110 @@
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H
#include "src/core/ext/filters/client_channel/subchannel.h"
#include "src/core/lib/iomgr/iomgr.h"
#include <grpc/impl/codegen/grpc_types.h>
typedef struct grpc_resolver grpc_resolver;
typedef struct grpc_resolver_vtable grpc_resolver_vtable;
#include "src/core/lib/gprpp/abstract.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/iomgr.h"
extern grpc_core::DebugOnlyTraceFlag grpc_trace_resolver_refcount;
/** \a grpc_resolver provides \a grpc_channel_args objects to its caller */
struct grpc_resolver {
const grpc_resolver_vtable* vtable;
gpr_refcount refs;
grpc_combiner* combiner;
};
namespace grpc_core {
/// Interface for name resolution.
///
/// This interface is designed to support both push-based and pull-based
/// mechanisms. A push-based mechanism is one where the resolver will
/// subscribe to updates for a given name, and the name service will
/// proactively send new data to the resolver whenever the data associated
/// with the name changes. A pull-based mechanism is one where the resolver
/// needs to query the name service again to get updated information (e.g.,
/// DNS).
///
/// Note: All methods with a "Locked" suffix must be called from the
/// combiner passed to the constructor.
class Resolver : public InternallyRefCountedWithTracing<Resolver> {
public:
// Not copyable nor movable.
Resolver(const Resolver&) = delete;
Resolver& operator=(const Resolver&) = delete;
/// Requests a callback when a new result becomes available.
/// When the new result is available, sets \a *result to the new result
/// and schedules \a on_complete for execution.
/// If resolution is fatally broken, sets \a *result to nullptr and
/// schedules \a on_complete with an error.
///
/// Note that the client channel will almost always have a request
/// to \a NextLocked() pending. When it gets the callback, it will
/// process the new result and then immediately make another call to
/// \a NextLocked(). This allows push-based resolvers to provide new
/// data as soon as it becomes available.
virtual void NextLocked(grpc_channel_args** result,
grpc_closure* on_complete) GRPC_ABSTRACT;
/// Asks the resolver to obtain an updated resolver result, if
/// applicable.
///
/// This is useful for pull-based implementations to decide when to
/// re-resolve. However, the implementation is not required to
/// re-resolve immediately upon receiving this call; it may instead
/// elect to delay based on some configured minimum time between
/// queries, to avoid hammering the name service with queries.
///
/// For push-based implementations, this may be a no-op.
///
/// If this causes new data to become available, then the currently
/// pending call to \a NextLocked() will return the new result.
///
/// Note: Currently, all resolvers are required to return a new result
/// shortly after this method is called. For pull-based mechanisms, if
/// the implementation decides to delay querying the name service, it
/// should immediately return a new copy of the previously returned
/// result (and it can then return the updated data later, when it
/// actually does query the name service). For push-based mechanisms,
/// the implementation should immediately return a new copy of the
/// last-seen result.
/// TODO(roth): Remove this requirement once we fix pick_first to not
/// throw away unselected subchannels.
virtual void RequestReresolutionLocked() GRPC_ABSTRACT;
void Orphan() override {
// Invoke ShutdownAndUnrefLocked() inside of the combiner.
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_CREATE(&Resolver::ShutdownAndUnrefLocked, this,
grpc_combiner_scheduler(combiner_)),
GRPC_ERROR_NONE);
}
GRPC_ABSTRACT_BASE_CLASS
protected:
/// Does NOT take ownership of the reference to \a combiner.
// TODO(roth): Once we have a C++-like interface for combiners, this
// API should change to take a RefCountedPtr<>, so that we always take
// ownership of a new ref.
explicit Resolver(grpc_combiner* combiner);
virtual ~Resolver();
/// Shuts down the resolver. If there is a pending call to
/// NextLocked(), the callback will be scheduled with an error.
virtual void ShutdownLocked() GRPC_ABSTRACT;
grpc_combiner* combiner() const { return combiner_; }
private:
static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored) {
Resolver* resolver = static_cast<Resolver*>(arg);
resolver->ShutdownLocked();
resolver->Unref();
}
struct grpc_resolver_vtable {
void (*destroy)(grpc_resolver* resolver);
void (*shutdown_locked)(grpc_resolver* resolver);
void (*channel_saw_error_locked)(grpc_resolver* resolver);
void (*next_locked)(grpc_resolver* resolver, grpc_channel_args** result,
grpc_closure* on_complete);
grpc_combiner* combiner_;
};
#ifndef NDEBUG
#define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p), __FILE__, __LINE__, (r))
#define GRPC_RESOLVER_UNREF(p, r) \
grpc_resolver_unref((p), __FILE__, __LINE__, (r))
void grpc_resolver_ref(grpc_resolver* policy, const char* file, int line,
const char* reason);
void grpc_resolver_unref(grpc_resolver* policy, const char* file, int line,
const char* reason);
#else
#define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p))
#define GRPC_RESOLVER_UNREF(p, r) grpc_resolver_unref((p))
void grpc_resolver_ref(grpc_resolver* policy);
void grpc_resolver_unref(grpc_resolver* policy);
#endif
void grpc_resolver_init(grpc_resolver* resolver,
const grpc_resolver_vtable* vtable,
grpc_combiner* combiner);
void grpc_resolver_shutdown_locked(grpc_resolver* resolver);
/** Notification that the channel has seen an error on some address.
Can be used as a hint that re-resolution is desirable soon.
Must be called from the combiner passed as a resolver_arg at construction
time.*/
void grpc_resolver_channel_saw_error_locked(grpc_resolver* resolver);
/** Get the next result from the resolver. Expected to set \a *result with
new channel args and then schedule \a on_complete for execution.
If resolution is fatally broken, set \a *result to NULL and
schedule \a on_complete.
Must be called from the combiner passed as a resolver_arg at construction
time.*/
void grpc_resolver_next_locked(grpc_resolver* resolver,
grpc_channel_args** result,
grpc_closure* on_complete);
} // namespace grpc_core
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H */

@ -49,109 +49,168 @@
#define GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS 120
#define GRPC_DNS_RECONNECT_JITTER 0.2
typedef struct {
/** base class: must be first */
grpc_resolver base;
/** DNS server to use (if not system default) */
char* dns_server;
/** name to resolve (usually the same as target_name) */
char* name_to_resolve;
/** default port to use */
char* default_port;
/** channel args. */
grpc_channel_args* channel_args;
/** whether to request the service config */
bool request_service_config;
/** pollset_set to drive the name resolution process */
grpc_pollset_set* interested_parties;
/** Closures used by the combiner */
grpc_closure dns_ares_on_next_resolution_timer_closure;
grpc_closure dns_ares_on_resolved_closure;
/** Combiner guarding the rest of the state */
grpc_combiner* combiner;
/** are we currently resolving? */
bool resolving;
/** the pending resolving request */
grpc_ares_request* pending_request;
/** which version of the result have we published? */
int published_version;
/** which version of the result is current? */
int resolved_version;
/** pending next completion, or NULL */
grpc_closure* next_completion;
/** target result address for next completion */
grpc_channel_args** target_result;
/** current (fully resolved) result */
grpc_channel_args* resolved_result;
/** next resolution timer */
bool have_next_resolution_timer;
grpc_timer next_resolution_timer;
/** retry backoff state */
grpc_core::ManualConstructor<grpc_core::BackOff> backoff;
/** min resolution period. Max one resolution will happen per period */
grpc_millis min_time_between_resolutions;
/** when was the last resolution? -1 if no resolution has happened yet */
grpc_millis last_resolution_timestamp;
/** currently resolving addresses */
grpc_lb_addresses* lb_addresses;
/** currently resolving service config */
char* service_config_json;
} ares_dns_resolver;
static void dns_ares_destroy(grpc_resolver* r);
static void dns_ares_start_resolving_locked(ares_dns_resolver* r);
static void dns_ares_maybe_start_resolving_locked(ares_dns_resolver* r);
static void dns_ares_maybe_finish_next_locked(ares_dns_resolver* r);
static void dns_ares_shutdown_locked(grpc_resolver* r);
static void dns_ares_channel_saw_error_locked(grpc_resolver* r);
static void dns_ares_next_locked(grpc_resolver* r,
grpc_channel_args** target_result,
grpc_closure* on_complete);
static const grpc_resolver_vtable dns_ares_resolver_vtable = {
dns_ares_destroy, dns_ares_shutdown_locked,
dns_ares_channel_saw_error_locked, dns_ares_next_locked};
static void dns_ares_shutdown_locked(grpc_resolver* resolver) {
ares_dns_resolver* r = (ares_dns_resolver*)resolver;
if (r->have_next_resolution_timer) {
grpc_timer_cancel(&r->next_resolution_timer);
namespace grpc_core {
namespace {
const char kDefaultPort[] = "https";
class AresDnsResolver : public Resolver {
public:
explicit AresDnsResolver(const ResolverArgs& args);
void NextLocked(grpc_channel_args** result,
grpc_closure* on_complete) override;
void RequestReresolutionLocked() override;
void ShutdownLocked() override;
private:
virtual ~AresDnsResolver();
void MaybeStartResolvingLocked();
void StartResolvingLocked();
void MaybeFinishNextLocked();
static void OnNextResolutionLocked(void* arg, grpc_error* error);
static void OnResolvedLocked(void* arg, grpc_error* error);
/// DNS server to use (if not system default)
char* dns_server_;
/// name to resolve (usually the same as target_name)
char* name_to_resolve_;
/// channel args
grpc_channel_args* channel_args_;
/// whether to request the service config
bool request_service_config_;
/// pollset_set to drive the name resolution process
grpc_pollset_set* interested_parties_;
/// closures used by the combiner
grpc_closure on_next_resolution_;
grpc_closure on_resolved_;
/// are we currently resolving?
bool resolving_ = false;
/// the pending resolving request
grpc_ares_request* pending_request_ = nullptr;
/// which version of the result have we published?
int published_version_ = 0;
/// which version of the result is current?
int resolved_version_ = 0;
/// pending next completion, or NULL
grpc_closure* next_completion_ = nullptr;
/// target result address for next completion
grpc_channel_args** target_result_ = nullptr;
/// current (fully resolved) result
grpc_channel_args* resolved_result_ = nullptr;
/// next resolution timer
bool have_next_resolution_timer_ = false;
grpc_timer next_resolution_timer_;
/// min interval between DNS requests
grpc_millis min_time_between_resolutions_;
/// timestamp of last DNS request
grpc_millis last_resolution_timestamp_ = -1;
/// retry backoff state
BackOff backoff_;
/// currently resolving addresses
grpc_lb_addresses* lb_addresses_ = nullptr;
/// currently resolving service config
char* service_config_json_ = nullptr;
};
AresDnsResolver::AresDnsResolver(const ResolverArgs& args)
: Resolver(args.combiner),
backoff_(
BackOff::Options()
.set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS *
1000)
.set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
.set_jitter(GRPC_DNS_RECONNECT_JITTER)
.set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
// Get name to resolve from URI path.
const char* path = args.uri->path;
if (path[0] == '/') ++path;
name_to_resolve_ = gpr_strdup(path);
// Get DNS server from URI authority.
if (0 != strcmp(args.uri->authority, "")) {
dns_server_ = gpr_strdup(args.uri->authority);
}
channel_args_ = grpc_channel_args_copy(args.args);
const grpc_arg* arg = grpc_channel_args_find(
channel_args_, GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION);
request_service_config_ = !grpc_channel_arg_get_integer(
arg, (grpc_integer_options){false, false, true});
arg = grpc_channel_args_find(channel_args_,
GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
min_time_between_resolutions_ =
grpc_channel_arg_get_integer(arg, {1000, 0, INT_MAX});
interested_parties_ = grpc_pollset_set_create();
if (args.pollset_set != nullptr) {
grpc_pollset_set_add_pollset_set(interested_parties_, args.pollset_set);
}
GRPC_CLOSURE_INIT(&on_next_resolution_, OnNextResolutionLocked, this,
grpc_combiner_scheduler(combiner()));
GRPC_CLOSURE_INIT(&on_resolved_, OnResolvedLocked, this,
grpc_combiner_scheduler(combiner()));
}
AresDnsResolver::~AresDnsResolver() {
gpr_log(GPR_DEBUG, "destroying AresDnsResolver");
if (resolved_result_ != nullptr) {
grpc_channel_args_destroy(resolved_result_);
}
if (r->pending_request != nullptr) {
grpc_cancel_ares_request(r->pending_request);
grpc_pollset_set_destroy(interested_parties_);
gpr_free(dns_server_);
gpr_free(name_to_resolve_);
grpc_channel_args_destroy(channel_args_);
}
void AresDnsResolver::NextLocked(grpc_channel_args** target_result,
grpc_closure* on_complete) {
gpr_log(GPR_DEBUG, "AresDnsResolver::NextLocked() is called.");
GPR_ASSERT(next_completion_ == nullptr);
next_completion_ = on_complete;
target_result_ = target_result;
if (resolved_version_ == 0 && !resolving_) {
MaybeStartResolvingLocked();
} else {
MaybeFinishNextLocked();
}
if (r->next_completion != nullptr) {
*r->target_result = nullptr;
GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Resolver Shutdown"));
r->next_completion = nullptr;
}
void AresDnsResolver::RequestReresolutionLocked() {
if (!resolving_) {
MaybeStartResolvingLocked();
}
}
static void dns_ares_channel_saw_error_locked(grpc_resolver* resolver) {
ares_dns_resolver* r = (ares_dns_resolver*)resolver;
if (!r->resolving) {
dns_ares_maybe_start_resolving_locked(r);
void AresDnsResolver::ShutdownLocked() {
if (have_next_resolution_timer_) {
grpc_timer_cancel(&next_resolution_timer_);
}
if (pending_request_ != nullptr) {
grpc_cancel_ares_request(pending_request_);
}
if (next_completion_ != nullptr) {
*target_result_ = nullptr;
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Resolver Shutdown"));
next_completion_ = nullptr;
}
}
static void dns_ares_on_next_resolution_timer_locked(void* arg,
grpc_error* error) {
ares_dns_resolver* r = (ares_dns_resolver*)arg;
r->have_next_resolution_timer = false;
void AresDnsResolver::OnNextResolutionLocked(void* arg, grpc_error* error) {
AresDnsResolver* r = static_cast<AresDnsResolver*>(arg);
r->have_next_resolution_timer_ = false;
if (error == GRPC_ERROR_NONE) {
if (!r->resolving) {
dns_ares_start_resolving_locked(r);
if (!r->resolving_) {
r->StartResolvingLocked();
}
}
GRPC_RESOLVER_UNREF(&r->base, "next_resolution_timer");
r->Unref(DEBUG_LOCATION, "next_resolution_timer");
}
static bool value_in_json_array(grpc_json* array, const char* value) {
bool ValueInJsonArray(grpc_json* array, const char* value) {
for (grpc_json* entry = array->child; entry != nullptr; entry = entry->next) {
if (entry->type == GRPC_JSON_STRING && strcmp(entry->value, value) == 0) {
return true;
@ -160,7 +219,7 @@ static bool value_in_json_array(grpc_json* array, const char* value) {
return false;
}
static char* choose_service_config(char* service_config_choice_json) {
char* ChooseServiceConfig(char* service_config_choice_json) {
grpc_json* choices_json = grpc_json_parse_string(service_config_choice_json);
if (choices_json == nullptr || choices_json->type != GRPC_JSON_ARRAY) {
gpr_log(GPR_ERROR, "cannot parse service config JSON string");
@ -178,8 +237,7 @@ static char* choose_service_config(char* service_config_choice_json) {
field = field->next) {
// Check client language, if specified.
if (strcmp(field->key, "clientLanguage") == 0) {
if (field->type != GRPC_JSON_ARRAY ||
!value_in_json_array(field, "c++")) {
if (field->type != GRPC_JSON_ARRAY || !ValueInJsonArray(field, "c++")) {
service_config_json = nullptr;
break;
}
@ -188,7 +246,7 @@ static char* choose_service_config(char* service_config_choice_json) {
if (strcmp(field->key, "clientHostname") == 0) {
char* hostname = grpc_gethostname();
if (hostname == nullptr || field->type != GRPC_JSON_ARRAY ||
!value_in_json_array(field, hostname)) {
!ValueInJsonArray(field, hostname)) {
service_config_json = nullptr;
break;
}
@ -223,24 +281,24 @@ static char* choose_service_config(char* service_config_choice_json) {
return service_config;
}
static void dns_ares_on_resolved_locked(void* arg, grpc_error* error) {
ares_dns_resolver* r = (ares_dns_resolver*)arg;
void AresDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) {
AresDnsResolver* r = static_cast<AresDnsResolver*>(arg);
grpc_channel_args* result = nullptr;
GPR_ASSERT(r->resolving);
r->resolving = false;
r->pending_request = nullptr;
if (r->lb_addresses != nullptr) {
GPR_ASSERT(r->resolving_);
r->resolving_ = false;
r->pending_request_ = nullptr;
if (r->lb_addresses_ != nullptr) {
static const char* args_to_remove[2];
size_t num_args_to_remove = 0;
grpc_arg new_args[3];
size_t num_args_to_add = 0;
new_args[num_args_to_add++] =
grpc_lb_addresses_create_channel_arg(r->lb_addresses);
grpc_lb_addresses_create_channel_arg(r->lb_addresses_);
grpc_service_config* service_config = nullptr;
char* service_config_string = nullptr;
if (r->service_config_json != nullptr) {
service_config_string = choose_service_config(r->service_config_json);
gpr_free(r->service_config_json);
if (r->service_config_json_ != nullptr) {
service_config_string = ChooseServiceConfig(r->service_config_json_);
gpr_free(r->service_config_json_);
if (service_config_string != nullptr) {
gpr_log(GPR_INFO, "selected service config choice: %s",
service_config_string);
@ -260,221 +318,150 @@ static void dns_ares_on_resolved_locked(void* arg, grpc_error* error) {
}
}
result = grpc_channel_args_copy_and_add_and_remove(
r->channel_args, args_to_remove, num_args_to_remove, new_args,
r->channel_args_, args_to_remove, num_args_to_remove, new_args,
num_args_to_add);
if (service_config != nullptr) grpc_service_config_destroy(service_config);
gpr_free(service_config_string);
grpc_lb_addresses_destroy(r->lb_addresses);
grpc_lb_addresses_destroy(r->lb_addresses_);
// Reset backoff state so that we start from the beginning when the
// next request gets triggered.
r->backoff->Reset();
r->backoff_.Reset();
} else {
const char* msg = grpc_error_string(error);
gpr_log(GPR_DEBUG, "dns resolution failed: %s", msg);
grpc_millis next_try = r->backoff->NextAttemptTime();
grpc_millis timeout = next_try - grpc_core::ExecCtx::Get()->Now();
grpc_millis next_try = r->backoff_.NextAttemptTime();
grpc_millis timeout = next_try - ExecCtx::Get()->Now();
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
grpc_error_string(error));
GPR_ASSERT(!r->have_next_resolution_timer);
r->have_next_resolution_timer = true;
GRPC_RESOLVER_REF(&r->base, "next_resolution_timer");
GPR_ASSERT(!r->have_next_resolution_timer_);
r->have_next_resolution_timer_ = true;
// TODO(roth): We currently deal with this ref manually. Once the
// new closure API is done, find a way to track this ref with the timer
// callback as part of the type system.
RefCountedPtr<Resolver> self = r->Ref(DEBUG_LOCATION, "retry-timer");
self.release();
if (timeout > 0) {
gpr_log(GPR_DEBUG, "retrying in %" PRIdPTR " milliseconds", timeout);
} else {
gpr_log(GPR_DEBUG, "retrying immediately");
}
grpc_timer_init(&r->next_resolution_timer, next_try,
&r->dns_ares_on_next_resolution_timer_closure);
grpc_timer_init(&r->next_resolution_timer_, next_try,
&r->on_next_resolution_);
}
if (r->resolved_result != nullptr) {
grpc_channel_args_destroy(r->resolved_result);
}
r->resolved_result = result;
r->last_resolution_timestamp = grpc_core::ExecCtx::Get()->Now();
r->resolved_version++;
dns_ares_maybe_finish_next_locked(r);
GRPC_RESOLVER_UNREF(&r->base, "dns-resolving");
}
static void dns_ares_next_locked(grpc_resolver* resolver,
grpc_channel_args** target_result,
grpc_closure* on_complete) {
gpr_log(GPR_DEBUG, "dns_ares_next is called.");
ares_dns_resolver* r = (ares_dns_resolver*)resolver;
GPR_ASSERT(!r->next_completion);
r->next_completion = on_complete;
r->target_result = target_result;
if (r->resolved_version == 0 && !r->resolving) {
dns_ares_maybe_start_resolving_locked(r);
} else {
dns_ares_maybe_finish_next_locked(r);
if (r->resolved_result_ != nullptr) {
grpc_channel_args_destroy(r->resolved_result_);
}
r->resolved_result_ = result;
++r->resolved_version_;
r->MaybeFinishNextLocked();
r->Unref(DEBUG_LOCATION, "dns-resolving");
}
static void dns_ares_start_resolving_locked(ares_dns_resolver* r) {
GRPC_RESOLVER_REF(&r->base, "dns-resolving");
GPR_ASSERT(!r->resolving);
r->resolving = true;
r->lb_addresses = nullptr;
r->service_config_json = nullptr;
r->pending_request = grpc_dns_lookup_ares(
r->dns_server, r->name_to_resolve, r->default_port, r->interested_parties,
&r->dns_ares_on_resolved_closure, &r->lb_addresses,
true /* check_grpclb */,
r->request_service_config ? &r->service_config_json : nullptr);
}
static void dns_ares_maybe_finish_next_locked(ares_dns_resolver* r) {
if (r->next_completion != nullptr &&
r->resolved_version != r->published_version) {
*r->target_result = r->resolved_result == nullptr
? nullptr
: grpc_channel_args_copy(r->resolved_result);
gpr_log(GPR_DEBUG, "dns_ares_maybe_finish_next_locked");
GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
r->next_completion = nullptr;
r->published_version = r->resolved_version;
}
}
static void dns_ares_maybe_start_resolving_locked(ares_dns_resolver* r) {
if (r->last_resolution_timestamp >= 0) {
void AresDnsResolver::MaybeStartResolvingLocked() {
if (last_resolution_timestamp_ >= 0) {
const grpc_millis earliest_next_resolution =
r->last_resolution_timestamp + r->min_time_between_resolutions;
last_resolution_timestamp_ + min_time_between_resolutions_;
const grpc_millis ms_until_next_resolution =
earliest_next_resolution - grpc_core::ExecCtx::Get()->Now();
if (ms_until_next_resolution > 0) {
const grpc_millis last_resolution_ago =
grpc_core::ExecCtx::Get()->Now() - r->last_resolution_timestamp;
grpc_core::ExecCtx::Get()->Now() - last_resolution_timestamp_;
gpr_log(GPR_DEBUG,
"In cooldown from last resolution (from %" PRIdPTR
" ms ago). Will resolve again in %" PRIdPTR " ms",
last_resolution_ago, ms_until_next_resolution);
if (!r->have_next_resolution_timer) {
r->have_next_resolution_timer = true;
GRPC_RESOLVER_REF(&r->base, "next_resolution_timer_cooldown");
grpc_timer_init(&r->next_resolution_timer, ms_until_next_resolution,
&r->dns_ares_on_next_resolution_timer_closure);
if (!have_next_resolution_timer_) {
have_next_resolution_timer_ = true;
// TODO(roth): We currently deal with this ref manually. Once the
// new closure API is done, find a way to track this ref with the timer
// callback as part of the type system.
RefCountedPtr<Resolver> self =
Ref(DEBUG_LOCATION, "next_resolution_timer_cooldown");
self.release();
grpc_timer_init(&next_resolution_timer_, ms_until_next_resolution,
&on_next_resolution_);
}
// TODO(dgq): remove the following two lines once Pick First stops
// discarding subchannels after selecting.
++r->resolved_version;
dns_ares_maybe_finish_next_locked(r);
++resolved_version_;
MaybeFinishNextLocked();
return;
}
}
dns_ares_start_resolving_locked(r);
StartResolvingLocked();
}
static void dns_ares_destroy(grpc_resolver* gr) {
gpr_log(GPR_DEBUG, "dns_ares_destroy");
ares_dns_resolver* r = (ares_dns_resolver*)gr;
if (r->resolved_result != nullptr) {
grpc_channel_args_destroy(r->resolved_result);
}
grpc_pollset_set_destroy(r->interested_parties);
gpr_free(r->dns_server);
gpr_free(r->name_to_resolve);
gpr_free(r->default_port);
grpc_channel_args_destroy(r->channel_args);
gpr_free(r);
void AresDnsResolver::StartResolvingLocked() {
// TODO(roth): We currently deal with this ref manually. Once the
// new closure API is done, find a way to track this ref with the timer
// callback as part of the type system.
RefCountedPtr<Resolver> self = Ref(DEBUG_LOCATION, "dns-resolving");
self.release();
GPR_ASSERT(!resolving_);
resolving_ = true;
lb_addresses_ = nullptr;
service_config_json_ = nullptr;
pending_request_ = grpc_dns_lookup_ares(
dns_server_, name_to_resolve_, kDefaultPort, interested_parties_,
&on_resolved_, &lb_addresses_, true /* check_grpclb */,
request_service_config_ ? &service_config_json_ : nullptr);
last_resolution_timestamp_ = grpc_core::ExecCtx::Get()->Now();
}
static grpc_resolver* dns_ares_create(grpc_resolver_args* args,
const char* default_port) {
/* Get name from args. */
const char* path = args->uri->path;
if (path[0] == '/') ++path;
/* Create resolver. */
ares_dns_resolver* r =
(ares_dns_resolver*)gpr_zalloc(sizeof(ares_dns_resolver));
grpc_resolver_init(&r->base, &dns_ares_resolver_vtable, args->combiner);
if (0 != strcmp(args->uri->authority, "")) {
r->dns_server = gpr_strdup(args->uri->authority);
}
r->name_to_resolve = gpr_strdup(path);
r->default_port = gpr_strdup(default_port);
r->channel_args = grpc_channel_args_copy(args->args);
const grpc_arg* arg = grpc_channel_args_find(
r->channel_args, GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION);
r->request_service_config = !grpc_channel_arg_get_integer(
arg, (grpc_integer_options){false, false, true});
r->interested_parties = grpc_pollset_set_create();
if (args->pollset_set != nullptr) {
grpc_pollset_set_add_pollset_set(r->interested_parties, args->pollset_set);
void AresDnsResolver::MaybeFinishNextLocked() {
if (next_completion_ != nullptr && resolved_version_ != published_version_) {
*target_result_ = resolved_result_ == nullptr
? nullptr
: grpc_channel_args_copy(resolved_result_);
gpr_log(GPR_DEBUG, "AresDnsResolver::MaybeFinishNextLocked()");
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_NONE);
next_completion_ = nullptr;
published_version_ = resolved_version_;
}
grpc_core::BackOff::Options backoff_options;
backoff_options
.set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS * 1000)
.set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
.set_jitter(GRPC_DNS_RECONNECT_JITTER)
.set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000);
r->backoff.Init(grpc_core::BackOff(backoff_options));
GRPC_CLOSURE_INIT(&r->dns_ares_on_next_resolution_timer_closure,
dns_ares_on_next_resolution_timer_locked, r,
grpc_combiner_scheduler(r->base.combiner));
GRPC_CLOSURE_INIT(&r->dns_ares_on_resolved_closure,
dns_ares_on_resolved_locked, r,
grpc_combiner_scheduler(r->base.combiner));
const grpc_arg* period_arg = grpc_channel_args_find(
args->args, GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
r->min_time_between_resolutions =
grpc_channel_arg_get_integer(period_arg, {1000, 0, INT_MAX});
r->last_resolution_timestamp = -1;
return &r->base;
}
/*
* FACTORY
*/
static void dns_ares_factory_ref(grpc_resolver_factory* factory) {}
//
// Factory
//
static void dns_ares_factory_unref(grpc_resolver_factory* factory) {}
static grpc_resolver* dns_factory_create_resolver(
grpc_resolver_factory* factory, grpc_resolver_args* args) {
return dns_ares_create(args, "https");
}
class AresDnsResolverFactory : public ResolverFactory {
public:
OrphanablePtr<Resolver> CreateResolver(
const ResolverArgs& args) const override {
return OrphanablePtr<Resolver>(New<AresDnsResolver>(args));
}
static char* dns_ares_factory_get_default_host_name(
grpc_resolver_factory* factory, grpc_uri* uri) {
const char* path = uri->path;
if (path[0] == '/') ++path;
return gpr_strdup(path);
}
const char* scheme() const override { return "dns"; }
};
static const grpc_resolver_factory_vtable dns_ares_factory_vtable = {
dns_ares_factory_ref, dns_ares_factory_unref, dns_factory_create_resolver,
dns_ares_factory_get_default_host_name, "dns"};
static grpc_resolver_factory dns_resolver_factory = {&dns_ares_factory_vtable};
} // namespace
static grpc_resolver_factory* dns_ares_resolver_factory_create() {
return &dns_resolver_factory;
}
} // namespace grpc_core
void grpc_resolver_dns_ares_init(void) {
char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
void grpc_resolver_dns_ares_init() {
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
/* TODO(zyc): Turn on c-ares based resolver by default after the address
sorter and the CNAME support are added. */
if (resolver != nullptr && gpr_stricmp(resolver, "ares") == 0) {
if (resolver_env != nullptr && gpr_stricmp(resolver_env, "ares") == 0) {
grpc_error* error = grpc_ares_init();
if (error != GRPC_ERROR_NONE) {
GRPC_LOG_IF_ERROR("ares_library_init() failed", error);
return;
}
grpc_resolve_address = grpc_resolve_address_ares;
grpc_register_resolver_type(dns_ares_resolver_factory_create());
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
grpc_core::New<grpc_core::AresDnsResolverFactory>()));
}
gpr_free(resolver);
gpr_free(resolver_env);
}
void grpc_resolver_dns_ares_shutdown(void) {
char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver != nullptr && gpr_stricmp(resolver, "ares") == 0) {
void grpc_resolver_dns_ares_shutdown() {
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver_env != nullptr && gpr_stricmp(resolver_env, "ares") == 0) {
grpc_ares_cleanup();
}
gpr_free(resolver);
gpr_free(resolver_env);
}
#else /* GRPC_ARES == 1 && !defined(GRPC_UV) */

@ -28,7 +28,6 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/ev_posix.h"

@ -31,7 +31,6 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.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"

@ -43,301 +43,298 @@
#define GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS 120
#define GRPC_DNS_RECONNECT_JITTER 0.2
typedef struct {
/** base class: must be first */
grpc_resolver base;
/** name to resolve */
char* name_to_resolve;
/** default port to use */
char* default_port;
/** channel args. */
grpc_channel_args* channel_args;
/** pollset_set to drive the name resolution process */
grpc_pollset_set* interested_parties;
/** are we currently resolving? */
bool resolving;
/** which version of the result have we published? */
int published_version;
/** which version of the result is current? */
int resolved_version;
/** pending next completion, or NULL */
grpc_closure* next_completion;
/** target result address for next completion */
grpc_channel_args** target_result;
/** current (fully resolved) result */
grpc_channel_args* resolved_result;
/** next resolution timer */
bool have_next_resolution_timer;
grpc_timer next_resolution_timer;
grpc_closure next_resolution_closure;
/** retry backoff state */
grpc_core::ManualConstructor<grpc_core::BackOff> backoff;
/** min resolution period. Max one resolution will happen per period */
grpc_millis min_time_between_resolutions;
/** when was the last resolution? -1 if no resolution has happened yet */
grpc_millis last_resolution_timestamp;
/** currently resolving addresses */
grpc_resolved_addresses* addresses;
} dns_resolver;
static void dns_destroy(grpc_resolver* r);
static void dns_start_resolving_locked(dns_resolver* r);
static void maybe_start_resolving_locked(dns_resolver* r);
static void dns_maybe_finish_next_locked(dns_resolver* r);
static void dns_shutdown_locked(grpc_resolver* r);
static void dns_channel_saw_error_locked(grpc_resolver* r);
static void dns_next_locked(grpc_resolver* r, grpc_channel_args** target_result,
grpc_closure* on_complete);
static const grpc_resolver_vtable dns_resolver_vtable = {
dns_destroy, dns_shutdown_locked, dns_channel_saw_error_locked,
dns_next_locked};
static void dns_shutdown_locked(grpc_resolver* resolver) {
dns_resolver* r = (dns_resolver*)resolver;
if (r->have_next_resolution_timer) {
grpc_timer_cancel(&r->next_resolution_timer);
}
if (r->next_completion != nullptr) {
*r->target_result = nullptr;
GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Resolver Shutdown"));
r->next_completion = nullptr;
namespace grpc_core {
namespace {
const char kDefaultPort[] = "https";
class NativeDnsResolver : public Resolver {
public:
explicit NativeDnsResolver(const ResolverArgs& args);
void NextLocked(grpc_channel_args** result,
grpc_closure* on_complete) override;
void RequestReresolutionLocked() override;
void ShutdownLocked() override;
private:
virtual ~NativeDnsResolver();
void MaybeStartResolvingLocked();
void StartResolvingLocked();
void MaybeFinishNextLocked();
static void OnNextResolutionLocked(void* arg, grpc_error* error);
static void OnResolvedLocked(void* arg, grpc_error* error);
/// name to resolve
char* name_to_resolve_ = nullptr;
/// channel args
grpc_channel_args* channel_args_ = nullptr;
/// pollset_set to drive the name resolution process
grpc_pollset_set* interested_parties_ = nullptr;
/// are we currently resolving?
bool resolving_ = false;
grpc_closure on_resolved_;
/// which version of the result have we published?
int published_version_ = 0;
/// which version of the result is current?
int resolved_version_ = 0;
/// pending next completion, or nullptr
grpc_closure* next_completion_ = nullptr;
/// target result address for next completion
grpc_channel_args** target_result_ = nullptr;
/// current (fully resolved) result
grpc_channel_args* resolved_result_ = nullptr;
/// next resolution timer
bool have_next_resolution_timer_ = false;
grpc_timer next_resolution_timer_;
grpc_closure on_next_resolution_;
/// min time between DNS requests
grpc_millis min_time_between_resolutions_;
/// timestamp of last DNS request
grpc_millis last_resolution_timestamp_ = -1;
/// retry backoff state
BackOff backoff_;
/// currently resolving addresses
grpc_resolved_addresses* addresses_ = nullptr;
};
NativeDnsResolver::NativeDnsResolver(const ResolverArgs& args)
: Resolver(args.combiner),
backoff_(
BackOff::Options()
.set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS *
1000)
.set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
.set_jitter(GRPC_DNS_RECONNECT_JITTER)
.set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
char* path = args.uri->path;
if (path[0] == '/') ++path;
name_to_resolve_ = gpr_strdup(path);
channel_args_ = grpc_channel_args_copy(args.args);
const grpc_arg* arg = grpc_channel_args_find(
args.args, GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
min_time_between_resolutions_ =
grpc_channel_arg_get_integer(arg, {1000, 0, INT_MAX});
interested_parties_ = grpc_pollset_set_create();
if (args.pollset_set != nullptr) {
grpc_pollset_set_add_pollset_set(interested_parties_, args.pollset_set);
}
GRPC_CLOSURE_INIT(&on_next_resolution_,
NativeDnsResolver::OnNextResolutionLocked, this,
grpc_combiner_scheduler(args.combiner));
GRPC_CLOSURE_INIT(&on_resolved_, NativeDnsResolver::OnResolvedLocked, this,
grpc_combiner_scheduler(args.combiner));
}
static void dns_channel_saw_error_locked(grpc_resolver* resolver) {
dns_resolver* r = (dns_resolver*)resolver;
if (!r->resolving) {
maybe_start_resolving_locked(r);
NativeDnsResolver::~NativeDnsResolver() {
if (resolved_result_ != nullptr) {
grpc_channel_args_destroy(resolved_result_);
}
grpc_pollset_set_destroy(interested_parties_);
gpr_free(name_to_resolve_);
grpc_channel_args_destroy(channel_args_);
}
static void dns_next_locked(grpc_resolver* resolver,
grpc_channel_args** target_result,
grpc_closure* on_complete) {
dns_resolver* r = (dns_resolver*)resolver;
GPR_ASSERT(!r->next_completion);
r->next_completion = on_complete;
r->target_result = target_result;
if (r->resolved_version == 0 && !r->resolving) {
maybe_start_resolving_locked(r);
void NativeDnsResolver::NextLocked(grpc_channel_args** result,
grpc_closure* on_complete) {
GPR_ASSERT(next_completion_ == nullptr);
next_completion_ = on_complete;
target_result_ = result;
if (resolved_version_ == 0 && !resolving_) {
MaybeStartResolvingLocked();
} else {
dns_maybe_finish_next_locked(r);
MaybeFinishNextLocked();
}
}
void NativeDnsResolver::RequestReresolutionLocked() {
if (!resolving_) {
MaybeStartResolvingLocked();
}
}
void NativeDnsResolver::ShutdownLocked() {
if (have_next_resolution_timer_) {
grpc_timer_cancel(&next_resolution_timer_);
}
if (next_completion_ != nullptr) {
*target_result_ = nullptr;
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Resolver Shutdown"));
next_completion_ = nullptr;
}
}
static void dns_on_next_resolution_timer_locked(void* arg, grpc_error* error) {
dns_resolver* r = (dns_resolver*)arg;
r->have_next_resolution_timer = false;
if (error == GRPC_ERROR_NONE && !r->resolving) {
dns_start_resolving_locked(r);
void NativeDnsResolver::OnNextResolutionLocked(void* arg, grpc_error* error) {
NativeDnsResolver* r = static_cast<NativeDnsResolver*>(arg);
r->have_next_resolution_timer_ = false;
if (error == GRPC_ERROR_NONE && !r->resolving_) {
r->StartResolvingLocked();
}
GRPC_RESOLVER_UNREF(&r->base, "next_resolution_timer");
r->Unref(DEBUG_LOCATION, "retry-timer");
}
static void dns_on_resolved_locked(void* arg, grpc_error* error) {
dns_resolver* r = (dns_resolver*)arg;
void NativeDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) {
NativeDnsResolver* r = static_cast<NativeDnsResolver*>(arg);
grpc_channel_args* result = nullptr;
GPR_ASSERT(r->resolving);
r->resolving = false;
GPR_ASSERT(r->resolving_);
r->resolving_ = false;
GRPC_ERROR_REF(error);
error = grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS,
grpc_slice_from_copied_string(r->name_to_resolve));
if (r->addresses != nullptr) {
error =
grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS,
grpc_slice_from_copied_string(r->name_to_resolve_));
if (r->addresses_ != nullptr) {
grpc_lb_addresses* addresses = grpc_lb_addresses_create(
r->addresses->naddrs, nullptr /* user_data_vtable */);
for (size_t i = 0; i < r->addresses->naddrs; ++i) {
r->addresses_->naddrs, nullptr /* user_data_vtable */);
for (size_t i = 0; i < r->addresses_->naddrs; ++i) {
grpc_lb_addresses_set_address(
addresses, i, &r->addresses->addrs[i].addr,
r->addresses->addrs[i].len, false /* is_balancer */,
addresses, i, &r->addresses_->addrs[i].addr,
r->addresses_->addrs[i].len, false /* is_balancer */,
nullptr /* balancer_name */, nullptr /* user_data */);
}
grpc_arg new_arg = grpc_lb_addresses_create_channel_arg(addresses);
result = grpc_channel_args_copy_and_add(r->channel_args, &new_arg, 1);
grpc_resolved_addresses_destroy(r->addresses);
result = grpc_channel_args_copy_and_add(r->channel_args_, &new_arg, 1);
grpc_resolved_addresses_destroy(r->addresses_);
grpc_lb_addresses_destroy(addresses);
// Reset backoff state so that we start from the beginning when the
// next request gets triggered.
r->backoff->Reset();
r->backoff_.Reset();
} else {
grpc_millis next_try = r->backoff->NextAttemptTime();
grpc_millis timeout = next_try - grpc_core::ExecCtx::Get()->Now();
grpc_millis next_try = r->backoff_.NextAttemptTime();
grpc_millis timeout = next_try - ExecCtx::Get()->Now();
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
grpc_error_string(error));
GPR_ASSERT(!r->have_next_resolution_timer);
r->have_next_resolution_timer = true;
GRPC_RESOLVER_REF(&r->base, "next_resolution_timer");
GPR_ASSERT(!r->have_next_resolution_timer_);
r->have_next_resolution_timer_ = true;
// TODO(roth): We currently deal with this ref manually. Once the
// new closure API is done, find a way to track this ref with the timer
// callback as part of the type system.
RefCountedPtr<Resolver> self =
r->Ref(DEBUG_LOCATION, "next_resolution_timer");
self.release();
if (timeout > 0) {
gpr_log(GPR_DEBUG, "retrying in %" PRIdPTR " milliseconds", timeout);
} else {
gpr_log(GPR_DEBUG, "retrying immediately");
}
grpc_timer_init(&r->next_resolution_timer, next_try,
&r->next_resolution_closure);
grpc_timer_init(&r->next_resolution_timer_, next_try,
&r->on_next_resolution_);
}
if (r->resolved_result != nullptr) {
grpc_channel_args_destroy(r->resolved_result);
if (r->resolved_result_ != nullptr) {
grpc_channel_args_destroy(r->resolved_result_);
}
r->resolved_result = result;
r->resolved_version++;
dns_maybe_finish_next_locked(r);
r->resolved_result_ = result;
++r->resolved_version_;
r->MaybeFinishNextLocked();
GRPC_ERROR_UNREF(error);
GRPC_RESOLVER_UNREF(&r->base, "dns-resolving");
r->Unref(DEBUG_LOCATION, "dns-resolving");
}
static void maybe_start_resolving_locked(dns_resolver* r) {
if (r->last_resolution_timestamp >= 0) {
void NativeDnsResolver::MaybeStartResolvingLocked() {
if (last_resolution_timestamp_ >= 0) {
const grpc_millis earliest_next_resolution =
r->last_resolution_timestamp + r->min_time_between_resolutions;
last_resolution_timestamp_ + min_time_between_resolutions_;
const grpc_millis ms_until_next_resolution =
earliest_next_resolution - grpc_core::ExecCtx::Get()->Now();
if (ms_until_next_resolution > 0) {
const grpc_millis last_resolution_ago =
grpc_core::ExecCtx::Get()->Now() - r->last_resolution_timestamp;
grpc_core::ExecCtx::Get()->Now() - last_resolution_timestamp_;
gpr_log(GPR_DEBUG,
"In cooldown from last resolution (from %" PRIdPTR
" ms ago). Will resolve again in %" PRIdPTR " ms",
last_resolution_ago, ms_until_next_resolution);
if (!r->have_next_resolution_timer) {
r->have_next_resolution_timer = true;
GRPC_RESOLVER_REF(&r->base, "next_resolution_timer_cooldown");
grpc_timer_init(&r->next_resolution_timer, ms_until_next_resolution,
&r->next_resolution_closure);
if (!have_next_resolution_timer_) {
have_next_resolution_timer_ = true;
// TODO(roth): We currently deal with this ref manually. Once the
// new closure API is done, find a way to track this ref with the timer
// callback as part of the type system.
RefCountedPtr<Resolver> self =
Ref(DEBUG_LOCATION, "next_resolution_timer_cooldown");
self.release();
grpc_timer_init(&next_resolution_timer_, ms_until_next_resolution,
&on_next_resolution_);
}
// TODO(dgq): remove the following two lines once Pick First stops
// discarding subchannels after selecting.
++r->resolved_version;
dns_maybe_finish_next_locked(r);
++resolved_version_;
MaybeFinishNextLocked();
return;
}
}
dns_start_resolving_locked(r);
StartResolvingLocked();
}
static void dns_start_resolving_locked(dns_resolver* r) {
GRPC_RESOLVER_REF(&r->base, "dns-resolving");
GPR_ASSERT(!r->resolving);
r->resolving = true;
r->addresses = nullptr;
grpc_resolve_address(
r->name_to_resolve, r->default_port, r->interested_parties,
GRPC_CLOSURE_CREATE(dns_on_resolved_locked, r,
grpc_combiner_scheduler(r->base.combiner)),
&r->addresses);
r->last_resolution_timestamp = grpc_core::ExecCtx::Get()->Now();
void NativeDnsResolver::StartResolvingLocked() {
// TODO(roth): We currently deal with this ref manually. Once the
// new closure API is done, find a way to track this ref with the timer
// callback as part of the type system.
RefCountedPtr<Resolver> self = Ref(DEBUG_LOCATION, "dns-resolving");
self.release();
GPR_ASSERT(!resolving_);
resolving_ = true;
addresses_ = nullptr;
grpc_resolve_address(name_to_resolve_, kDefaultPort, interested_parties_,
&on_resolved_, &addresses_);
last_resolution_timestamp_ = grpc_core::ExecCtx::Get()->Now();
}
static void dns_maybe_finish_next_locked(dns_resolver* r) {
if (r->next_completion != nullptr &&
r->resolved_version != r->published_version) {
*r->target_result = r->resolved_result == nullptr
? nullptr
: grpc_channel_args_copy(r->resolved_result);
GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
r->next_completion = nullptr;
r->published_version = r->resolved_version;
void NativeDnsResolver::MaybeFinishNextLocked() {
if (next_completion_ != nullptr && resolved_version_ != published_version_) {
*target_result_ = resolved_result_ == nullptr
? nullptr
: grpc_channel_args_copy(resolved_result_);
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_NONE);
next_completion_ = nullptr;
published_version_ = resolved_version_;
}
}
static void dns_destroy(grpc_resolver* gr) {
dns_resolver* r = (dns_resolver*)gr;
if (r->resolved_result != nullptr) {
grpc_channel_args_destroy(r->resolved_result);
}
grpc_pollset_set_destroy(r->interested_parties);
gpr_free(r->name_to_resolve);
gpr_free(r->default_port);
grpc_channel_args_destroy(r->channel_args);
gpr_free(r);
}
//
// Factory
//
static grpc_resolver* dns_create(grpc_resolver_args* args,
const char* default_port) {
if (0 != strcmp(args->uri->authority, "")) {
gpr_log(GPR_ERROR, "authority based dns uri's not supported");
return nullptr;
}
// Get name from args.
char* path = args->uri->path;
if (path[0] == '/') ++path;
// Create resolver.
dns_resolver* r = (dns_resolver*)gpr_zalloc(sizeof(dns_resolver));
grpc_resolver_init(&r->base, &dns_resolver_vtable, args->combiner);
r->name_to_resolve = gpr_strdup(path);
r->default_port = gpr_strdup(default_port);
r->channel_args = grpc_channel_args_copy(args->args);
r->interested_parties = grpc_pollset_set_create();
if (args->pollset_set != nullptr) {
grpc_pollset_set_add_pollset_set(r->interested_parties, args->pollset_set);
class NativeDnsResolverFactory : public ResolverFactory {
public:
OrphanablePtr<Resolver> CreateResolver(
const ResolverArgs& args) const override {
if (0 != strcmp(args.uri->authority, "")) {
gpr_log(GPR_ERROR, "authority based dns uri's not supported");
return OrphanablePtr<Resolver>(nullptr);
}
return OrphanablePtr<Resolver>(New<NativeDnsResolver>(args));
}
grpc_core::BackOff::Options backoff_options;
backoff_options
.set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS * 1000)
.set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
.set_jitter(GRPC_DNS_RECONNECT_JITTER)
.set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000);
r->backoff.Init(grpc_core::BackOff(backoff_options));
const grpc_arg* period_arg = grpc_channel_args_find(
args->args, GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
r->min_time_between_resolutions =
grpc_channel_arg_get_integer(period_arg, {1000, 0, INT_MAX});
r->last_resolution_timestamp = -1;
GRPC_CLOSURE_INIT(&r->next_resolution_closure,
dns_on_next_resolution_timer_locked, r,
grpc_combiner_scheduler(r->base.combiner));
return &r->base;
}
/*
* FACTORY
*/
const char* scheme() const override { return "dns"; }
};
static void dns_factory_ref(grpc_resolver_factory* factory) {}
} // namespace
static void dns_factory_unref(grpc_resolver_factory* factory) {}
} // namespace grpc_core
static grpc_resolver* dns_factory_create_resolver(
grpc_resolver_factory* factory, grpc_resolver_args* args) {
return dns_create(args, "https");
}
static char* dns_factory_get_default_host_name(grpc_resolver_factory* factory,
grpc_uri* uri) {
const char* path = uri->path;
if (path[0] == '/') ++path;
return gpr_strdup(path);
}
static const grpc_resolver_factory_vtable dns_factory_vtable = {
dns_factory_ref, dns_factory_unref, dns_factory_create_resolver,
dns_factory_get_default_host_name, "dns"};
static grpc_resolver_factory dns_resolver_factory = {&dns_factory_vtable};
static grpc_resolver_factory* dns_resolver_factory_create() {
return &dns_resolver_factory;
}
void grpc_resolver_dns_native_init(void) {
char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver != nullptr && gpr_stricmp(resolver, "native") == 0) {
void grpc_resolver_dns_native_init() {
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver_env != nullptr && gpr_stricmp(resolver_env, "native") == 0) {
gpr_log(GPR_DEBUG, "Using native dns resolver");
grpc_register_resolver_type(dns_resolver_factory_create());
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
grpc_core::New<grpc_core::NativeDnsResolverFactory>()));
} else {
grpc_resolver_factory* existing_factory =
grpc_resolver_factory_lookup("dns");
grpc_core::ResolverRegistry::Builder::InitRegistry();
grpc_core::ResolverFactory* existing_factory =
grpc_core::ResolverRegistry::LookupResolverFactory("dns");
if (existing_factory == nullptr) {
gpr_log(GPR_DEBUG, "Using native dns resolver");
grpc_register_resolver_type(dns_resolver_factory_create());
} else {
grpc_resolver_factory_unref(existing_factory);
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
grpc_core::New<grpc_core::NativeDnsResolverFactory>()));
}
}
gpr_free(resolver);
gpr_free(resolver_env);
}
void grpc_resolver_dns_native_shutdown(void) {}
void grpc_resolver_dns_native_shutdown() {}

@ -42,190 +42,177 @@
#include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
//
// fake_resolver
//
namespace grpc_core {
typedef struct {
// Base class -- must be first
grpc_resolver base;
// This cannot be in an anonymous namespace, because it is a friend of
// FakeResolverResponseGenerator.
class FakeResolver : public Resolver {
public:
explicit FakeResolver(const ResolverArgs& args);
// Passed-in parameters
grpc_channel_args* channel_args;
void NextLocked(grpc_channel_args** result,
grpc_closure* on_complete) override;
// If not NULL, the next set of resolution results to be returned to
// grpc_resolver_next_locked()'s closure.
grpc_channel_args* next_results;
void RequestReresolutionLocked() override;
// Results to use for the pretended re-resolution in
// fake_resolver_channel_saw_error_locked().
grpc_channel_args* results_upon_error;
private:
friend class FakeResolverResponseGenerator;
virtual ~FakeResolver();
void MaybeFinishNextLocked();
void ShutdownLocked() override;
// passed-in parameters
grpc_channel_args* channel_args_ = nullptr;
// If not NULL, the next set of resolution results to be returned to
// NextLocked()'s closure.
grpc_channel_args* next_results_ = nullptr;
// Results to use for the pretended re-resolution in
// RequestReresolutionLocked().
grpc_channel_args* reresolution_results_ = nullptr;
// 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
grpc_channel_args** target_result;
} fake_resolver;
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);
grpc_channel_args* last_used_results_ = nullptr;
// pending next completion, or NULL
grpc_closure* next_completion_ = nullptr;
// target result address for next completion
grpc_channel_args** target_result_ = nullptr;
};
FakeResolver::FakeResolver(const ResolverArgs& args) : Resolver(args.combiner) {
channel_args_ = grpc_channel_args_copy(args.args);
FakeResolverResponseGenerator* response_generator =
FakeResolverResponseGenerator::GetFromArgs(args.args);
if (response_generator != nullptr) response_generator->resolver_ = this;
}
static void fake_resolver_shutdown_locked(grpc_resolver* resolver) {
fake_resolver* r = (fake_resolver*)resolver;
if (r->next_completion != nullptr) {
*r->target_result = nullptr;
GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Resolver Shutdown"));
r->next_completion = nullptr;
}
FakeResolver::~FakeResolver() {
grpc_channel_args_destroy(next_results_);
grpc_channel_args_destroy(reresolution_results_);
grpc_channel_args_destroy(last_used_results_);
grpc_channel_args_destroy(channel_args_);
}
static void fake_resolver_maybe_finish_next_locked(fake_resolver* r) {
if (r->next_completion != nullptr && r->next_results != nullptr) {
*r->target_result =
grpc_channel_args_union(r->next_results, r->channel_args);
grpc_channel_args_destroy(r->next_results);
r->next_results = nullptr;
GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
r->next_completion = nullptr;
}
void FakeResolver::NextLocked(grpc_channel_args** target_result,
grpc_closure* on_complete) {
GPR_ASSERT(next_completion_ == nullptr);
next_completion_ = on_complete;
target_result_ = target_result;
MaybeFinishNextLocked();
}
static void fake_resolver_channel_saw_error_locked(grpc_resolver* resolver) {
fake_resolver* r = (fake_resolver*)resolver;
void FakeResolver::RequestReresolutionLocked() {
// 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);
GPR_ASSERT(last_used_results_ != nullptr);
grpc_channel_args_destroy(next_results_);
if (reresolution_results_ != nullptr) {
next_results_ = grpc_channel_args_copy(reresolution_results_);
} else {
// If results_upon_error is unavailable, re-resolve with the most-recently
// If reresolution_results 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);
next_results_ = grpc_channel_args_copy(last_used_results_);
}
fake_resolver_maybe_finish_next_locked(r);
}
static void fake_resolver_next_locked(grpc_resolver* resolver,
grpc_channel_args** target_result,
grpc_closure* on_complete) {
fake_resolver* r = (fake_resolver*)resolver;
GPR_ASSERT(!r->next_completion);
r->next_completion = on_complete;
r->target_result = target_result;
fake_resolver_maybe_finish_next_locked(r);
}
static const grpc_resolver_vtable fake_resolver_vtable = {
fake_resolver_destroy, fake_resolver_shutdown_locked,
fake_resolver_channel_saw_error_locked, fake_resolver_next_locked};
struct grpc_fake_resolver_response_generator {
fake_resolver* resolver; // Set by the fake_resolver constructor to itself.
gpr_refcount refcount;
};
grpc_fake_resolver_response_generator*
grpc_fake_resolver_response_generator_create() {
grpc_fake_resolver_response_generator* generator =
(grpc_fake_resolver_response_generator*)gpr_zalloc(sizeof(*generator));
gpr_ref_init(&generator->refcount, 1);
return generator;
MaybeFinishNextLocked();
}
grpc_fake_resolver_response_generator*
grpc_fake_resolver_response_generator_ref(
grpc_fake_resolver_response_generator* generator) {
gpr_ref(&generator->refcount);
return generator;
void FakeResolver::MaybeFinishNextLocked() {
if (next_completion_ != nullptr && next_results_ != nullptr) {
*target_result_ = grpc_channel_args_union(next_results_, channel_args_);
grpc_channel_args_destroy(next_results_);
next_results_ = nullptr;
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_NONE);
next_completion_ = nullptr;
}
}
void grpc_fake_resolver_response_generator_unref(
grpc_fake_resolver_response_generator* generator) {
if (gpr_unref(&generator->refcount)) {
gpr_free(generator);
void FakeResolver::ShutdownLocked() {
if (next_completion_ != nullptr) {
*target_result_ = nullptr;
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Resolver Shutdown"));
next_completion_ = nullptr;
}
}
typedef struct set_response_closure_arg {
//
// FakeResolverResponseGenerator
//
struct SetResponseClosureArg {
grpc_closure set_response_closure;
grpc_fake_resolver_response_generator* generator;
FakeResolverResponseGenerator* generator;
grpc_channel_args* response;
bool upon_error;
} set_response_closure_arg;
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 (!closure_arg->upon_error) {
grpc_channel_args_destroy(r->next_results);
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;
}
gpr_free(closure_arg);
};
void FakeResolverResponseGenerator::SetResponseLocked(void* arg,
grpc_error* error) {
SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
FakeResolver* resolver = closure_arg->generator->resolver_;
grpc_channel_args_destroy(resolver->next_results_);
resolver->next_results_ = closure_arg->response;
grpc_channel_args_destroy(resolver->last_used_results_);
resolver->last_used_results_ = grpc_channel_args_copy(closure_arg->response);
resolver->MaybeFinishNextLocked();
Delete(closure_arg);
}
void grpc_fake_resolver_response_generator_set_response(
grpc_fake_resolver_response_generator* generator,
grpc_channel_args* response) {
GPR_ASSERT(generator->resolver != nullptr);
void FakeResolverResponseGenerator::SetResponse(grpc_channel_args* response) {
GPR_ASSERT(response != nullptr);
set_response_closure_arg* closure_arg =
(set_response_closure_arg*)gpr_zalloc(sizeof(*closure_arg));
closure_arg->generator = generator;
GPR_ASSERT(resolver_ != nullptr);
SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
closure_arg->generator = this;
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);
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetResponseLocked,
closure_arg,
grpc_combiner_scheduler(resolver_->combiner())),
GRPC_ERROR_NONE);
}
void grpc_fake_resolver_response_generator_set_response_upon_error(
grpc_fake_resolver_response_generator* generator,
void FakeResolverResponseGenerator::SetReresolutionResponseLocked(
void* arg, grpc_error* error) {
SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
FakeResolver* resolver = closure_arg->generator->resolver_;
grpc_channel_args_destroy(resolver->reresolution_results_);
resolver->reresolution_results_ = closure_arg->response;
Delete(closure_arg);
}
void FakeResolverResponseGenerator::SetReresolutionResponse(
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;
GPR_ASSERT(resolver_ != nullptr);
SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
closure_arg->generator = this;
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_locked, closure_arg,
grpc_combiner_scheduler(
generator->resolver->base.combiner)),
GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
SetReresolutionResponseLocked, closure_arg,
grpc_combiner_scheduler(resolver_->combiner())),
GRPC_ERROR_NONE);
}
namespace {
static void* response_generator_arg_copy(void* p) {
return grpc_fake_resolver_response_generator_ref(
(grpc_fake_resolver_response_generator*)p);
FakeResolverResponseGenerator* generator =
static_cast<FakeResolverResponseGenerator*>(p);
// TODO(roth): We currently deal with this ref manually. Once the
// new channel args code is converted to C++, find a way to track this ref
// in a cleaner way.
RefCountedPtr<FakeResolverResponseGenerator> copy = generator->Ref();
copy.release();
return p;
}
static void response_generator_arg_destroy(void* p) {
grpc_fake_resolver_response_generator_unref(
(grpc_fake_resolver_response_generator*)p);
FakeResolverResponseGenerator* generator =
static_cast<FakeResolverResponseGenerator*>(p);
generator->Unref();
}
static int response_generator_cmp(void* a, void* b) { return GPR_ICMP(a, b); }
@ -234,8 +221,10 @@ static const grpc_arg_pointer_vtable response_generator_arg_vtable = {
response_generator_arg_copy, response_generator_arg_destroy,
response_generator_cmp};
grpc_arg grpc_fake_resolver_response_generator_arg(
grpc_fake_resolver_response_generator* generator) {
} // namespace
grpc_arg FakeResolverResponseGenerator::MakeChannelArg(
FakeResolverResponseGenerator* generator) {
grpc_arg arg;
arg.type = GRPC_ARG_POINTER;
arg.key = (char*)GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR;
@ -244,49 +233,38 @@ grpc_arg grpc_fake_resolver_response_generator_arg(
return arg;
}
grpc_fake_resolver_response_generator*
grpc_fake_resolver_get_response_generator(const grpc_channel_args* args) {
FakeResolverResponseGenerator* FakeResolverResponseGenerator::GetFromArgs(
const grpc_channel_args* args) {
const grpc_arg* arg =
grpc_channel_args_find(args, GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR);
if (arg == nullptr || arg->type != GRPC_ARG_POINTER) return nullptr;
return (grpc_fake_resolver_response_generator*)arg->value.pointer.p;
return static_cast<FakeResolverResponseGenerator*>(arg->value.pointer.p);
}
//
// fake_resolver_factory
// Factory
//
static void fake_resolver_factory_ref(grpc_resolver_factory* factory) {}
static void fake_resolver_factory_unref(grpc_resolver_factory* factory) {}
namespace {
static grpc_resolver* fake_resolver_create(grpc_resolver_factory* factory,
grpc_resolver_args* args) {
fake_resolver* r = (fake_resolver*)gpr_zalloc(sizeof(*r));
r->channel_args = grpc_channel_args_copy(args->args);
grpc_resolver_init(&r->base, &fake_resolver_vtable, args->combiner);
grpc_fake_resolver_response_generator* response_generator =
grpc_fake_resolver_get_response_generator(args->args);
if (response_generator != nullptr) response_generator->resolver = r;
return &r->base;
}
class FakeResolverFactory : public ResolverFactory {
public:
OrphanablePtr<Resolver> CreateResolver(
const ResolverArgs& args) const override {
return OrphanablePtr<Resolver>(New<FakeResolver>(args));
}
static char* fake_resolver_get_default_authority(grpc_resolver_factory* factory,
grpc_uri* uri) {
const char* path = uri->path;
if (path[0] == '/') ++path;
return gpr_strdup(path);
}
const char* scheme() const override { return "fake"; }
};
static const grpc_resolver_factory_vtable fake_resolver_factory_vtable = {
fake_resolver_factory_ref, fake_resolver_factory_unref,
fake_resolver_create, fake_resolver_get_default_authority, "fake"};
} // namespace
static grpc_resolver_factory fake_resolver_factory = {
&fake_resolver_factory_vtable};
} // namespace grpc_core
void grpc_resolver_fake_init(void) {
grpc_register_resolver_type(&fake_resolver_factory);
void grpc_resolver_fake_init() {
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
grpc_core::New<grpc_core::FakeResolverFactory>()));
}
void grpc_resolver_fake_shutdown(void) {}
void grpc_resolver_fake_shutdown() {}

@ -20,50 +20,57 @@
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
#include "src/core/ext/filters/client_channel/uri_parser.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/ref_counted.h"
#define GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR \
"grpc.fake_resolver.response_generator"
void grpc_resolver_fake_init();
namespace grpc_core {
// Instances of \a grpc_fake_resolver_response_generator are passed to the
// fake resolver in a channel argument (see \a
// grpc_fake_resolver_response_generator_arg) in order to inject and trigger
// custom resolutions. See also \a
// grpc_fake_resolver_response_generator_set_response.
typedef struct grpc_fake_resolver_response_generator
grpc_fake_resolver_response_generator;
grpc_fake_resolver_response_generator*
grpc_fake_resolver_response_generator_create();
class FakeResolver;
// 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* response);
/// A mechanism for generating responses for the fake resolver.
/// An instance of this class is passed to the fake resolver via a channel
/// argument (see \a MakeChannelArg()) and used to inject and trigger custom
/// resolutions.
// TODO(roth): I would ideally like this to be InternallyRefCounted
// instead of RefCounted, but external refs are currently needed to
// encode this in channel args. Once channel_args are converted to C++,
// see if we can find a way to fix this.
class FakeResolverResponseGenerator
: public RefCounted<FakeResolverResponseGenerator> {
public:
FakeResolverResponseGenerator() {}
// 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);
// Instructs the fake resolver associated with the response generator
// instance to trigger a new resolution with the specified response.
void SetResponse(grpc_channel_args* next_response);
// Return a \a grpc_arg for a \a grpc_fake_resolver_response_generator instance.
grpc_arg grpc_fake_resolver_response_generator_arg(
grpc_fake_resolver_response_generator* generator);
// Return the \a grpc_fake_resolver_response_generator instance in \a args or
// NULL.
grpc_fake_resolver_response_generator*
grpc_fake_resolver_get_response_generator(const grpc_channel_args* args);
// Sets the re-resolution response, which is returned by the fake resolver
// when re-resolution is requested (via \a RequestReresolutionLocked()).
// The new re-resolution response replaces any previous re-resolution
// response that may have been set by a previous call.
// If the re-resolution response is set to NULL, then the fake
// resolver will return the last value set via \a SetResponse().
void SetReresolutionResponse(grpc_channel_args* response);
grpc_fake_resolver_response_generator*
grpc_fake_resolver_response_generator_ref(
grpc_fake_resolver_response_generator* generator);
void grpc_fake_resolver_response_generator_unref(
grpc_fake_resolver_response_generator* generator);
// Returns a channel arg containing \a generator.
static grpc_arg MakeChannelArg(FakeResolverResponseGenerator* generator);
// Returns the response generator in \a args, or null if not found.
static FakeResolverResponseGenerator* GetFromArgs(
const grpc_channel_args* args);
private:
friend class FakeResolver;
static void SetResponseLocked(void* arg, grpc_error* error);
static void SetReresolutionResponseLocked(void* arg, grpc_error* error);
FakeResolver* resolver_ = nullptr; // Do not own.
};
} // namespace grpc_core
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FAKE_FAKE_RESOLVER_H \
*/

@ -37,115 +37,99 @@
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
typedef struct {
/** base class: must be first */
grpc_resolver base;
/** the addresses that we've 'resolved' */
grpc_lb_addresses* addresses;
/** channel args */
grpc_channel_args* channel_args;
/** have we published? */
bool published;
/** pending next completion, or NULL */
grpc_closure* next_completion;
/** target result address for next completion */
grpc_channel_args** target_result;
} sockaddr_resolver;
static void sockaddr_destroy(grpc_resolver* r);
static void sockaddr_maybe_finish_next_locked(sockaddr_resolver* r);
static void sockaddr_shutdown_locked(grpc_resolver* r);
static void sockaddr_channel_saw_error_locked(grpc_resolver* r);
static void sockaddr_next_locked(grpc_resolver* r,
grpc_channel_args** target_result,
grpc_closure* on_complete);
static const grpc_resolver_vtable sockaddr_resolver_vtable = {
sockaddr_destroy, sockaddr_shutdown_locked,
sockaddr_channel_saw_error_locked, sockaddr_next_locked};
static void sockaddr_shutdown_locked(grpc_resolver* resolver) {
sockaddr_resolver* r = (sockaddr_resolver*)resolver;
if (r->next_completion != nullptr) {
*r->target_result = nullptr;
GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Resolver Shutdown"));
r->next_completion = nullptr;
}
}
namespace grpc_core {
static void sockaddr_channel_saw_error_locked(grpc_resolver* resolver) {
sockaddr_resolver* r = (sockaddr_resolver*)resolver;
r->published = false;
sockaddr_maybe_finish_next_locked(r);
}
namespace {
static void sockaddr_next_locked(grpc_resolver* resolver,
grpc_channel_args** target_result,
grpc_closure* on_complete) {
sockaddr_resolver* r = (sockaddr_resolver*)resolver;
GPR_ASSERT(!r->next_completion);
r->next_completion = on_complete;
r->target_result = target_result;
sockaddr_maybe_finish_next_locked(r);
}
class SockaddrResolver : public Resolver {
public:
/// Takes ownership of \a addresses.
SockaddrResolver(const ResolverArgs& args, grpc_lb_addresses* addresses);
static void sockaddr_maybe_finish_next_locked(sockaddr_resolver* r) {
if (r->next_completion != nullptr && !r->published) {
r->published = true;
grpc_arg arg = grpc_lb_addresses_create_channel_arg(r->addresses);
*r->target_result =
grpc_channel_args_copy_and_add(r->channel_args, &arg, 1);
GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
r->next_completion = nullptr;
}
}
void NextLocked(grpc_channel_args** result,
grpc_closure* on_complete) override;
void RequestReresolutionLocked() override;
static void sockaddr_destroy(grpc_resolver* gr) {
sockaddr_resolver* r = (sockaddr_resolver*)gr;
grpc_lb_addresses_destroy(r->addresses);
grpc_channel_args_destroy(r->channel_args);
gpr_free(r);
void ShutdownLocked() override;
private:
virtual ~SockaddrResolver();
void MaybeFinishNextLocked();
/// the addresses that we've "resolved"
grpc_lb_addresses* addresses_ = nullptr;
/// channel args
grpc_channel_args* channel_args_ = nullptr;
/// have we published?
bool published_ = false;
/// pending next completion, or NULL
grpc_closure* next_completion_ = nullptr;
/// target result address for next completion
grpc_channel_args** target_result_ = nullptr;
};
SockaddrResolver::SockaddrResolver(const ResolverArgs& args,
grpc_lb_addresses* addresses)
: Resolver(args.combiner),
addresses_(addresses),
channel_args_(grpc_channel_args_copy(args.args)) {}
SockaddrResolver::~SockaddrResolver() {
grpc_lb_addresses_destroy(addresses_);
grpc_channel_args_destroy(channel_args_);
}
static char* ip_get_default_authority(grpc_uri* uri) {
const char* path = uri->path;
if (path[0] == '/') ++path;
return gpr_strdup(path);
void SockaddrResolver::NextLocked(grpc_channel_args** target_result,
grpc_closure* on_complete) {
GPR_ASSERT(!next_completion_);
next_completion_ = on_complete;
target_result_ = target_result;
MaybeFinishNextLocked();
}
static char* ipv4_get_default_authority(grpc_resolver_factory* factory,
grpc_uri* uri) {
return ip_get_default_authority(uri);
void SockaddrResolver::RequestReresolutionLocked() {
published_ = false;
MaybeFinishNextLocked();
}
static char* ipv6_get_default_authority(grpc_resolver_factory* factory,
grpc_uri* uri) {
return ip_get_default_authority(uri);
void SockaddrResolver::ShutdownLocked() {
if (next_completion_ != nullptr) {
*target_result_ = nullptr;
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Resolver Shutdown"));
next_completion_ = nullptr;
}
}
#ifdef GRPC_HAVE_UNIX_SOCKET
char* unix_get_default_authority(grpc_resolver_factory* factory,
grpc_uri* uri) {
return gpr_strdup("localhost");
void SockaddrResolver::MaybeFinishNextLocked() {
if (next_completion_ != nullptr && !published_) {
published_ = true;
grpc_arg arg = grpc_lb_addresses_create_channel_arg(addresses_);
*target_result_ = grpc_channel_args_copy_and_add(channel_args_, &arg, 1);
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_NONE);
next_completion_ = nullptr;
}
}
#endif
static void do_nothing(void* ignored) {}
//
// Factory
//
static grpc_resolver* sockaddr_create(grpc_resolver_args* args,
bool parse(const grpc_uri* uri,
grpc_resolved_address* dst)) {
if (0 != strcmp(args->uri->authority, "")) {
gpr_log(GPR_ERROR, "authority based uri's not supported by the %s scheme",
args->uri->scheme);
return nullptr;
void DoNothing(void* ignored) {}
OrphanablePtr<Resolver> CreateSockaddrResolver(
const ResolverArgs& args,
bool parse(const grpc_uri* uri, grpc_resolved_address* dst)) {
if (0 != strcmp(args.uri->authority, "")) {
gpr_log(GPR_ERROR, "authority-based URIs not supported by the %s scheme",
args.uri->scheme);
return OrphanablePtr<Resolver>(nullptr);
}
/* Construct addresses. */
// Construct addresses.
grpc_slice path_slice =
grpc_slice_new(args->uri->path, strlen(args->uri->path), do_nothing);
grpc_slice_new(args.uri->path, strlen(args.uri->path), DoNothing);
grpc_slice_buffer path_parts;
grpc_slice_buffer_init(&path_parts);
grpc_slice_split(path_slice, ",", &path_parts);
@ -153,7 +137,7 @@ static grpc_resolver* sockaddr_create(grpc_resolver_args* args,
path_parts.count, nullptr /* user_data_vtable */);
bool errors_found = false;
for (size_t i = 0; i < addresses->num_addresses; i++) {
grpc_uri ith_uri = *args->uri;
grpc_uri ith_uri = *args.uri;
char* part_str = grpc_slice_to_c_string(path_parts.slices[i]);
ith_uri.path = part_str;
if (!parse(&ith_uri, &addresses->addresses[i].address)) {
@ -166,48 +150,64 @@ static grpc_resolver* sockaddr_create(grpc_resolver_args* args,
grpc_slice_unref_internal(path_slice);
if (errors_found) {
grpc_lb_addresses_destroy(addresses);
return nullptr;
return OrphanablePtr<Resolver>(nullptr);
}
/* Instantiate resolver. */
sockaddr_resolver* r =
(sockaddr_resolver*)gpr_zalloc(sizeof(sockaddr_resolver));
r->addresses = addresses;
r->channel_args = grpc_channel_args_copy(args->args);
grpc_resolver_init(&r->base, &sockaddr_resolver_vtable, args->combiner);
return &r->base;
// Instantiate resolver.
return OrphanablePtr<Resolver>(New<SockaddrResolver>(args, addresses));
}
/*
* FACTORY
*/
class IPv4ResolverFactory : public ResolverFactory {
public:
OrphanablePtr<Resolver> CreateResolver(
const ResolverArgs& args) const override {
return CreateSockaddrResolver(args, grpc_parse_ipv4);
}
static void sockaddr_factory_ref(grpc_resolver_factory* factory) {}
const char* scheme() const override { return "ipv4"; }
};
static void sockaddr_factory_unref(grpc_resolver_factory* factory) {}
class IPv6ResolverFactory : public ResolverFactory {
public:
OrphanablePtr<Resolver> CreateResolver(
const ResolverArgs& args) const override {
return CreateSockaddrResolver(args, grpc_parse_ipv6);
}
#define DECL_FACTORY(name) \
static grpc_resolver* name##_factory_create_resolver( \
grpc_resolver_factory* factory, grpc_resolver_args* args) { \
return sockaddr_create(args, grpc_parse_##name); \
} \
static const grpc_resolver_factory_vtable name##_factory_vtable = { \
sockaddr_factory_ref, sockaddr_factory_unref, \
name##_factory_create_resolver, name##_get_default_authority, #name}; \
static grpc_resolver_factory name##_resolver_factory = { \
&name##_factory_vtable}
const char* scheme() const override { return "ipv6"; }
};
#ifdef GRPC_HAVE_UNIX_SOCKET
DECL_FACTORY(unix);
#endif
DECL_FACTORY(ipv4);
DECL_FACTORY(ipv6);
class UnixResolverFactory : public ResolverFactory {
public:
OrphanablePtr<Resolver> CreateResolver(
const ResolverArgs& args) const override {
return CreateSockaddrResolver(args, grpc_parse_unix);
}
UniquePtr<char> GetDefaultAuthority(grpc_uri* uri) const override {
return UniquePtr<char>(gpr_strdup("localhost"));
}
const char* scheme() const override { return "unix"; }
};
#endif // GRPC_HAVE_UNIX_SOCKET
} // namespace
} // namespace grpc_core
void grpc_resolver_sockaddr_init(void) {
grpc_register_resolver_type(&ipv4_resolver_factory);
grpc_register_resolver_type(&ipv6_resolver_factory);
void grpc_resolver_sockaddr_init() {
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
grpc_core::New<grpc_core::IPv4ResolverFactory>()));
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
grpc_core::New<grpc_core::IPv6ResolverFactory>()));
#ifdef GRPC_HAVE_UNIX_SOCKET
grpc_register_resolver_type(&unix_resolver_factory);
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
grpc_core::New<grpc_core::UnixResolverFactory>()));
#endif
}
void grpc_resolver_sockaddr_shutdown(void) {}
void grpc_resolver_sockaddr_shutdown() {}

@ -1,40 +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 "src/core/ext/filters/client_channel/resolver_factory.h"
void grpc_resolver_factory_ref(grpc_resolver_factory* factory) {
factory->vtable->ref(factory);
}
void grpc_resolver_factory_unref(grpc_resolver_factory* factory) {
factory->vtable->unref(factory);
}
/** Create a resolver instance for a name */
grpc_resolver* grpc_resolver_factory_create_resolver(
grpc_resolver_factory* factory, grpc_resolver_args* args) {
if (factory == nullptr) return nullptr;
return factory->vtable->create_resolver(factory, args);
}
char* grpc_resolver_factory_get_default_authority(
grpc_resolver_factory* factory, grpc_uri* uri) {
if (factory == nullptr) return nullptr;
return factory->vtable->get_default_authority(factory, uri);
}

@ -19,50 +19,51 @@
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H
#include "src/core/ext/filters/client_channel/client_channel_factory.h"
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/resolver.h"
#include "src/core/ext/filters/client_channel/uri_parser.h"
#include "src/core/lib/gprpp/abstract.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/pollset_set.h"
typedef struct grpc_resolver_factory grpc_resolver_factory;
typedef struct grpc_resolver_factory_vtable grpc_resolver_factory_vtable;
namespace grpc_core {
struct grpc_resolver_factory {
const grpc_resolver_factory_vtable* vtable;
struct ResolverArgs {
/// The parsed URI to resolve.
grpc_uri* uri = nullptr;
/// Channel args to be included in resolver results.
const grpc_channel_args* args = nullptr;
/// Used to drive I/O in the name resolution process.
grpc_pollset_set* pollset_set = nullptr;
/// The combiner under which all resolver calls will be run.
grpc_combiner* combiner = nullptr;
};
typedef struct grpc_resolver_args {
grpc_uri* uri;
const grpc_channel_args* args;
grpc_pollset_set* pollset_set;
grpc_combiner* combiner;
} grpc_resolver_args;
class ResolverFactory {
public:
/// Returns a new resolver instance.
virtual OrphanablePtr<Resolver> CreateResolver(const ResolverArgs& args) const
GRPC_ABSTRACT;
struct grpc_resolver_factory_vtable {
void (*ref)(grpc_resolver_factory* factory);
void (*unref)(grpc_resolver_factory* factory);
/// Returns a string representing the default authority to use for this
/// scheme.
virtual UniquePtr<char> GetDefaultAuthority(grpc_uri* uri) const {
const char* path = uri->path;
if (path[0] == '/') ++path;
return UniquePtr<char>(gpr_strdup(path));
}
/** Implementation of grpc_resolver_factory_create_resolver */
grpc_resolver* (*create_resolver)(grpc_resolver_factory* factory,
grpc_resolver_args* args);
/// Returns the URI scheme that this factory implements.
/// Caller does NOT take ownership of result.
virtual const char* scheme() const GRPC_ABSTRACT;
/** Implementation of grpc_resolver_factory_get_default_authority */
char* (*get_default_authority)(grpc_resolver_factory* factory, grpc_uri* uri);
virtual ~ResolverFactory() {}
/** URI scheme that this factory implements */
const char* scheme;
GRPC_ABSTRACT_BASE_CLASS
};
void grpc_resolver_factory_ref(grpc_resolver_factory* resolver);
void grpc_resolver_factory_unref(grpc_resolver_factory* resolver);
/** Create a resolver instance for a name */
grpc_resolver* grpc_resolver_factory_create_resolver(
grpc_resolver_factory* factory, grpc_resolver_args* args);
/** Return a (freshly allocated with gpr_malloc) string representing
the default authority to use for this scheme. */
char* grpc_resolver_factory_get_default_authority(
grpc_resolver_factory* factory, grpc_uri* uri);
} // namespace grpc_core
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */

@ -24,133 +24,153 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#define MAX_RESOLVERS 10
#define DEFAULT_RESOLVER_PREFIX_MAX_LENGTH 32
namespace grpc_core {
static grpc_resolver_factory* g_all_of_the_resolvers[MAX_RESOLVERS];
static int g_number_of_resolvers = 0;
namespace {
static char g_default_resolver_prefix[DEFAULT_RESOLVER_PREFIX_MAX_LENGTH] =
"dns:///";
class RegistryState {
public:
RegistryState() : default_prefix_(gpr_strdup("dns:///")) {}
void grpc_resolver_registry_init() {}
void grpc_resolver_registry_shutdown(void) {
for (int i = 0; i < g_number_of_resolvers; i++) {
grpc_resolver_factory_unref(g_all_of_the_resolvers[i]);
void SetDefaultPrefix(const char* default_resolver_prefix) {
GPR_ASSERT(default_resolver_prefix != nullptr);
GPR_ASSERT(*default_resolver_prefix != '\0');
default_prefix_.reset(gpr_strdup(default_resolver_prefix));
}
// FIXME(ctiller): this should live in grpc_resolver_registry_init,
// however that would have the client_channel plugin call this AFTER we start
// registering resolvers from third party plugins, and so they'd never show
// up.
// We likely need some kind of dependency system for plugins.... what form
// that takes is TBD.
g_number_of_resolvers = 0;
}
void grpc_resolver_registry_set_default_prefix(
const char* default_resolver_prefix) {
const size_t len = strlen(default_resolver_prefix);
GPR_ASSERT(len < DEFAULT_RESOLVER_PREFIX_MAX_LENGTH &&
"default resolver prefix too long");
GPR_ASSERT(len > 0 && "default resolver prefix can't be empty");
// By the previous assert, default_resolver_prefix is safe to be copied with a
// plain strcpy.
strcpy(g_default_resolver_prefix, default_resolver_prefix);
}
void grpc_register_resolver_type(grpc_resolver_factory* factory) {
int i;
for (i = 0; i < g_number_of_resolvers; i++) {
GPR_ASSERT(0 != strcmp(factory->vtable->scheme,
g_all_of_the_resolvers[i]->vtable->scheme));
void RegisterResolverFactory(UniquePtr<ResolverFactory> factory) {
for (size_t i = 0; i < factories_.size(); ++i) {
GPR_ASSERT(strcmp(factories_[i]->scheme(), factory->scheme()) != 0);
}
factories_.push_back(std::move(factory));
}
GPR_ASSERT(g_number_of_resolvers != MAX_RESOLVERS);
grpc_resolver_factory_ref(factory);
g_all_of_the_resolvers[g_number_of_resolvers++] = factory;
}
static grpc_resolver_factory* lookup_factory(const char* name) {
int i;
ResolverFactory* LookupResolverFactory(const char* scheme) const {
for (size_t i = 0; i < factories_.size(); ++i) {
if (strcmp(scheme, factories_[i]->scheme()) == 0) {
return factories_[i].get();
}
}
return nullptr;
}
for (i = 0; i < g_number_of_resolvers; i++) {
if (0 == strcmp(name, g_all_of_the_resolvers[i]->vtable->scheme)) {
return g_all_of_the_resolvers[i];
// Returns the factory for the scheme of \a target. If \a target does
// not parse as a URI, prepends \a default_prefix_ and tries again.
// If URI parsing is successful (in either attempt), sets \a uri to
// point to the parsed URI.
// If \a default_prefix_ needs to be prepended, sets \a canonical_target
// to the canonical target string.
ResolverFactory* FindResolverFactory(const char* target, grpc_uri** uri,
char** canonical_target) const {
GPR_ASSERT(uri != nullptr);
*uri = grpc_uri_parse(target, 1);
ResolverFactory* factory =
*uri == nullptr ? nullptr : LookupResolverFactory((*uri)->scheme);
if (factory == nullptr) {
grpc_uri_destroy(*uri);
gpr_asprintf(canonical_target, "%s%s", default_prefix_.get(), target);
*uri = grpc_uri_parse(*canonical_target, 1);
factory =
*uri == nullptr ? nullptr : LookupResolverFactory((*uri)->scheme);
if (factory == nullptr) {
grpc_uri_destroy(grpc_uri_parse(target, 0));
grpc_uri_destroy(grpc_uri_parse(*canonical_target, 0));
gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target,
*canonical_target);
}
}
return factory;
}
return nullptr;
private:
// We currently support 10 factories without doing additional
// allocation. This number could be raised if there is a case where
// more factories are needed and the additional allocations are
// hurting performance (which is unlikely, since these allocations
// only occur at gRPC initialization time).
InlinedVector<UniquePtr<ResolverFactory>, 10> factories_;
UniquePtr<char> default_prefix_;
};
static RegistryState* g_state = nullptr;
} // namespace
//
// ResolverRegistry::Builder
//
void ResolverRegistry::Builder::InitRegistry() {
if (g_state == nullptr) g_state = New<RegistryState>();
}
grpc_resolver_factory* grpc_resolver_factory_lookup(const char* name) {
grpc_resolver_factory* f = lookup_factory(name);
if (f) grpc_resolver_factory_ref(f);
return f;
void ResolverRegistry::Builder::ShutdownRegistry() {
Delete(g_state);
g_state = nullptr;
}
static grpc_resolver_factory* lookup_factory_by_uri(grpc_uri* uri) {
if (!uri) return nullptr;
return lookup_factory(uri->scheme);
void ResolverRegistry::Builder::SetDefaultPrefix(
const char* default_resolver_prefix) {
InitRegistry();
g_state->SetDefaultPrefix(default_resolver_prefix);
}
static grpc_resolver_factory* resolve_factory(const char* target,
grpc_uri** uri,
char** canonical_target) {
grpc_resolver_factory* factory = nullptr;
GPR_ASSERT(uri != nullptr);
*uri = grpc_uri_parse(target, 1);
factory = lookup_factory_by_uri(*uri);
if (factory == nullptr) {
grpc_uri_destroy(*uri);
gpr_asprintf(canonical_target, "%s%s", g_default_resolver_prefix, target);
*uri = grpc_uri_parse(*canonical_target, 1);
factory = lookup_factory_by_uri(*uri);
if (factory == nullptr) {
grpc_uri_destroy(grpc_uri_parse(target, 0));
grpc_uri_destroy(grpc_uri_parse(*canonical_target, 0));
gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target,
*canonical_target);
}
}
return factory;
void ResolverRegistry::Builder::RegisterResolverFactory(
UniquePtr<ResolverFactory> factory) {
InitRegistry();
g_state->RegisterResolverFactory(std::move(factory));
}
grpc_resolver* grpc_resolver_create(const char* target,
const grpc_channel_args* args,
grpc_pollset_set* pollset_set,
grpc_combiner* combiner) {
//
// ResolverRegistry
//
ResolverFactory* ResolverRegistry::LookupResolverFactory(const char* scheme) {
GPR_ASSERT(g_state != nullptr);
return g_state->LookupResolverFactory(scheme);
}
OrphanablePtr<Resolver> ResolverRegistry::CreateResolver(
const char* target, const grpc_channel_args* args,
grpc_pollset_set* pollset_set, grpc_combiner* combiner) {
GPR_ASSERT(g_state != nullptr);
grpc_uri* uri = nullptr;
char* canonical_target = nullptr;
grpc_resolver_factory* factory =
resolve_factory(target, &uri, &canonical_target);
grpc_resolver* resolver;
grpc_resolver_args resolver_args;
memset(&resolver_args, 0, sizeof(resolver_args));
ResolverFactory* factory =
g_state->FindResolverFactory(target, &uri, &canonical_target);
ResolverArgs resolver_args;
resolver_args.uri = uri;
resolver_args.args = args;
resolver_args.pollset_set = pollset_set;
resolver_args.combiner = combiner;
resolver = grpc_resolver_factory_create_resolver(factory, &resolver_args);
OrphanablePtr<Resolver> resolver =
factory == nullptr ? nullptr : factory->CreateResolver(resolver_args);
grpc_uri_destroy(uri);
gpr_free(canonical_target);
return resolver;
}
char* grpc_get_default_authority(const char* target) {
UniquePtr<char> ResolverRegistry::GetDefaultAuthority(const char* target) {
GPR_ASSERT(g_state != nullptr);
grpc_uri* uri = nullptr;
char* canonical_target = nullptr;
grpc_resolver_factory* factory =
resolve_factory(target, &uri, &canonical_target);
char* authority = grpc_resolver_factory_get_default_authority(factory, uri);
ResolverFactory* factory =
g_state->FindResolverFactory(target, &uri, &canonical_target);
UniquePtr<char> authority =
factory == nullptr ? nullptr : factory->GetDefaultAuthority(uri);
grpc_uri_destroy(uri);
gpr_free(canonical_target);
return authority;
}
char* grpc_resolver_factory_add_default_prefix_if_needed(const char* target) {
UniquePtr<char> ResolverRegistry::AddDefaultPrefixIfNeeded(const char* target) {
GPR_ASSERT(g_state != nullptr);
grpc_uri* uri = nullptr;
char* canonical_target = nullptr;
resolve_factory(target, &uri, &canonical_target);
g_state->FindResolverFactory(target, &uri, &canonical_target);
grpc_uri_destroy(uri);
return canonical_target == nullptr ? gpr_strdup(target) : canonical_target;
return UniquePtr<char>(canonical_target == nullptr ? gpr_strdup(target)
: canonical_target);
}
} // namespace grpc_core

@ -20,49 +20,62 @@
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H
#include "src/core/ext/filters/client_channel/resolver_factory.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/pollset_set.h"
void grpc_resolver_registry_init();
void grpc_resolver_registry_shutdown(void);
namespace grpc_core {
/** Set the default URI prefix to \a default_prefix. */
void grpc_resolver_registry_set_default_prefix(const char* default_prefix);
class ResolverRegistry {
public:
/// Methods used to create and populate the ResolverRegistry.
/// NOT THREAD SAFE -- to be used only during global gRPC
/// initialization and shutdown.
class Builder {
public:
/// Global initialization and shutdown hooks.
static void InitRegistry();
static void ShutdownRegistry();
/** Register a resolver type.
URI's of \a scheme will be resolved with the given resolver.
If \a priority is greater than zero, then the resolver will be eligible
to resolve names that are passed in with no scheme. Higher priority
resolvers will be tried before lower priority schemes. */
void grpc_register_resolver_type(grpc_resolver_factory* factory);
/// Sets the default URI prefix to \a default_prefix.
/// Calls InitRegistry() if it has not already been called.
static void SetDefaultPrefix(const char* default_prefix);
/** Create a resolver given \a target.
First tries to parse \a target as a URI. If this succeeds, tries
to locate a registered resolver factory based on the URI scheme.
If parsing or location fails, prefixes default_prefix from
grpc_resolver_registry_init to target, and tries again (if default_prefix
was not NULL).
If a resolver factory was found, use it to instantiate a resolver and
return it.
If a resolver factory was not found, return NULL.
\a args is a set of channel arguments to be included in the result
(typically the set of arguments passed in from the client API).
\a pollset_set is used to drive IO in the name resolution process, it
should not be NULL. */
grpc_resolver* grpc_resolver_create(const char* target,
const grpc_channel_args* args,
grpc_pollset_set* pollset_set,
grpc_combiner* combiner);
/// Registers a resolver factory. The factory will be used to create a
/// resolver for any URI whose scheme matches that of the factory.
/// Calls InitRegistry() if it has not already been called.
static void RegisterResolverFactory(UniquePtr<ResolverFactory> factory);
};
/** Find a resolver factory given a name and return an (owned-by-the-caller)
* reference to it */
grpc_resolver_factory* grpc_resolver_factory_lookup(const char* name);
/// Creates a resolver given \a target.
/// First tries to parse \a target as a URI. If this succeeds, tries
/// to locate a registered resolver factory based on the URI scheme.
/// If parsing fails or there is no factory for the URI's scheme,
/// prepends default_prefix to target and tries again.
/// If a resolver factory is found, uses it to instantiate a resolver and
/// returns it; otherwise, returns nullptr.
/// \a args, \a pollset_set, and \a combiner are passed to the factory's
/// \a CreateResolver() method.
/// \a args are the channel args to be included in resolver results.
/// \a pollset_set is used to drive I/O in the name resolution process.
/// \a combiner is the combiner under which all resolver calls will be run.
static OrphanablePtr<Resolver> CreateResolver(const char* target,
const grpc_channel_args* args,
grpc_pollset_set* pollset_set,
grpc_combiner* combiner);
/** Given a target, return a (freshly allocated with gpr_malloc) string
representing the default authority to pass from a client. */
char* grpc_get_default_authority(const char* target);
/// Returns the default authority to pass from a client for \a target.
static UniquePtr<char> GetDefaultAuthority(const char* target);
/** Returns a newly allocated string containing \a target, adding the
default prefix if needed. */
char* grpc_resolver_factory_add_default_prefix_if_needed(const char* target);
/// Returns \a target with the default prefix prepended, if needed.
static UniquePtr<char> AddDefaultPrefixIfNeeded(const char* target);
/// Returns the resolver factory for \a scheme.
/// Caller does NOT own the return value.
static ResolverFactory* LookupResolverFactory(const char* scheme);
};
} // namespace grpc_core
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */

@ -23,10 +23,11 @@
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/avl.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include "src/core/lib/avl/avl.h"
//
// server_retry_throttle_data
//
@ -152,7 +153,7 @@ static void* copy_server_retry_throttle_data(void* value, void* unused) {
static void destroy_server_name(void* key, void* unused) { gpr_free(key); }
static const gpr_avl_vtable avl_vtable = {
static const grpc_avl_vtable avl_vtable = {
destroy_server_name, copy_server_name, compare_server_name,
destroy_server_retry_throttle_data, copy_server_retry_throttle_data};
@ -161,29 +162,29 @@ static const gpr_avl_vtable avl_vtable = {
//
static gpr_mu g_mu;
static gpr_avl g_avl;
static grpc_avl g_avl;
void grpc_retry_throttle_map_init() {
gpr_mu_init(&g_mu);
g_avl = gpr_avl_create(&avl_vtable);
g_avl = grpc_avl_create(&avl_vtable);
}
void grpc_retry_throttle_map_shutdown() {
gpr_mu_destroy(&g_mu);
gpr_avl_unref(g_avl, nullptr);
grpc_avl_unref(g_avl, nullptr);
}
grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
const char* server_name, int max_milli_tokens, int milli_token_ratio) {
gpr_mu_lock(&g_mu);
grpc_server_retry_throttle_data* throttle_data =
(grpc_server_retry_throttle_data*)gpr_avl_get(g_avl, (char*)server_name,
nullptr);
(grpc_server_retry_throttle_data*)grpc_avl_get(g_avl, (char*)server_name,
nullptr);
if (throttle_data == nullptr) {
// Entry not found. Create a new one.
throttle_data = grpc_server_retry_throttle_data_create(
max_milli_tokens, milli_token_ratio, nullptr);
g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
g_avl = grpc_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
} else {
if (throttle_data->max_milli_tokens != max_milli_tokens ||
throttle_data->milli_token_ratio != milli_token_ratio) {
@ -191,7 +192,7 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
// the original one.
throttle_data = grpc_server_retry_throttle_data_create(
max_milli_tokens, milli_token_ratio, throttle_data);
g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
g_avl = grpc_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
} else {
// Entry found. Increase refcount.
grpc_server_retry_throttle_data_ref(throttle_data);

@ -25,7 +25,6 @@
#include <cstring>
#include <grpc/support/alloc.h>
#include <grpc/support/avl.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/client_channel.h"

@ -22,15 +22,15 @@
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/avl.h>
#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>
#include "src/core/lib/avl/avl.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/tls.h"
// a map of subchannel_key --> subchannel, used for detecting connections
// to the same destination in order to share them
static gpr_avl g_subchannel_index;
static grpc_avl g_subchannel_index;
static gpr_mu g_mu;
@ -109,7 +109,7 @@ static void* scv_avl_copy(void* p, void* unused) {
return p;
}
static const gpr_avl_vtable subchannel_avl_vtable = {
static const grpc_avl_vtable subchannel_avl_vtable = {
sck_avl_destroy, // destroy_key
sck_avl_copy, // copy_key
sck_avl_compare, // compare_keys
@ -118,7 +118,7 @@ static const gpr_avl_vtable subchannel_avl_vtable = {
};
void grpc_subchannel_index_init(void) {
g_subchannel_index = gpr_avl_create(&subchannel_avl_vtable);
g_subchannel_index = grpc_avl_create(&subchannel_avl_vtable);
gpr_mu_init(&g_mu);
gpr_ref_init(&g_refcount, 1);
}
@ -133,7 +133,7 @@ void grpc_subchannel_index_shutdown(void) {
void grpc_subchannel_index_unref(void) {
if (gpr_unref(&g_refcount)) {
gpr_mu_destroy(&g_mu);
gpr_avl_unref(g_subchannel_index, grpc_core::ExecCtx::Get());
grpc_avl_unref(g_subchannel_index, grpc_core::ExecCtx::Get());
}
}
@ -143,13 +143,13 @@ grpc_subchannel* grpc_subchannel_index_find(grpc_subchannel_key* key) {
// Lock, and take a reference to the subchannel index.
// We don't need to do the search under a lock as avl's are immutable.
gpr_mu_lock(&g_mu);
gpr_avl index = gpr_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);
grpc_subchannel* c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(
(grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get()),
(grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get()),
"index_find");
gpr_avl_unref(index, grpc_core::ExecCtx::Get());
grpc_avl_unref(index, grpc_core::ExecCtx::Get());
return c;
}
@ -165,11 +165,12 @@ 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);
gpr_avl index = gpr_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
c = (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get());
c = (grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get());
if (c != nullptr) {
c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register");
}
@ -178,25 +179,25 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
need_to_unref_constructed = true;
} else {
// no -> update the avl and compare/swap
gpr_avl updated =
gpr_avl_add(gpr_avl_ref(index, grpc_core::ExecCtx::Get()),
subchannel_key_copy(key),
GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"),
grpc_core::ExecCtx::Get());
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());
// it may happen (but it's expected to be unlikely)
// that some other thread has changed the index:
// compare/swap here to check that, and retry as necessary
gpr_mu_lock(&g_mu);
if (index.root == g_subchannel_index.root) {
GPR_SWAP(gpr_avl, updated, g_subchannel_index);
GPR_SWAP(grpc_avl, updated, g_subchannel_index);
c = constructed;
}
gpr_mu_unlock(&g_mu);
gpr_avl_unref(updated, grpc_core::ExecCtx::Get());
grpc_avl_unref(updated, grpc_core::ExecCtx::Get());
}
gpr_avl_unref(index, grpc_core::ExecCtx::Get());
grpc_avl_unref(index, grpc_core::ExecCtx::Get());
}
if (need_to_unref_constructed) {
@ -213,33 +214,34 @@ 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);
gpr_avl index = gpr_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
// registered subchannel
grpc_subchannel* c =
(grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get());
(grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get());
if (c != constructed) {
gpr_avl_unref(index, grpc_core::ExecCtx::Get());
grpc_avl_unref(index, grpc_core::ExecCtx::Get());
break;
}
// compare and swap the update (some other thread may have
// mutated the index behind us)
gpr_avl updated =
gpr_avl_remove(gpr_avl_ref(index, grpc_core::ExecCtx::Get()), key,
grpc_core::ExecCtx::Get());
grpc_avl updated =
grpc_avl_remove(grpc_avl_ref(index, grpc_core::ExecCtx::Get()), key,
grpc_core::ExecCtx::Get());
gpr_mu_lock(&g_mu);
if (index.root == g_subchannel_index.root) {
GPR_SWAP(gpr_avl, updated, g_subchannel_index);
GPR_SWAP(grpc_avl, updated, g_subchannel_index);
done = true;
}
gpr_mu_unlock(&g_mu);
gpr_avl_unref(updated, grpc_core::ExecCtx::Get());
gpr_avl_unref(index, grpc_core::ExecCtx::Get());
grpc_avl_unref(updated, grpc_core::ExecCtx::Get());
grpc_avl_unref(index, grpc_core::ExecCtx::Get());
}
}

@ -18,7 +18,8 @@
#include "src/core/ext/transport/chttp2/alpn/alpn.h"
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
/* in order of preference */
static const char* const supported_versions[] = {"grpc-exp", "h2"};

@ -52,13 +52,13 @@ static grpc_channel* client_channel_factory_create_channel(
return nullptr;
}
// Add channel arg containing the server URI.
grpc_arg arg = grpc_channel_arg_string_create(
(char*)GRPC_ARG_SERVER_URI,
grpc_resolver_factory_add_default_prefix_if_needed(target));
grpc_core::UniquePtr<char> canonical_target =
grpc_core::ResolverRegistry::AddDefaultPrefixIfNeeded(target);
grpc_arg arg = grpc_channel_arg_string_create((char*)GRPC_ARG_SERVER_URI,
canonical_target.get());
const char* to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args* new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
gpr_free(arg.value.string);
grpc_channel* channel =
grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
grpc_channel_args_destroy(new_args);

@ -161,13 +161,13 @@ static grpc_channel* client_channel_factory_create_channel(
return nullptr;
}
// Add channel arg containing the server URI.
grpc_arg arg = grpc_channel_arg_string_create(
(char*)GRPC_ARG_SERVER_URI,
grpc_resolver_factory_add_default_prefix_if_needed(target));
grpc_core::UniquePtr<char> canonical_target =
grpc_core::ResolverRegistry::AddDefaultPrefixIfNeeded(target);
grpc_arg arg = grpc_channel_arg_string_create((char*)GRPC_ARG_SERVER_URI,
canonical_target.get());
const char* to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args* new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
gpr_free(arg.value.string);
grpc_channel* channel =
grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
grpc_channel_args_destroy(new_args);

@ -28,7 +28,6 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"

@ -30,7 +30,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/frame_data.h"
#include "src/core/ext/transport/chttp2/transport/internal.h"
@ -1668,6 +1667,7 @@ static void retry_initiate_ping_locked(void* tp, grpc_error* error) {
if (error == GRPC_ERROR_NONE) {
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING);
}
GRPC_CHTTP2_UNREF_TRANSPORT(t, "retry_initiate_ping_locked");
}
void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {

@ -26,7 +26,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/lib/gpr/string.h"

@ -22,8 +22,8 @@
#include <grpc/support/port_platform.h>
#include <stdint.h>
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/abstract.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/transport/bdp_estimator.h"

@ -23,7 +23,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/slice/slice_internal.h"

@ -24,7 +24,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/ext/transport/chttp2/transport/frame.h"

@ -28,7 +28,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
#include "src/core/ext/transport/chttp2/transport/hpack_table.h"

@ -27,7 +27,6 @@
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
#include "src/core/lib/debug/stats.h"

@ -20,7 +20,7 @@
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/transport/http2_errors.h"
const uint16_t grpc_setting_id_to_wire_id[] = {1, 2, 3, 4, 5, 6, 65027};

@ -22,7 +22,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map,
size_t initial_capacity) {

@ -88,6 +88,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
}
if (!t->ping_state.is_delayed_ping_timer_set) {
t->ping_state.is_delayed_ping_timer_set = true;
GRPC_CHTTP2_REF_TRANSPORT(t, "retry_initiate_ping_locked");
grpc_timer_init(&t->ping_state.delayed_ping_timer, next_allowed_ping,
&t->retry_initiate_ping_locked);
}

@ -23,7 +23,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/incoming_metadata.h"
#include "src/core/ext/transport/cronet/transport/cronet_transport.h"

@ -16,30 +16,31 @@
*
*/
#include <grpc/support/avl.h>
#include "src/core/lib/avl/avl.h"
#include <assert.h>
#include <stdlib.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
gpr_avl gpr_avl_create(const gpr_avl_vtable* vtable) {
gpr_avl out;
#include "src/core/lib/gpr/useful.h"
grpc_avl grpc_avl_create(const grpc_avl_vtable* vtable) {
grpc_avl out;
out.vtable = vtable;
out.root = nullptr;
return out;
}
static gpr_avl_node* ref_node(gpr_avl_node* node) {
static grpc_avl_node* ref_node(grpc_avl_node* node) {
if (node) {
gpr_ref(&node->refs);
}
return node;
}
static void unref_node(const gpr_avl_vtable* vtable, gpr_avl_node* node,
static void unref_node(const grpc_avl_vtable* vtable, grpc_avl_node* node,
void* user_data) {
if (node == nullptr) {
return;
@ -53,18 +54,18 @@ static void unref_node(const gpr_avl_vtable* vtable, gpr_avl_node* node,
}
}
static long node_height(gpr_avl_node* node) {
static long node_height(grpc_avl_node* node) {
return node == nullptr ? 0 : node->height;
}
#ifndef NDEBUG
static long calculate_height(gpr_avl_node* node) {
static long calculate_height(grpc_avl_node* node) {
return node == nullptr ? 0
: 1 + GPR_MAX(calculate_height(node->left),
calculate_height(node->right));
}
static gpr_avl_node* assert_invariants(gpr_avl_node* n) {
static grpc_avl_node* assert_invariants(grpc_avl_node* n) {
if (n == nullptr) return nullptr;
assert_invariants(n->left);
assert_invariants(n->right);
@ -73,12 +74,12 @@ static gpr_avl_node* assert_invariants(gpr_avl_node* n) {
return n;
}
#else
static gpr_avl_node* assert_invariants(gpr_avl_node* n) { return n; }
static grpc_avl_node* assert_invariants(grpc_avl_node* n) { return n; }
#endif
gpr_avl_node* new_node(void* key, void* value, gpr_avl_node* left,
gpr_avl_node* right) {
gpr_avl_node* node = (gpr_avl_node*)gpr_malloc(sizeof(*node));
grpc_avl_node* new_node(void* key, void* value, grpc_avl_node* left,
grpc_avl_node* right) {
grpc_avl_node* node = (grpc_avl_node*)gpr_malloc(sizeof(*node));
gpr_ref_init(&node->refs, 1);
node->key = key;
node->value = value;
@ -88,8 +89,8 @@ gpr_avl_node* new_node(void* key, void* value, gpr_avl_node* left,
return node;
}
static gpr_avl_node* get(const gpr_avl_vtable* vtable, gpr_avl_node* node,
void* key, void* user_data) {
static grpc_avl_node* get(const grpc_avl_vtable* vtable, grpc_avl_node* node,
void* key, void* user_data) {
long cmp;
if (node == nullptr) {
@ -106,13 +107,13 @@ static gpr_avl_node* get(const gpr_avl_vtable* vtable, gpr_avl_node* node,
}
}
void* gpr_avl_get(gpr_avl avl, void* key, void* user_data) {
gpr_avl_node* node = get(avl.vtable, avl.root, key, user_data);
void* grpc_avl_get(grpc_avl avl, void* key, void* user_data) {
grpc_avl_node* node = get(avl.vtable, avl.root, key, user_data);
return node ? node->value : nullptr;
}
int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value, void* user_data) {
gpr_avl_node* node = get(avl.vtable, avl.root, key, user_data);
int grpc_avl_maybe_get(grpc_avl avl, void* key, void** value, void* user_data) {
grpc_avl_node* node = get(avl.vtable, avl.root, key, user_data);
if (node != nullptr) {
*value = node->value;
return 1;
@ -120,21 +121,21 @@ int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value, void* user_data) {
return 0;
}
static gpr_avl_node* rotate_left(const gpr_avl_vtable* vtable, void* key,
void* value, gpr_avl_node* left,
gpr_avl_node* right, void* user_data) {
gpr_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));
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) {
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));
unref_node(vtable, right, user_data);
return n;
}
static gpr_avl_node* rotate_right(const gpr_avl_vtable* vtable, void* key,
void* value, gpr_avl_node* left,
gpr_avl_node* right, void* user_data) {
gpr_avl_node* 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) {
grpc_avl_node* n =
new_node(vtable->copy_key(left->key, user_data),
vtable->copy_value(left->value, user_data), ref_node(left->left),
new_node(key, value, ref_node(left->right), right));
@ -142,11 +143,12 @@ static gpr_avl_node* rotate_right(const gpr_avl_vtable* vtable, void* key,
return n;
}
static gpr_avl_node* rotate_left_right(const gpr_avl_vtable* vtable, void* key,
void* value, gpr_avl_node* left,
gpr_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) */
gpr_avl_node* n =
grpc_avl_node* n =
new_node(vtable->copy_key(left->right->key, user_data),
vtable->copy_value(left->right->value, user_data),
new_node(vtable->copy_key(left->key, user_data),
@ -157,11 +159,12 @@ static gpr_avl_node* rotate_left_right(const gpr_avl_vtable* vtable, void* key,
return n;
}
static gpr_avl_node* rotate_right_left(const gpr_avl_vtable* vtable, void* key,
void* value, gpr_avl_node* left,
gpr_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)) */
gpr_avl_node* n =
grpc_avl_node* n =
new_node(vtable->copy_key(right->left->key, user_data),
vtable->copy_value(right->left->value, user_data),
new_node(key, value, left, ref_node(right->left->left)),
@ -172,9 +175,9 @@ static gpr_avl_node* rotate_right_left(const gpr_avl_vtable* vtable, void* key,
return n;
}
static gpr_avl_node* rebalance(const gpr_avl_vtable* vtable, void* key,
void* value, gpr_avl_node* left,
gpr_avl_node* right, void* user_data) {
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) {
switch (node_height(left) - node_height(right)) {
case 2:
if (node_height(left->left) - node_height(left->right) == -1) {
@ -197,8 +200,9 @@ static gpr_avl_node* rebalance(const gpr_avl_vtable* vtable, void* key,
}
}
static gpr_avl_node* add_key(const gpr_avl_vtable* vtable, gpr_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);
@ -219,31 +223,31 @@ static gpr_avl_node* add_key(const gpr_avl_vtable* vtable, gpr_avl_node* node,
}
}
gpr_avl gpr_avl_add(gpr_avl avl, void* key, void* value, void* user_data) {
gpr_avl_node* old_root = avl.root;
grpc_avl grpc_avl_add(grpc_avl avl, void* key, void* value, void* user_data) {
grpc_avl_node* old_root = avl.root;
avl.root = add_key(avl.vtable, avl.root, key, value, user_data);
assert_invariants(avl.root);
unref_node(avl.vtable, old_root, user_data);
return avl;
}
static gpr_avl_node* in_order_head(gpr_avl_node* node) {
static grpc_avl_node* in_order_head(grpc_avl_node* node) {
while (node->left != nullptr) {
node = node->left;
}
return node;
}
static gpr_avl_node* in_order_tail(gpr_avl_node* node) {
static grpc_avl_node* in_order_tail(grpc_avl_node* node) {
while (node->right != nullptr) {
node = node->right;
}
return node;
}
static gpr_avl_node* remove_key(const gpr_avl_vtable* vtable,
gpr_avl_node* node, void* key,
void* user_data) {
static grpc_avl_node* remove_key(const grpc_avl_vtable* vtable,
grpc_avl_node* node, void* key,
void* user_data) {
long cmp;
if (node == nullptr) {
return nullptr;
@ -255,13 +259,13 @@ static gpr_avl_node* remove_key(const gpr_avl_vtable* vtable,
} else if (node->right == nullptr) {
return ref_node(node->left);
} else if (node->left->height < node->right->height) {
gpr_avl_node* h = in_order_head(node->right);
grpc_avl_node* h = in_order_head(node->right);
return rebalance(
vtable, vtable->copy_key(h->key, user_data),
vtable->copy_value(h->value, user_data), ref_node(node->left),
remove_key(vtable, node->right, h->key, user_data), user_data);
} else {
gpr_avl_node* h = in_order_tail(node->left);
grpc_avl_node* h = in_order_tail(node->left);
return rebalance(vtable, vtable->copy_key(h->key, user_data),
vtable->copy_value(h->value, user_data),
remove_key(vtable, node->left, h->key, user_data),
@ -280,21 +284,21 @@ static gpr_avl_node* remove_key(const gpr_avl_vtable* vtable,
}
}
gpr_avl gpr_avl_remove(gpr_avl avl, void* key, void* user_data) {
gpr_avl_node* old_root = avl.root;
grpc_avl grpc_avl_remove(grpc_avl avl, void* key, void* user_data) {
grpc_avl_node* old_root = avl.root;
avl.root = remove_key(avl.vtable, avl.root, key, user_data);
assert_invariants(avl.root);
unref_node(avl.vtable, old_root, user_data);
return avl;
}
gpr_avl gpr_avl_ref(gpr_avl avl, void* user_data) {
grpc_avl grpc_avl_ref(grpc_avl avl, void* user_data) {
ref_node(avl.root);
return avl;
}
void gpr_avl_unref(gpr_avl avl, void* user_data) {
void grpc_avl_unref(grpc_avl avl, void* user_data) {
unref_node(avl.vtable, avl.root, user_data);
}
int gpr_avl_is_empty(gpr_avl avl) { return avl.root == nullptr; }
int grpc_avl_is_empty(grpc_avl avl) { return avl.root == nullptr; }

@ -16,31 +16,27 @@
*
*/
#ifndef GRPC_SUPPORT_AVL_H
#define GRPC_SUPPORT_AVL_H
#ifndef GRPC_CORE_LIB_AVL_AVL_H
#define GRPC_CORE_LIB_AVL_AVL_H
#include <grpc/support/sync.h>
#ifdef __cplusplus
extern "C" {
#endif
/** internal node of an AVL tree */
typedef struct gpr_avl_node {
typedef struct grpc_avl_node {
gpr_refcount refs;
void* key;
void* value;
struct gpr_avl_node* left;
struct gpr_avl_node* right;
struct grpc_avl_node* left;
struct grpc_avl_node* right;
long height;
} gpr_avl_node;
} grpc_avl_node;
/** vtable for the AVL tree
* The optional user_data is propagated from the top level gpr_avl_XXX API.
* The optional user_data is propagated from the top level grpc_avl_XXX API.
* From the same API call, multiple vtable functions may be called multiple
* times.
*/
typedef struct gpr_avl_vtable {
typedef struct grpc_avl_vtable {
/** destroy a key */
void (*destroy_key)(void* key, void* user_data);
/** copy a key, returning new value */
@ -52,51 +48,45 @@ typedef struct gpr_avl_vtable {
void (*destroy_value)(void* value, void* user_data);
/** copy a value */
void* (*copy_value)(void* value, void* user_data);
} gpr_avl_vtable;
} grpc_avl_vtable;
/** "pointer" to an AVL tree - this is a reference
counted object - use gpr_avl_ref to add a reference,
gpr_avl_unref when done with a reference */
typedef struct gpr_avl {
const gpr_avl_vtable* vtable;
gpr_avl_node* root;
} gpr_avl;
counted object - use grpc_avl_ref to add a reference,
grpc_avl_unref when done with a reference */
typedef struct grpc_avl {
const grpc_avl_vtable* vtable;
grpc_avl_node* root;
} grpc_avl;
/** Create an immutable AVL tree. */
GPRAPI gpr_avl gpr_avl_create(const gpr_avl_vtable* vtable);
grpc_avl grpc_avl_create(const grpc_avl_vtable* vtable);
/** Add a reference to an existing tree - returns
the tree as a convenience. The optional user_data will be passed to vtable
functions. */
GPRAPI gpr_avl gpr_avl_ref(gpr_avl avl, void* user_data);
grpc_avl grpc_avl_ref(grpc_avl avl, void* user_data);
/** Remove a reference to a tree - destroying it if there
are no references left. The optional user_data will be passed to vtable
functions. */
GPRAPI void gpr_avl_unref(gpr_avl avl, void* user_data);
void grpc_avl_unref(grpc_avl avl, void* user_data);
/** Return a new tree with (key, value) added to avl.
implicitly unrefs avl to allow easy chaining.
if key exists in avl, the new tree's key entry updated
(i.e. a duplicate is not created). The optional user_data will be passed to
vtable functions. */
GPRAPI gpr_avl gpr_avl_add(gpr_avl avl, void* key, void* value,
void* user_data);
grpc_avl grpc_avl_add(grpc_avl avl, void* key, void* value, void* user_data);
/** Return a new tree with key deleted
implicitly unrefs avl to allow easy chaining. The optional user_data will be
passed to vtable functions. */
GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void* key, void* user_data);
grpc_avl grpc_avl_remove(grpc_avl avl, void* key, void* user_data);
/** Lookup key, and return the associated value.
Does not mutate avl.
Returns NULL if key is not found. The optional user_data will be passed to
vtable functions.*/
GPRAPI void* gpr_avl_get(gpr_avl avl, void* key, void* user_data);
void* grpc_avl_get(grpc_avl avl, void* key, void* user_data);
/** Return 1 if avl contains key, 0 otherwise; if it has the key, sets *value to
its value. THe optional user_data will be passed to vtable functions. */
GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value,
void* user_data);
its value. The optional user_data will be passed to vtable functions. */
int grpc_avl_maybe_get(grpc_avl avl, void* key, void** value, void* user_data);
/** Return 1 if avl is empty, 0 otherwise */
GPRAPI int gpr_avl_is_empty(gpr_avl avl);
#ifdef __cplusplus
}
#endif
int grpc_avl_is_empty(grpc_avl avl);
#endif /* GRPC_SUPPORT_AVL_H */
#endif /* GRPC_CORE_LIB_AVL_AVL_H */

@ -20,7 +20,7 @@
#include <algorithm>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
namespace grpc_core {

@ -26,10 +26,10 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
static grpc_arg copy_arg(const grpc_arg* src) {
grpc_arg dst;

@ -20,10 +20,10 @@
#include <string.h>
#include <grpc/compression.h>
#include <grpc/support/useful.h>
#include "src/core/lib/compression/algorithm_metadata.h"
#include "src/core/lib/compression/compression_internal.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/transport/static_metadata.h"

@ -20,10 +20,10 @@
#include <string.h>
#include <grpc/compression.h>
#include <grpc/support/useful.h>
#include "src/core/lib/compression/algorithm_metadata.h"
#include "src/core/lib/compression/compression_internal.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/transport/static_metadata.h"

@ -23,9 +23,9 @@
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
grpc_stats_data* grpc_stats_per_cpu_storage = nullptr;
static size_t g_num_cores;

@ -19,9 +19,10 @@
*/
#include "src/core/lib/debug/stats_data.h"
#include <grpc/support/useful.h>
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
const char* grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = {
"client_calls_created",
"server_calls_created",

@ -23,7 +23,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
// TODO(roth): We currently assume that all callers need alignment of 16
// bytes, which may be wrong in some cases. As part of converting the

@ -17,7 +17,8 @@
*/
#include <grpc/support/atm.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
gpr_atm gpr_atm_no_barrier_clamped_add(gpr_atm* value, gpr_atm delta,
gpr_atm min, gpr_atm max) {

@ -29,7 +29,8 @@
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
static long ncpus = 0;

@ -34,9 +34,9 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
const char* gpr_getenv_silent(const char* name, char** dst) {
const char* insecure_func_used = nullptr;

@ -22,14 +22,14 @@
#include <windows.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/string_windows.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/string_windows.h"
const char* gpr_getenv_silent(const char* name, char** dst) {
*dst = gpr_getenv(name);
return NULL;

@ -21,9 +21,9 @@
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/useful.h"
/*
* NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK

@ -28,7 +28,8 @@
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
char* gpr_strdup(const char* src) {
char* dst;

@ -26,12 +26,12 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include "src/core/lib/gpr/fork.h"
#include "src/core/lib/gpr/useful.h"
static gpr_mu g_mu;
static gpr_cv g_cv;

@ -16,8 +16,8 @@
*
*/
#ifndef GRPC_SUPPORT_TLS_H
#define GRPC_SUPPORT_TLS_H
#ifndef GRPC_CORE_LIB_GPR_TLS_H
#define GRPC_CORE_LIB_GPR_TLS_H
#include <grpc/support/port_platform.h>
@ -54,15 +54,15 @@
ALL functions here may be implemented as macros. */
#ifdef GPR_GCC_TLS
#include <grpc/support/tls_gcc.h>
#include "src/core/lib/gpr/tls_gcc.h"
#endif
#ifdef GPR_MSVC_TLS
#include <grpc/support/tls_msvc.h>
#include "src/core/lib/gpr/tls_msvc.h"
#endif
#ifdef GPR_PTHREAD_TLS
#include <grpc/support/tls_pthread.h>
#include "src/core/lib/gpr/tls_pthread.h"
#endif
#endif /* GRPC_SUPPORT_TLS_H */
#endif /* GRPC_CORE_LIB_GPR_TLS_H */

@ -16,8 +16,8 @@
*
*/
#ifndef GRPC_SUPPORT_TLS_GCC_H
#define GRPC_SUPPORT_TLS_GCC_H
#ifndef GRPC_CORE_LIB_GPR_TLS_GCC_H
#define GRPC_CORE_LIB_GPR_TLS_GCC_H
#include <stdbool.h>
@ -47,4 +47,4 @@ struct gpr_gcc_thread_local {
#define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
#define gpr_tls_get(tls) ((tls)->value)
#endif /* GRPC_SUPPORT_TLS_GCC_H */
#endif /* GRPC_CORE_LIB_GPR_TLS_GCC_H */

@ -16,8 +16,8 @@
*
*/
#ifndef GRPC_SUPPORT_TLS_MSVC_H
#define GRPC_SUPPORT_TLS_MSVC_H
#ifndef GRPC_CORE_LIB_GPR_TLS_MSVC_H
#define GRPC_CORE_LIB_GPR_TLS_MSVC_H
/** Thread local storage based on ms visual c compiler primitives.
#include tls.h to use this - and see that file for documentation */
@ -47,4 +47,4 @@ struct gpr_msvc_thread_local {
#define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
#define gpr_tls_get(tls) ((tls)->value)
#endif /* GRPC_SUPPORT_TLS_MSVC_H */
#endif /* GRPC_CORE_LIB_GPR_TLS_MSVC_H */

@ -20,7 +20,7 @@
#ifdef GPR_PTHREAD_TLS
#include <grpc/support/tls.h>
#include "src/core/lib/gpr/tls.h"
intptr_t gpr_tls_set(struct gpr_pthread_thread_local* tls, intptr_t value) {
GPR_ASSERT(0 == pthread_setspecific(tls->key, (void*)value));

@ -16,8 +16,8 @@
*
*/
#ifndef GRPC_SUPPORT_TLS_PTHREAD_H
#define GRPC_SUPPORT_TLS_PTHREAD_H
#ifndef GRPC_CORE_LIB_GPR_TLS_PTHREAD_H
#define GRPC_CORE_LIB_GPR_TLS_PTHREAD_H
#include <grpc/support/log.h> /* for GPR_ASSERT */
#include <pthread.h>
@ -51,4 +51,4 @@ intptr_t gpr_tls_set(struct gpr_pthread_thread_local* tls, intptr_t value);
}
#endif
#endif /* GRPC_SUPPORT_TLS_PTHREAD_H */
#endif /* GRPC_CORE_LIB_GPR_TLS_PTHREAD_H */

@ -16,8 +16,8 @@
*
*/
#ifndef GRPC_SUPPORT_USEFUL_H
#define GRPC_SUPPORT_USEFUL_H
#ifndef GRPC_CORE_LIB_GPR_USEFUL_H
#define GRPC_CORE_LIB_GPR_USEFUL_H
/** useful macros that don't belong anywhere else */
@ -62,4 +62,4 @@
#define GPR_HASH_POINTER(x, range) \
((((size_t)x) >> 4) ^ (((size_t)x) >> 9) ^ (((size_t)x) >> 14)) % (range)
#endif /* GRPC_SUPPORT_USEFUL_H */
#endif /* GRPC_CORE_LIB_GPR_USEFUL_H */

@ -25,7 +25,6 @@
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/string.h"
static void fill_common_header(const grpc_httpcli_request* request,

@ -23,7 +23,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"

@ -23,7 +23,8 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
grpc_core::TraceFlag grpc_http1_trace(false, "http1");

@ -26,13 +26,13 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#ifdef GPR_WINDOWS
#include <grpc/support/log_windows.h>
#endif
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/error_internal.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"

@ -39,11 +39,11 @@
#include <grpc/support/alloc.h>
#include <grpc/support/cpu.h>
#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/block_annotate.h"
#include "src/core/lib/iomgr/ev_posix.h"

@ -37,11 +37,11 @@
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/spinlock.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/block_annotate.h"
#include "src/core/lib/iomgr/iomgr_internal.h"

@ -39,10 +39,10 @@
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/block_annotate.h"
#include "src/core/lib/iomgr/ev_posix.h"

@ -34,11 +34,11 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/thd.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/murmur_hash.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/block_annotate.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/wakeup_fd_cv.h"

@ -27,10 +27,10 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/ev_epoll1_linux.h"
#include "src/core/lib/iomgr/ev_epollex_linux.h"
#include "src/core/lib/iomgr/ev_epollsig_linux.h"

@ -22,8 +22,8 @@
#include <grpc/support/atm.h>
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
#include <grpc/support/tls.h>
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/iomgr/closure.h"
typedef gpr_atm grpc_millis;

@ -25,11 +25,11 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/spinlock.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#define MAX_DEPTH 2

@ -25,7 +25,6 @@
#include <grpc/fork.h>
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/fork.h"

@ -27,7 +27,6 @@
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/iomgr/iocp_windows.h"

@ -29,10 +29,10 @@
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr_internal.h"

@ -31,10 +31,10 @@
#include <grpc/support/string_util.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.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"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr_internal.h"

@ -24,9 +24,9 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.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"
#include "src/core/lib/iomgr/exec_ctx.h"

@ -27,8 +27,8 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/combiner.h"
grpc_core::TraceFlag grpc_resource_quota_trace(false, "resource_quota");

@ -21,11 +21,11 @@
#ifdef GRPC_POSIX_SOCKET
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/socket_factory_posix.h"
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
void grpc_socket_factory_init(grpc_socket_factory* factory,
const grpc_socket_factory_vtable* vtable) {

@ -18,11 +18,11 @@
#include "src/core/lib/iomgr/socket_mutator.h"
#include "src/core/lib/channel/channel_args.h"
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/useful.h"
void grpc_socket_mutator_init(grpc_socket_mutator* mutator,
const grpc_socket_mutator_vtable* vtable) {

@ -28,7 +28,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
#include <grpc/support/useful.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/iomgr/iocp_windows.h"

@ -37,12 +37,12 @@
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/profiling/timers.h"

@ -42,7 +42,6 @@
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"

@ -30,8 +30,8 @@
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/iocp_windows.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"

@ -29,10 +29,11 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/spinlock.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/time_averaged_stats.h"
#include "src/core/lib/iomgr/timer_heap.h"

@ -25,7 +25,8 @@
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
/* Adjusts a heap so as to move a hole at position i closer to the root,
until a suitable position is found for element t. Then, copies t into that

@ -30,7 +30,8 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
#include "src/core/lib/gpr/useful.h"
void grpc_create_socketpair_if_unix(int sv[2]) {
GPR_ASSERT(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save