Merge branch 'master' into schedtorun

pull/20749/head
Yash Tibrewal 5 years ago
commit 11351f8d43
  1. 2
      BUILD
  2. 202
      CMakeLists.txt
  3. BIN
      doc/grpc_security_audit.pdf
  4. 4
      doc/security_audit.md
  5. 14
      src/core/ext/filters/client_channel/http_proxy.cc
  6. 6
      src/core/ext/filters/client_channel/lb_policy.cc
  7. 10
      src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc
  8. 10
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  9. 2
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
  10. 4
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
  11. 4
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  12. 7
      src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
  13. 202
      src/core/ext/filters/client_channel/lb_policy/xds/xds.cc
  14. 10
      src/core/ext/filters/client_channel/local_subchannel_pool.cc
  15. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  16. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc
  17. 6
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
  18. 12
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  19. 10
      src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
  20. 4
      src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
  21. 3
      src/core/ext/filters/client_channel/resolving_lb_policy.cc
  22. 2
      src/core/ext/filters/client_channel/resolving_lb_policy.h
  23. 10
      src/core/ext/filters/client_channel/retry_throttle.cc
  24. 4
      src/core/ext/filters/client_channel/service_config.h
  25. 8
      src/core/ext/filters/client_channel/xds/xds_api.cc
  26. 19
      src/core/ext/filters/client_channel/xds/xds_client.cc
  27. 11
      src/core/ext/filters/client_channel/xds/xds_client.h
  28. 8
      src/core/ext/filters/message_size/message_size_filter.cc
  29. 12
      src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
  30. 4
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  31. 30
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  32. 9
      src/core/ext/transport/chttp2/transport/frame_data.cc
  33. 4
      src/core/ext/transport/chttp2/transport/frame_goaway.cc
  34. 2
      src/core/ext/transport/chttp2/transport/frame_ping.cc
  35. 2
      src/core/ext/transport/chttp2/transport/frame_settings.cc
  36. 10
      src/core/ext/transport/chttp2/transport/hpack_encoder.cc
  37. 19
      src/core/ext/transport/chttp2/transport/hpack_parser.cc
  38. 5
      src/core/lib/debug/trace.h
  39. 4
      src/core/lib/gprpp/memory.h
  40. 23
      src/core/lib/gprpp/ref_counted.h
  41. 2
      src/core/lib/http/httpcli.cc
  42. 14
      src/core/lib/http/httpcli_security_connector.cc
  43. 2
      src/core/lib/http/parser.cc
  44. 9
      src/core/lib/iomgr/buffer_list.cc
  45. 2
      src/core/lib/iomgr/buffer_list.h
  46. 2
      src/core/lib/iomgr/combiner.cc
  47. 34
      src/core/lib/iomgr/ev_epoll1_linux.cc
  48. 28
      src/core/lib/iomgr/ev_epollex_linux.cc
  49. 27
      src/core/lib/iomgr/ev_poll_posix.cc
  50. 3
      src/core/lib/iomgr/executor/threadpool.cc
  51. 5
      src/core/lib/iomgr/executor/threadpool.h
  52. 2
      src/core/lib/iomgr/iomgr_custom.cc
  53. 8
      src/core/lib/iomgr/pollset_custom.cc
  54. 18
      src/core/lib/iomgr/pollset_set_custom.cc
  55. 2
      src/core/lib/iomgr/resolve_address_custom.cc
  56. 4
      src/core/lib/iomgr/resolve_address_posix.cc
  57. 18
      src/core/lib/iomgr/resource_quota.cc
  58. 11
      src/core/lib/iomgr/socket_utils_common_posix.cc
  59. 2
      src/core/lib/iomgr/tcp_client_custom.cc
  60. 8
      src/core/lib/iomgr/tcp_custom.cc
  61. 15
      src/core/lib/iomgr/tcp_posix.cc
  62. 10
      src/core/lib/iomgr/tcp_server_custom.cc
  63. 2
      src/core/lib/iomgr/tcp_server_posix.cc
  64. 4
      src/core/lib/iomgr/timer_custom.cc
  65. 5
      src/core/lib/iomgr/udp_server.cc
  66. 4
      src/core/lib/profiling/basic_timers.cc
  67. 4
      src/core/lib/security/credentials/alts/alts_credentials.cc
  68. 2
      src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc
  69. 8
      src/core/lib/security/credentials/fake/fake_credentials.cc
  70. 2
      src/core/lib/security/security_connector/load_system_roots_linux.cc
  71. 7
      src/core/lib/transport/metadata.h
  72. 2
      src/core/lib/transport/status_conversion.cc
  73. 2
      src/core/lib/transport/status_metadata.cc
  74. 4
      src/core/lib/transport/transport.cc
  75. 5
      src/core/lib/transport/transport.h
  76. 2
      src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc
  77. 2
      src/core/tsi/alts/handshaker/alts_shared_resource.cc
  78. 10
      src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
  79. 11
      src/core/tsi/fake_transport_security.cc
  80. 11
      src/core/tsi/local_transport_security.cc
  81. 12
      src/core/tsi/ssl/session_cache/ssl_session_cache.cc
  82. 19
      src/core/tsi/ssl_transport_security.cc
  83. 2
      src/cpp/client/channel_cc.cc
  84. 4
      src/cpp/client/client_context.cc
  85. 35
      src/cpp/common/alarm.cc
  86. 6
      src/cpp/server/channel_argument_option.cc
  87. 2
      src/cpp/server/health/health_check_service_server_builder_option.cc
  88. 3
      src/cpp/server/server_context.cc
  89. 896
      src/objective-c/BoringSSL-GRPC.podspec
  90. 367
      src/python/grpcio/grpc/_channel.py
  91. 2
      src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi
  92. 11
      src/python/grpcio/grpc/experimental/__init__.py
  93. 30
      src/python/grpcio_tests/tests/stress/BUILD.bazel
  94. 27
      src/python/grpcio_tests/tests/stress/unary_stream_benchmark.proto
  95. 104
      src/python/grpcio_tests/tests/stress/unary_stream_benchmark.py
  96. 1
      src/python/grpcio_tests/tests/unit/BUILD.bazel
  97. 13
      src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py
  98. 6
      src/python/grpcio_tests/tests/unit/_metadata_flags_test.py
  99. 3
      src/python/grpcio_tests/tests/unit/_metadata_test.py
  100. 30
      templates/CMakeLists.txt.template
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1392,6 +1392,7 @@ grpc_cc_library(
"grpc++_base",
"grpc_secure",
],
alwayslink = 1,
)
grpc_cc_library(
@ -1438,7 +1439,6 @@ grpc_cc_library(
"lb_server_load_reporting_filter",
"lb_server_load_reporting_service_server_builder_plugin",
],
alwayslink = 1,
)
grpc_cc_library(

@ -23,12 +23,17 @@
cmake_minimum_required(VERSION 3.5.1)
set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "1.25.0-dev")
set(gRPC_CORE_VERSION "8.0.0")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "1.25.0-dev")
set(gRPC_CORE_VERSION "8.0.0")
set(gRPC_CORE_SOVERSION "8")
set(gRPC_CPP_VERSION "1.25.0-dev")
set(gRPC_CPP_SOVERSION "1")
set(gRPC_CSHARP_VERSION "2.25.0-dev")
set(gRPC_CSHARP_SOVERSION "2")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
project(${PACKAGE_NAME} LANGUAGES C CXX)
set(gRPC_INSTALL_BINDIR "bin" CACHE STRING "Installation directory for executables")
@ -769,6 +774,11 @@ add_library(address_sorting
third_party/address_sorting/address_sorting_windows.c
)
set_target_properties(address_sorting PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(address_sorting PROPERTIES COMPILE_PDB_NAME "address_sorting"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -817,6 +827,11 @@ add_library(alts_test_util
test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.cc
)
set_target_properties(alts_test_util PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(alts_test_util PROPERTIES COMPILE_PDB_NAME "alts_test_util"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -895,6 +910,11 @@ add_library(gpr
src/core/lib/profiling/stap_timers.cc
)
set_target_properties(gpr PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(gpr PROPERTIES COMPILE_PDB_NAME "gpr"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -1361,6 +1381,11 @@ add_library(grpc
src/core/plugin_registry/grpc_plugin_registry.cc
)
set_target_properties(grpc PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc PROPERTIES COMPILE_PDB_NAME "grpc"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -1776,6 +1801,11 @@ add_library(grpc_cronet
src/core/tsi/transport_security_grpc.cc
)
set_target_properties(grpc_cronet PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_cronet PROPERTIES COMPILE_PDB_NAME "grpc_cronet"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -2127,6 +2157,11 @@ add_library(grpc_test_util
src/core/ext/filters/http/server/http_server_filter.cc
)
set_target_properties(grpc_test_util PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_test_util PROPERTIES COMPILE_PDB_NAME "grpc_test_util"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -2475,6 +2510,11 @@ add_library(grpc_test_util_unsecure
src/core/ext/filters/http/server/http_server_filter.cc
)
set_target_properties(grpc_test_util_unsecure PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_test_util_unsecure PROPERTIES COMPILE_PDB_NAME "grpc_test_util_unsecure"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -2865,6 +2905,11 @@ add_library(grpc_unsecure
src/core/plugin_registry/grpc_unsecure_plugin_registry.cc
)
set_target_properties(grpc_unsecure PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_unsecure PROPERTIES COMPILE_PDB_NAME "grpc_unsecure"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -2962,6 +3007,11 @@ add_library(reconnect_server
test/core/util/reconnect_server.cc
)
set_target_properties(reconnect_server PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(reconnect_server PROPERTIES COMPILE_PDB_NAME "reconnect_server"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3004,6 +3054,11 @@ add_library(test_tcp_server
test/core/util/test_tcp_server.cc
)
set_target_properties(test_tcp_server PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(test_tcp_server PROPERTIES COMPILE_PDB_NAME "test_tcp_server"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3051,6 +3106,11 @@ add_library(bm_callback_test_service_impl
test/cpp/microbenchmarks/callback_test_service.cc
)
set_target_properties(bm_callback_test_service_impl PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(bm_callback_test_service_impl PROPERTIES COMPILE_PDB_NAME "bm_callback_test_service_impl"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3108,6 +3168,11 @@ add_library(dns_test_util
test/cpp/naming/dns_test_util.cc
)
set_target_properties(dns_test_util PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(dns_test_util PROPERTIES COMPILE_PDB_NAME "dns_test_util"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3204,6 +3269,11 @@ add_library(grpc++
src/cpp/codegen/codegen_init.cc
)
set_target_properties(grpc++ PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++ PROPERTIES COMPILE_PDB_NAME "grpc++"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3531,6 +3601,11 @@ add_library(grpc++_core_stats
src/cpp/util/core_stats.cc
)
set_target_properties(grpc++_core_stats PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_core_stats PROPERTIES COMPILE_PDB_NAME "grpc++_core_stats"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3585,6 +3660,11 @@ add_library(grpc++_error_details
src/cpp/util/error_details.cc
)
set_target_properties(grpc++_error_details PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_error_details PROPERTIES COMPILE_PDB_NAME "grpc++_error_details"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3657,6 +3737,11 @@ add_library(grpc++_proto_reflection_desc_db
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h
)
set_target_properties(grpc++_proto_reflection_desc_db PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_proto_reflection_desc_db PROPERTIES COMPILE_PDB_NAME "grpc++_proto_reflection_desc_db"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3723,6 +3808,11 @@ add_library(grpc++_reflection
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h
)
set_target_properties(grpc++_reflection PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_reflection PROPERTIES COMPILE_PDB_NAME "grpc++_reflection"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3790,6 +3880,11 @@ add_library(grpc++_test_config
test/cpp/util/test_config_cc.cc
)
set_target_properties(grpc++_test_config PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_test_config PROPERTIES COMPILE_PDB_NAME "grpc++_test_config"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3869,6 +3964,11 @@ add_library(grpc++_test_util
src/cpp/codegen/codegen_init.cc
)
set_target_properties(grpc++_test_util PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_test_util PROPERTIES COMPILE_PDB_NAME "grpc++_test_util"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4082,6 +4182,11 @@ add_library(grpc++_test_util_unsecure
src/cpp/codegen/codegen_init.cc
)
set_target_properties(grpc++_test_util_unsecure PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_test_util_unsecure PROPERTIES COMPILE_PDB_NAME "grpc++_test_util_unsecure"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4309,6 +4414,11 @@ add_library(grpc++_unsecure
src/cpp/codegen/codegen_init.cc
)
set_target_properties(grpc++_unsecure PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_unsecure PROPERTIES COMPILE_PDB_NAME "grpc++_unsecure"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4624,6 +4734,11 @@ add_library(grpc_benchmark
test/cpp/microbenchmarks/helpers.cc
)
set_target_properties(grpc_benchmark PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_benchmark PROPERTIES COMPILE_PDB_NAME "grpc_benchmark"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4682,6 +4797,11 @@ add_library(grpc_cli_libs
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h
)
set_target_properties(grpc_cli_libs PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_cli_libs PROPERTIES COMPILE_PDB_NAME "grpc_cli_libs"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4749,6 +4869,11 @@ add_library(grpc_plugin_support
src/compiler/ruby_generator.cc
)
set_target_properties(grpc_plugin_support PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_plugin_support PROPERTIES COMPILE_PDB_NAME "grpc_plugin_support"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4813,6 +4938,11 @@ add_library(grpcpp_channelz
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.h
)
set_target_properties(grpcpp_channelz PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpcpp_channelz PROPERTIES COMPILE_PDB_NAME "grpcpp_channelz"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4892,6 +5022,11 @@ add_library(http2_client_main
test/cpp/interop/http2_client.cc
)
set_target_properties(http2_client_main PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(http2_client_main PROPERTIES COMPILE_PDB_NAME "http2_client_main"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4957,6 +5092,11 @@ add_library(interop_client_helper
test/cpp/interop/client_helper.cc
)
set_target_properties(interop_client_helper PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_client_helper PROPERTIES COMPILE_PDB_NAME "interop_client_helper"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5025,6 +5165,11 @@ add_library(interop_client_main
test/cpp/interop/interop_client.cc
)
set_target_properties(interop_client_main PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_client_main PROPERTIES COMPILE_PDB_NAME "interop_client_main"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5087,6 +5232,11 @@ add_library(interop_server_helper
test/cpp/interop/server_helper.cc
)
set_target_properties(interop_server_helper PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_server_helper PROPERTIES COMPILE_PDB_NAME "interop_server_helper"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5150,6 +5300,11 @@ add_library(interop_server_lib
test/cpp/interop/interop_server.cc
)
set_target_properties(interop_server_lib PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_server_lib PROPERTIES COMPILE_PDB_NAME "interop_server_lib"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5212,6 +5367,11 @@ add_library(interop_server_main
test/cpp/interop/interop_server_bootstrap.cc
)
set_target_properties(interop_server_main PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_server_main PROPERTIES COMPILE_PDB_NAME "interop_server_main"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5299,6 +5459,11 @@ add_library(qps
test/cpp/qps/usage_timer.cc
)
set_target_properties(qps PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(qps PROPERTIES COMPILE_PDB_NAME "qps"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5371,6 +5536,11 @@ add_library(grpc_csharp_ext SHARED
src/csharp/ext/grpc_csharp_ext.c
)
set_target_properties(grpc_csharp_ext PROPERTIES
VERSION ${gRPC_CSHARP_VERSION}
SOVERSION ${gRPC_CSHARP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_csharp_ext PROPERTIES COMPILE_PDB_NAME "grpc_csharp_ext"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5420,6 +5590,11 @@ add_library(bad_client_test
test/core/bad_client/bad_client.cc
)
set_target_properties(bad_client_test PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(bad_client_test PROPERTIES COMPILE_PDB_NAME "bad_client_test"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5468,6 +5643,11 @@ add_library(bad_ssl_test_server
test/core/bad_ssl/server_common.cc
)
set_target_properties(bad_ssl_test_server PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(bad_ssl_test_server PROPERTIES COMPILE_PDB_NAME "bad_ssl_test_server"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5588,6 +5768,11 @@ add_library(end2end_tests
test/core/end2end/tests/write_buffering_at_end.cc
)
set_target_properties(end2end_tests PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(end2end_tests PROPERTIES COMPILE_PDB_NAME "end2end_tests"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5708,6 +5893,11 @@ add_library(end2end_nosec_tests
test/core/end2end/tests/write_buffering_at_end.cc
)
set_target_properties(end2end_nosec_tests PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(end2end_nosec_tests PROPERTIES COMPILE_PDB_NAME "end2end_nosec_tests"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"

Binary file not shown.

@ -0,0 +1,4 @@
# gRPC Security Audit
A third-party security audit of gRPC C++ stack was performed by [Cure53](https://cure53.de) in October 2019. The full report can be found [here](https://github.com/grpc/grpc/tree/master/doc/grpc_security_audit.pdf). The medium severity issue (GRP-01-001) identified in this report was fixed in version 1.24.0 and above. The fix was also patched in version 1.23.1.

@ -99,7 +99,7 @@ bool http_proxy_enabled(const grpc_channel_args* args) {
return grpc_channel_arg_get_bool(arg, true);
}
static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper,
static bool proxy_mapper_map_name(grpc_proxy_mapper* /*mapper*/,
const char* server_uri,
const grpc_channel_args* args,
char** name_to_resolve,
@ -195,15 +195,15 @@ no_use_proxy:
return false;
}
static bool proxy_mapper_map_address(grpc_proxy_mapper* mapper,
const grpc_resolved_address* address,
const grpc_channel_args* args,
grpc_resolved_address** new_address,
grpc_channel_args** new_args) {
static bool proxy_mapper_map_address(grpc_proxy_mapper* /*mapper*/,
const grpc_resolved_address* /*address*/,
const grpc_channel_args* /*args*/,
grpc_resolved_address** /*new_address*/,
grpc_channel_args** /*new_args*/) {
return false;
}
static void proxy_mapper_destroy(grpc_proxy_mapper* mapper) {}
static void proxy_mapper_destroy(grpc_proxy_mapper* /*mapper*/) {}
static const grpc_proxy_mapper_vtable proxy_mapper_vtable = {
proxy_mapper_map_name, proxy_mapper_map_address, proxy_mapper_destroy};

@ -90,7 +90,7 @@ LoadBalancingPolicy::UpdateArgs& LoadBalancingPolicy::UpdateArgs::operator=(
//
LoadBalancingPolicy::PickResult LoadBalancingPolicy::QueuePicker::Pick(
PickArgs args) {
PickArgs /*args*/) {
// We invoke the parent's ExitIdleLocked() via a closure instead
// of doing it directly here, for two reasons:
// 1. ExitIdleLocked() may cause the policy's state to change and
@ -115,7 +115,7 @@ LoadBalancingPolicy::PickResult LoadBalancingPolicy::QueuePicker::Pick(
}
void LoadBalancingPolicy::QueuePicker::CallExitIdle(void* arg,
grpc_error* error) {
grpc_error* /*error*/) {
LoadBalancingPolicy* parent = static_cast<LoadBalancingPolicy*>(arg);
parent->ExitIdleLocked();
parent->Unref();
@ -126,7 +126,7 @@ void LoadBalancingPolicy::QueuePicker::CallExitIdle(void* arg,
//
LoadBalancingPolicy::PickResult
LoadBalancingPolicy::TransientFailurePicker::Pick(PickArgs args) {
LoadBalancingPolicy::TransientFailurePicker::Pick(PickArgs /*args*/) {
PickResult result;
result.type = PickResult::PICK_FAILED;
result.error = GRPC_ERROR_REF(error_);

@ -30,12 +30,12 @@
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/profiling/timers.h"
static grpc_error* clr_init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
static grpc_error* clr_init_channel_elem(grpc_channel_element* /*elem*/,
grpc_channel_element_args* /*args*/) {
return GRPC_ERROR_NONE;
}
static void clr_destroy_channel_elem(grpc_channel_element* elem) {}
static void clr_destroy_channel_elem(grpc_channel_element* /*elem*/) {}
namespace {
@ -79,8 +79,8 @@ static grpc_error* clr_init_call_elem(grpc_call_element* elem,
}
static void clr_destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {
const grpc_call_final_info* /*final_info*/,
grpc_closure* /*ignored*/) {
call_data* calld = static_cast<call_data*>(elem->call_data);
if (calld->client_stats != nullptr) {
// Record call finished, optionally setting client_failed_to_send and

@ -468,7 +468,7 @@ void client_stats_destroy(void* p) {
GrpcLbClientStats* client_stats = static_cast<GrpcLbClientStats*>(p);
client_stats->Unref();
}
int equal_cmp(void* p1, void* p2) {
int equal_cmp(void* /*p1*/, void* /*p2*/) {
// Always indicate a match, since we don't want this channel arg to
// affect the subchannel's key in the index.
// TODO(roth): Is this right? This does prevent us from needlessly
@ -1025,8 +1025,8 @@ void GrpcLb::BalancerCallState::OnInitialRequestSent(void* arg,
GRPC_ERROR_REF(error));
}
void GrpcLb::BalancerCallState::OnInitialRequestSentLocked(void* arg,
grpc_error* error) {
void GrpcLb::BalancerCallState::OnInitialRequestSentLocked(
void* arg, grpc_error* /*error*/) {
BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
grpc_byte_buffer_destroy(lb_calld->send_message_payload_);
lb_calld->send_message_payload_ = nullptr;
@ -1050,7 +1050,7 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceived(void* arg,
}
void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked(
void* arg, grpc_error* error) {
void* arg, grpc_error* /*error*/) {
BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
GrpcLb* grpclb_policy = lb_calld->grpclb_policy();
// Null payload means the LB call was cancelled.
@ -1547,7 +1547,7 @@ void GrpcLb::OnBalancerChannelConnectivityChanged(void* arg,
}
void GrpcLb::OnBalancerChannelConnectivityChangedLocked(void* arg,
grpc_error* error) {
grpc_error* /*error*/) {
GrpcLb* self = static_cast<GrpcLb*>(arg);
if (!self->shutting_down_ && self->fallback_at_startup_checks_pending_) {
if (self->lb_channel_connectivity_ != GRPC_CHANNEL_TRANSIENT_FAILURE) {

@ -25,7 +25,7 @@
namespace grpc_core {
grpc_channel_args* ModifyGrpclbBalancerChannelArgs(
const ServerAddressList& addresses, grpc_channel_args* args) {
const ServerAddressList& /*addresses*/, grpc_channel_args* args) {
return args;
}

@ -112,7 +112,7 @@ class PickFirst : public LoadBalancingPolicy {
explicit Picker(RefCountedPtr<SubchannelInterface> subchannel)
: subchannel_(std::move(subchannel)) {}
PickResult Pick(PickArgs args) override {
PickResult Pick(PickArgs /*args*/) override {
PickResult result;
result.type = PickResult::PICK_COMPLETE;
result.subchannel = subchannel_;
@ -490,7 +490,7 @@ class PickFirstFactory : public LoadBalancingPolicyFactory {
const char* name() const override { return kPickFirst; }
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
const grpc_json* json, grpc_error** error) const override {
const grpc_json* json, grpc_error** /*error*/) const override {
if (json != nullptr) {
GPR_DEBUG_ASSERT(strcmp(json->key, name()) == 0);
}

@ -204,7 +204,7 @@ RoundRobin::Picker::Picker(RoundRobin* parent,
}
}
RoundRobin::PickResult RoundRobin::Picker::Pick(PickArgs args) {
RoundRobin::PickResult RoundRobin::Picker::Pick(PickArgs /*args*/) {
last_picked_index_ = (last_picked_index_ + 1) % subchannels_.size();
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) {
gpr_log(GPR_INFO,
@ -486,7 +486,7 @@ class RoundRobinFactory : public LoadBalancingPolicyFactory {
const char* name() const override { return kRoundRobin; }
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
const grpc_json* json, grpc_error** error) const override {
const grpc_json* json, grpc_error** /*error*/) const override {
if (json != nullptr) {
GPR_DEBUG_ASSERT(strcmp(json->key, name()) == 0);
}

@ -267,7 +267,8 @@ void SubchannelData<SubchannelListType, SubchannelDataType>::Watcher::
template <typename SubchannelListType, typename SubchannelDataType>
SubchannelData<SubchannelListType, SubchannelDataType>::SubchannelData(
SubchannelList<SubchannelListType, SubchannelDataType>* subchannel_list,
const ServerAddress& address, RefCountedPtr<SubchannelInterface> subchannel)
const ServerAddress& /*address*/,
RefCountedPtr<SubchannelInterface> subchannel)
: subchannel_list_(subchannel_list),
subchannel_(std::move(subchannel)),
// We assume that the current state is IDLE. If not, we'll get a
@ -286,10 +287,10 @@ void SubchannelData<SubchannelListType, SubchannelDataType>::
if (GRPC_TRACE_FLAG_ENABLED(*subchannel_list_->tracer())) {
gpr_log(GPR_INFO,
"[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
" (subchannel %p): unreffing subchannel",
" (subchannel %p): unreffing subchannel (%s)",
subchannel_list_->tracer()->name(), subchannel_list_->policy(),
subchannel_list_, Index(), subchannel_list_->num_subchannels(),
subchannel_.get());
subchannel_.get(), reason);
}
subchannel_.reset();
}

@ -77,14 +77,9 @@ constexpr char kXds[] = "xds_experimental";
class ParsedXdsConfig : public LoadBalancingPolicy::Config {
public:
ParsedXdsConfig(RefCountedPtr<LoadBalancingPolicy::Config> child_policy,
RefCountedPtr<LoadBalancingPolicy::Config> fallback_policy,
UniquePtr<char> eds_service_name,
UniquePtr<char> lrs_load_reporting_server_name)
RefCountedPtr<LoadBalancingPolicy::Config> fallback_policy)
: child_policy_(std::move(child_policy)),
fallback_policy_(std::move(fallback_policy)),
eds_service_name_(std::move(eds_service_name)),
lrs_load_reporting_server_name_(
std::move(lrs_load_reporting_server_name)) {}
fallback_policy_(std::move(fallback_policy)) {}
const char* name() const override { return kXds; }
@ -96,17 +91,9 @@ class ParsedXdsConfig : public LoadBalancingPolicy::Config {
return fallback_policy_;
}
const char* eds_service_name() const { return eds_service_name_.get(); };
const char* lrs_load_reporting_server_name() const {
return lrs_load_reporting_server_name_.get();
};
private:
RefCountedPtr<LoadBalancingPolicy::Config> child_policy_;
RefCountedPtr<LoadBalancingPolicy::Config> fallback_policy_;
UniquePtr<char> eds_service_name_;
UniquePtr<char> lrs_load_reporting_server_name_;
};
class XdsLb : public LoadBalancingPolicy {
@ -124,17 +111,16 @@ class XdsLb : public LoadBalancingPolicy {
// We need this wrapper for the following reasons:
// 1. To process per-locality load reporting.
// 2. Since pickers are UniquePtrs we use this RefCounted wrapper to control
// references to it by the xds picker and the locality.
class EndpointPickerWrapper : public RefCounted<EndpointPickerWrapper> {
// references to it by the xds picker and the locality.
class PickerWrapper : public RefCounted<PickerWrapper> {
public:
EndpointPickerWrapper(
UniquePtr<SubchannelPicker> picker,
RefCountedPtr<XdsClientStats::LocalityStats> locality_stats)
PickerWrapper(UniquePtr<SubchannelPicker> picker,
RefCountedPtr<XdsClientStats::LocalityStats> locality_stats)
: picker_(std::move(picker)),
locality_stats_(std::move(locality_stats)) {
locality_stats_->RefByPicker();
}
~EndpointPickerWrapper() { locality_stats_->UnrefByPicker(); }
~PickerWrapper() { locality_stats_->UnrefByPicker(); }
PickResult Pick(PickArgs args);
@ -145,16 +131,15 @@ class XdsLb : public LoadBalancingPolicy {
// The picker will use a stateless weighting algorithm to pick the locality to
// use for each request.
class LocalityPicker : public SubchannelPicker {
class Picker : public SubchannelPicker {
public:
// Maintains a weighted list of pickers from each locality that is in ready
// state. The first element in the pair represents the end of a range
// proportional to the locality's weight. The start of the range is the
// previous value in the vector and is 0 for the first element.
using PickerList =
InlinedVector<std::pair<uint32_t, RefCountedPtr<EndpointPickerWrapper>>,
1>;
LocalityPicker(RefCountedPtr<XdsLb> xds_policy, PickerList pickers)
InlinedVector<std::pair<uint32_t, RefCountedPtr<PickerWrapper>>, 1>;
Picker(RefCountedPtr<XdsLb> xds_policy, PickerList pickers)
: xds_policy_(std::move(xds_policy)),
pickers_(std::move(pickers)),
drop_config_(xds_policy_->drop_config_) {}
@ -219,7 +204,7 @@ class XdsLb : public LoadBalancingPolicy {
return connectivity_state_;
}
uint32_t weight() const { return weight_; }
RefCountedPtr<EndpointPickerWrapper> picker_wrapper() const {
RefCountedPtr<PickerWrapper> picker_wrapper() const {
return picker_wrapper_;
}
@ -271,7 +256,7 @@ class XdsLb : public LoadBalancingPolicy {
RefCountedPtr<XdsLocalityName> name_;
OrphanablePtr<LoadBalancingPolicy> child_policy_;
OrphanablePtr<LoadBalancingPolicy> pending_child_policy_;
RefCountedPtr<EndpointPickerWrapper> picker_wrapper_;
RefCountedPtr<PickerWrapper> picker_wrapper_;
grpc_connectivity_state connectivity_state_ = GRPC_CHANNEL_IDLE;
uint32_t weight_;
@ -392,24 +377,16 @@ class XdsLb : public LoadBalancingPolicy {
const char* name, const grpc_channel_args* args);
void MaybeExitFallbackMode();
const char* eds_service_name() const {
if (config_ != nullptr && config_->eds_service_name() != nullptr) {
return config_->eds_service_name();
}
return server_name_.get();
}
XdsClient* xds_client() const {
return xds_client_from_channel_ != nullptr ? xds_client_from_channel_.get()
: xds_client_.get();
}
// Server name from target URI.
UniquePtr<char> server_name_;
// Name of the backend server to connect to.
const char* server_name_ = nullptr;
// Current channel args and config from the resolver.
// Current channel args from the resolver.
const grpc_channel_args* args_ = nullptr;
RefCountedPtr<ParsedXdsConfig> config_;
// Internal state.
bool shutting_down_ = false;
@ -441,10 +418,14 @@ class XdsLb : public LoadBalancingPolicy {
grpc_timer lb_fallback_timer_;
grpc_closure lb_on_fallback_;
// The policy to use for the fallback backends.
RefCountedPtr<LoadBalancingPolicy::Config> fallback_policy_config_;
// Non-null iff we are in fallback mode.
OrphanablePtr<LoadBalancingPolicy> fallback_policy_;
OrphanablePtr<LoadBalancingPolicy> pending_fallback_policy_;
// The policy to use for the backends.
RefCountedPtr<LoadBalancingPolicy::Config> child_policy_config_;
const grpc_millis locality_retention_interval_ms_;
const grpc_millis locality_map_failover_timeout_ms_;
// A list of locality maps indexed by priority.
@ -460,10 +441,10 @@ class XdsLb : public LoadBalancingPolicy {
};
//
// XdsLb::EndpointPickerWrapper
// XdsLb::PickerWrapper::Pick
//
LoadBalancingPolicy::PickResult XdsLb::EndpointPickerWrapper::Pick(
LoadBalancingPolicy::PickResult XdsLb::PickerWrapper::Pick(
LoadBalancingPolicy::PickArgs args) {
// Forward the pick to the picker returned from the child policy.
PickResult result = picker_->Pick(args);
@ -479,8 +460,8 @@ LoadBalancingPolicy::PickResult XdsLb::EndpointPickerWrapper::Pick(
result.recv_trailing_metadata_ready =
// Note: This callback does not run in either the control plane
// combiner or in the data plane mutex.
[locality_stats](grpc_error* error, MetadataInterface* metadata,
CallState* call_state) {
[locality_stats](grpc_error* error, MetadataInterface* /*metadata*/,
CallState* /*call_state*/) {
const bool call_failed = error != GRPC_ERROR_NONE;
locality_stats->AddCallFinished(call_failed);
locality_stats->Unref(DEBUG_LOCATION, "LocalityStats+call");
@ -489,10 +470,10 @@ LoadBalancingPolicy::PickResult XdsLb::EndpointPickerWrapper::Pick(
}
//
// XdsLb::LocalityPicker
// XdsLb::Picker
//
XdsLb::PickResult XdsLb::LocalityPicker::Pick(PickArgs args) {
XdsLb::PickResult XdsLb::Picker::Pick(PickArgs args) {
// Handle drop.
const UniquePtr<char>* drop_category;
if (drop_config_->ShouldDrop(&drop_category)) {
@ -508,8 +489,8 @@ XdsLb::PickResult XdsLb::LocalityPicker::Pick(PickArgs args) {
return PickFromLocality(key, args);
}
XdsLb::PickResult XdsLb::LocalityPicker::PickFromLocality(const uint32_t key,
PickArgs args) {
XdsLb::PickResult XdsLb::Picker::PickFromLocality(const uint32_t key,
PickArgs args) {
size_t mid = 0;
size_t start_index = 0;
size_t end_index = pickers_.size() - 1;
@ -705,11 +686,11 @@ XdsLb::XdsLb(Args args)
GPR_ASSERT(server_uri != nullptr);
grpc_uri* uri = grpc_uri_parse(server_uri, true);
GPR_ASSERT(uri->path[0] != '\0');
server_name_.reset(
gpr_strdup(uri->path[0] == '/' ? uri->path + 1 : uri->path));
server_name_ = gpr_strdup(uri->path[0] == '/' ? uri->path + 1 : uri->path);
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
gpr_log(GPR_INFO, "[xdslb %p] server name from channel: %s", this,
server_name_.get());
gpr_log(GPR_INFO,
"[xdslb %p] Will use '%s' as the server name for LB request.", this,
server_name_);
}
grpc_uri_destroy(uri);
}
@ -718,6 +699,7 @@ XdsLb::~XdsLb() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
gpr_log(GPR_INFO, "[xdslb %p] destroying xds LB policy", this);
}
gpr_free((void*)server_name_);
grpc_channel_args_destroy(args_);
}
@ -740,13 +722,9 @@ void XdsLb::ShutdownLocked() {
pending_fallback_policy_.reset();
// Cancel the endpoint watch here instead of in our dtor, because the
// watcher holds a ref to us.
xds_client()->CancelEndpointDataWatch(StringView(eds_service_name()),
xds_client()->CancelEndpointDataWatch(StringView(server_name_),
endpoint_watcher_);
if (config_->lrs_load_reporting_server_name() != nullptr) {
xds_client()->RemoveClientStats(
StringView(config_->lrs_load_reporting_server_name()),
StringView(eds_service_name()), &client_stats_);
}
xds_client()->RemoveClientStats(StringView(server_name_), &client_stats_);
xds_client_from_channel_.reset();
xds_client_.reset();
}
@ -775,9 +753,9 @@ void XdsLb::UpdateLocked(UpdateArgs args) {
}
const bool is_initial_update = args_ == nullptr;
// Update config.
const char* old_eds_service_name = eds_service_name();
auto old_config = std::move(config_);
config_ = std::move(args.config);
auto* xds_config = static_cast<const ParsedXdsConfig*>(args.config.get());
child_policy_config_ = xds_config->child_policy();
fallback_policy_config_ = xds_config->fallback_policy();
// Update fallback address list.
fallback_backend_addresses_ = std::move(args.addresses);
// Update args.
@ -794,7 +772,7 @@ void XdsLb::UpdateLocked(UpdateArgs args) {
if (xds_client_from_channel_ == nullptr) {
grpc_error* error = GRPC_ERROR_NONE;
xds_client_ = MakeOrphanable<XdsClient>(
combiner(), interested_parties(), StringView(eds_service_name()),
combiner(), interested_parties(), StringView(server_name_),
nullptr /* service config watcher */, *args_, &error);
// TODO(roth): If we decide that we care about fallback mode, add
// proper error handling here.
@ -804,6 +782,11 @@ void XdsLb::UpdateLocked(UpdateArgs args) {
xds_client_.get());
}
}
auto watcher = MakeUnique<EndpointWatcher>(Ref());
endpoint_watcher_ = watcher.get();
xds_client()->WatchEndpointData(StringView(server_name_),
std::move(watcher));
xds_client()->AddClientStats(StringView(server_name_), &client_stats_);
// Start fallback-at-startup checks.
grpc_millis deadline = ExecCtx::Get()->Now() + lb_fallback_timeout_ms_;
Ref(DEBUG_LOCATION, "on_fallback_timer").release(); // Held by closure
@ -812,42 +795,6 @@ void XdsLb::UpdateLocked(UpdateArgs args) {
fallback_at_startup_checks_pending_ = true;
grpc_timer_init(&lb_fallback_timer_, deadline, &lb_on_fallback_);
}
// Update endpoint watcher if needed.
if (is_initial_update ||
strcmp(old_eds_service_name, eds_service_name()) != 0) {
if (!is_initial_update) {
xds_client()->CancelEndpointDataWatch(StringView(old_eds_service_name),
endpoint_watcher_);
}
auto watcher = MakeUnique<EndpointWatcher>(Ref());
endpoint_watcher_ = watcher.get();
xds_client()->WatchEndpointData(StringView(eds_service_name()),
std::move(watcher));
}
// Update load reporting if needed.
// TODO(roth): Ideally, we should not collect any stats if load reporting
// is disabled, which would require changing this code to recreate
// all of the pickers whenever load reporting is enabled or disabled
// here.
if (is_initial_update ||
(config_->lrs_load_reporting_server_name() == nullptr) !=
(old_config->lrs_load_reporting_server_name() == nullptr) ||
(config_->lrs_load_reporting_server_name() != nullptr &&
old_config->lrs_load_reporting_server_name() != nullptr &&
strcmp(config_->lrs_load_reporting_server_name(),
old_config->lrs_load_reporting_server_name()) != 0)) {
if (old_config != nullptr &&
old_config->lrs_load_reporting_server_name() != nullptr) {
xds_client()->RemoveClientStats(
StringView(old_config->lrs_load_reporting_server_name()),
StringView(old_eds_service_name), &client_stats_);
}
if (config_->lrs_load_reporting_server_name() != nullptr) {
xds_client()->AddClientStats(
StringView(config_->lrs_load_reporting_server_name()),
StringView(eds_service_name()), &client_stats_);
}
}
}
//
@ -892,7 +839,9 @@ void XdsLb::UpdateFallbackPolicyLocked() {
// Construct update args.
UpdateArgs update_args;
update_args.addresses = fallback_backend_addresses_;
update_args.config = config_->fallback_policy();
update_args.config = fallback_policy_config_ == nullptr
? nullptr
: fallback_policy_config_->Ref();
update_args.args = grpc_channel_args_copy(args_);
// If the child policy name changes, we need to create a new child
// policy. When this happens, we leave child_policy_ as-is and store
@ -943,9 +892,9 @@ void XdsLb::UpdateFallbackPolicyLocked() {
// that was there before, which will be immediately shut down)
// and will later be swapped into child_policy_ by the helper
// when the new child transitions into state READY.
const char* fallback_policy_name = update_args.config == nullptr
const char* fallback_policy_name = fallback_policy_config_ == nullptr
? "round_robin"
: update_args.config->name();
: fallback_policy_config_->name();
const bool create_policy =
// case 1
fallback_policy_ == nullptr ||
@ -1226,7 +1175,7 @@ void XdsLb::PriorityList::LocalityMap::UpdateXdsPickerLocked() {
// that are ready. Each locality is represented by a portion of the range
// proportional to its weight, such that the total range is the sum of the
// weights of all localities.
LocalityPicker::PickerList picker_list;
Picker::PickerList picker_list;
uint32_t end = 0;
for (const auto& p : localities_) {
const auto& locality_name = p.first;
@ -1238,9 +1187,9 @@ void XdsLb::PriorityList::LocalityMap::UpdateXdsPickerLocked() {
picker_list.push_back(std::make_pair(end, locality->picker_wrapper()));
}
xds_policy()->channel_control_helper()->UpdateState(
GRPC_CHANNEL_READY, MakeUnique<LocalityPicker>(
xds_policy_->Ref(DEBUG_LOCATION, "XdsLb+Picker"),
std::move(picker_list)));
GRPC_CHANNEL_READY,
MakeUnique<Picker>(xds_policy_->Ref(DEBUG_LOCATION, "XdsLb+Picker"),
std::move(picker_list)));
}
OrphanablePtr<XdsLb::PriorityList::LocalityMap::Locality>
@ -1541,7 +1490,9 @@ void XdsLb::PriorityList::LocalityMap::Locality::UpdateLocked(
// Construct update args.
UpdateArgs update_args;
update_args.addresses = std::move(serverlist);
update_args.config = xds_policy()->config_->child_policy();
update_args.config = xds_policy()->child_policy_config_ == nullptr
? nullptr
: xds_policy()->child_policy_config_->Ref();
update_args.args = CreateChildPolicyArgsLocked(xds_policy()->args_);
// If the child policy name changes, we need to create a new child
// policy. When this happens, we leave child_policy_ as-is and store
@ -1594,9 +1545,10 @@ void XdsLb::PriorityList::LocalityMap::Locality::UpdateLocked(
// when the new child transitions into state READY.
// TODO(juanlishen): If the child policy is not configured via service config,
// use whatever algorithm is specified by the balancer.
const char* child_policy_name = update_args.config == nullptr
? "round_robin"
: update_args.config->name();
const char* child_policy_name =
xds_policy()->child_policy_config_ == nullptr
? "round_robin"
: xds_policy()->child_policy_config_->name();
const bool create_policy =
// case 1
child_policy_ == nullptr ||
@ -1763,11 +1715,7 @@ void XdsLb::PriorityList::LocalityMap::Locality::Helper::UpdateState(
return;
}
// Cache the picker and its state in the locality.
// TODO(roth): If load reporting is not configured, we should ideally
// pass a null LocalityStats ref to the EndpointPickerWrapper and have it
// not collect any stats, since they're not going to be used. This would
// require recreating all of the pickers whenever we get a config update.
locality_->picker_wrapper_ = MakeRefCounted<EndpointPickerWrapper>(
locality_->picker_wrapper_ = MakeRefCounted<PickerWrapper>(
std::move(picker),
locality_->xds_policy()->client_stats_.FindLocalityStats(
locality_->name_));
@ -1814,8 +1762,6 @@ class XdsFactory : public LoadBalancingPolicyFactory {
InlinedVector<grpc_error*, 3> error_list;
RefCountedPtr<LoadBalancingPolicy::Config> child_policy;
RefCountedPtr<LoadBalancingPolicy::Config> fallback_policy;
const char* eds_service_name = nullptr;
const char* lrs_load_reporting_server_name = nullptr;
for (const grpc_json* field = json->child; field != nullptr;
field = field->next) {
if (field->key == nullptr) continue;
@ -1843,35 +1789,11 @@ class XdsFactory : public LoadBalancingPolicyFactory {
GPR_DEBUG_ASSERT(parse_error != GRPC_ERROR_NONE);
error_list.push_back(parse_error);
}
} else if (strcmp(field->key, "edsServiceName") == 0) {
if (eds_service_name != nullptr) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:edsServiceName error:Duplicate entry"));
}
if (field->type != GRPC_JSON_STRING) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:edsServiceName error:type should be string"));
continue;
}
eds_service_name = field->value;
} else if (strcmp(field->key, "lrsLoadReportingServerName") == 0) {
if (lrs_load_reporting_server_name != nullptr) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:lrsLoadReportingServerName error:Duplicate entry"));
}
if (field->type != GRPC_JSON_STRING) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:lrsLoadReportingServerName error:type should be string"));
continue;
}
lrs_load_reporting_server_name = field->value;
}
}
if (error_list.empty()) {
return MakeRefCounted<ParsedXdsConfig>(
std::move(child_policy), std::move(fallback_policy),
UniquePtr<char>(gpr_strdup(eds_service_name)),
UniquePtr<char>(gpr_strdup(lrs_load_reporting_server_name)));
return RefCountedPtr<LoadBalancingPolicy::Config>(New<ParsedXdsConfig>(
std::move(child_policy), std::move(fallback_policy)));
} else {
*error = GRPC_ERROR_CREATE_FROM_VECTOR("Xds Parser", &error_list);
return nullptr;

@ -62,26 +62,26 @@ Subchannel* LocalSubchannelPool::FindSubchannel(SubchannelKey* key) {
namespace {
void sck_avl_destroy(void* p, void* user_data) {
void sck_avl_destroy(void* p, void* /*user_data*/) {
SubchannelKey* key = static_cast<SubchannelKey*>(p);
Delete(key);
}
void* sck_avl_copy(void* p, void* unused) {
void* sck_avl_copy(void* p, void* /*unused*/) {
const SubchannelKey* key = static_cast<const SubchannelKey*>(p);
auto new_key = New<SubchannelKey>(*key);
return static_cast<void*>(new_key);
}
long sck_avl_compare(void* a, void* b, void* unused) {
long sck_avl_compare(void* a, void* b, void* /*unused*/) {
const SubchannelKey* key_a = static_cast<const SubchannelKey*>(a);
const SubchannelKey* key_b = static_cast<const SubchannelKey*>(b);
return key_a->Cmp(*key_b);
}
void scv_avl_destroy(void* p, void* user_data) {}
void scv_avl_destroy(void* /*p*/, void* /*user_data*/) {}
void* scv_avl_copy(void* p, void* unused) { return p; }
void* scv_avl_copy(void* p, void* /*unused*/) { return p; }
} // namespace

@ -451,7 +451,7 @@ void AresDnsResolver::StartResolvingLocked() {
class AresDnsResolverFactory : public ResolverFactory {
public:
bool IsValidUri(const grpc_uri* uri) const override { return true; }
bool IsValidUri(const grpc_uri* /*uri*/) const override { return true; }
OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
return MakeOrphanable<AresDnsResolver>(std::move(args));

@ -138,7 +138,7 @@ static void on_timeout_locked(void* arg, grpc_error* error);
static void on_ares_backup_poll_alarm(void* arg, grpc_error* error);
static void on_ares_backup_poll_alarm_locked(void* arg, grpc_error* error);
static void noop_inject_channel_config(ares_channel channel) {}
static void noop_inject_channel_config(ares_channel /*channel*/) {}
void (*grpc_ares_test_only_inject_config)(ares_channel channel) =
noop_inject_channel_config;

@ -90,14 +90,14 @@ class GrpcPolledFdFactoryPosix : public GrpcPolledFdFactory {
public:
GrpcPolledFd* NewGrpcPolledFdLocked(ares_socket_t as,
grpc_pollset_set* driver_pollset_set,
Combiner* combiner) override {
Combiner* /*combiner*/) override {
return New<GrpcPolledFdPosix>(as, driver_pollset_set);
}
void ConfigureAresChannelLocked(ares_channel channel) override {}
void ConfigureAresChannelLocked(ares_channel /*channel*/) override {}
};
UniquePtr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(Combiner* combiner) {
UniquePtr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(Combiner* /*combiner*/) {
return MakeUnique<GrpcPolledFdFactoryPosix>();
}

@ -175,7 +175,7 @@ static void destroy_hostbyname_request_locked(
gpr_free(hr);
}
static void on_hostbyname_done_locked(void* arg, int status, int timeouts,
static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/,
struct hostent* hostent) {
grpc_ares_hostbyname_request* hr =
static_cast<grpc_ares_hostbyname_request*>(arg);
@ -248,7 +248,7 @@ static void on_hostbyname_done_locked(void* arg, int status, int timeouts,
destroy_hostbyname_request_locked(hr);
}
static void on_srv_query_done_locked(void* arg, int status, int timeouts,
static void on_srv_query_done_locked(void* arg, int status, int /*timeouts*/,
unsigned char* abuf, int alen) {
grpc_ares_request* r = static_cast<grpc_ares_request*>(arg);
if (status == ARES_SUCCESS) {
@ -293,7 +293,7 @@ static void on_srv_query_done_locked(void* arg, int status, int timeouts,
static const char g_service_config_attribute_prefix[] = "grpc_config=";
static void on_txt_done_locked(void* arg, int status, int timeouts,
static void on_txt_done_locked(void* arg, int status, int /*timeouts*/,
unsigned char* buf, int len) {
char* error_msg;
grpc_ares_request* r = static_cast<grpc_ares_request*>(arg);
@ -579,8 +579,8 @@ static bool grpc_ares_maybe_resolve_localhost_manually_locked(
}
#else /* GRPC_ARES_RESOLVE_LOCALHOST_MANUALLY */
static bool grpc_ares_maybe_resolve_localhost_manually_locked(
const char* name, const char* default_port,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs) {
const char* /*name*/, const char* /*default_port*/,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* /*addrs*/) {
return false;
}
#endif /* GRPC_ARES_RESOLVE_LOCALHOST_MANUALLY */
@ -728,7 +728,7 @@ static void on_dns_lookup_done(void* arg, grpc_error* error) {
}
static void grpc_resolve_address_invoke_dns_lookup_ares_locked(
void* arg, grpc_error* unused_error) {
void* arg, grpc_error* /*unused_error*/) {
grpc_resolve_address_ares_request* r =
static_cast<grpc_resolve_address_ares_request*>(arg);
GRPC_CLOSURE_INIT(&r->on_dns_lookup_done_locked, on_dns_lookup_done, r,

@ -159,7 +159,7 @@ void FakeResolver::MaybeSendResultLocked() {
}
}
void FakeResolver::ReturnReresolutionResult(void* arg, grpc_error* error) {
void FakeResolver::ReturnReresolutionResult(void* arg, grpc_error* /*error*/) {
FakeResolver* self = static_cast<FakeResolver*>(arg);
self->reresolution_closure_pending_ = false;
self->MaybeSendResultLocked();
@ -183,7 +183,7 @@ struct SetResponseClosureArg {
};
void FakeResolverResponseGenerator::SetResponseLocked(void* arg,
grpc_error* error) {
grpc_error* /*error*/) {
SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
auto& resolver = closure_arg->resolver;
if (!resolver->shutdown_) {
@ -215,7 +215,7 @@ void FakeResolverResponseGenerator::SetResponse(Resolver::Result result) {
}
void FakeResolverResponseGenerator::SetReresolutionResponseLocked(
void* arg, grpc_error* error) {
void* arg, grpc_error* /*error*/) {
SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
auto& resolver = closure_arg->resolver;
if (!resolver->shutdown_) {
@ -259,7 +259,7 @@ void FakeResolverResponseGenerator::UnsetReresolutionResponse() {
}
void FakeResolverResponseGenerator::SetFailureLocked(void* arg,
grpc_error* error) {
grpc_error* /*error*/) {
SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
auto& resolver = closure_arg->resolver;
if (!resolver->shutdown_) {
@ -371,7 +371,7 @@ namespace {
class FakeResolverFactory : public ResolverFactory {
public:
bool IsValidUri(const grpc_uri* uri) const override { return true; }
bool IsValidUri(const grpc_uri* /*uri*/) const override { return true; }
OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
return MakeOrphanable<FakeResolver>(std::move(args));

@ -78,7 +78,7 @@ void SockaddrResolver::StartLocked() {
// Factory
//
void DoNothing(void* ignored) {}
void DoNothing(void* /*ignored*/) {}
bool ParseUri(const grpc_uri* uri,
bool parse(const grpc_uri* uri, grpc_resolved_address* dst),
@ -160,7 +160,7 @@ class UnixResolverFactory : public ResolverFactory {
return CreateSockaddrResolver(std::move(args), grpc_parse_unix);
}
UniquePtr<char> GetDefaultAuthority(grpc_uri* uri) const override {
UniquePtr<char> GetDefaultAuthority(grpc_uri* /*uri*/) const override {
return UniquePtr<char>(gpr_strdup("localhost"));
}

@ -152,7 +152,8 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper
}
}
void AddTraceEvent(TraceSeverity severity, StringView message) override {}
void AddTraceEvent(TraceSeverity /*severity*/,
StringView /*message*/) override {}
void set_child(LoadBalancingPolicy* child) { child_ = child; }

@ -74,7 +74,7 @@ class ResolvingLoadBalancingPolicy : public LoadBalancingPolicy {
// No-op -- should never get updates from the channel.
// TODO(roth): Need to support updating child LB policy's config for xds
// use case.
void UpdateLocked(UpdateArgs args) override {}
void UpdateLocked(UpdateArgs /*args*/) override {}
void ExitIdleLocked() override;

@ -118,27 +118,27 @@ void ServerRetryThrottleData::RecordSuccess() {
namespace {
void* copy_server_name(void* key, void* unused) {
void* copy_server_name(void* key, void* /*unused*/) {
return gpr_strdup(static_cast<const char*>(key));
}
long compare_server_name(void* key1, void* key2, void* unused) {
long compare_server_name(void* key1, void* key2, void* /*unused*/) {
return strcmp(static_cast<const char*>(key1), static_cast<const char*>(key2));
}
void destroy_server_retry_throttle_data(void* value, void* unused) {
void destroy_server_retry_throttle_data(void* value, void* /*unused*/) {
ServerRetryThrottleData* throttle_data =
static_cast<ServerRetryThrottleData*>(value);
throttle_data->Unref();
}
void* copy_server_retry_throttle_data(void* value, void* unused) {
void* copy_server_retry_throttle_data(void* value, void* /*unused*/) {
ServerRetryThrottleData* throttle_data =
static_cast<ServerRetryThrottleData*>(value);
return throttle_data->Ref().release();
}
void destroy_server_name(void* key, void* unused) { gpr_free(key); }
void destroy_server_name(void* key, void* /*unused*/) { gpr_free(key); }
const grpc_avl_vtable avl_vtable = {
destroy_server_name, copy_server_name, compare_server_name,

@ -71,12 +71,16 @@ class ServiceConfig : public RefCounted<ServiceConfig> {
virtual UniquePtr<ParsedConfig> ParseGlobalParams(
const grpc_json* /* json */, grpc_error** error) {
// Avoid unused parameter warning on debug-only parameter
(void)error;
GPR_DEBUG_ASSERT(error != nullptr);
return nullptr;
}
virtual UniquePtr<ParsedConfig> ParsePerMethodParams(
const grpc_json* /* json */, grpc_error** error) {
// Avoid unused parameter warning on debug-only parameter
(void)error;
GPR_DEBUG_ASSERT(error != nullptr);
return nullptr;
}

@ -30,7 +30,6 @@
#include "envoy/api/v2/core/address.upb.h"
#include "envoy/api/v2/core/base.upb.h"
#include "envoy/api/v2/core/health_check.upb.h"
#include "envoy/api/v2/discovery.upb.h"
#include "envoy/api/v2/eds.upb.h"
#include "envoy/api/v2/endpoint/endpoint.upb.h"
@ -224,13 +223,6 @@ namespace {
grpc_error* ServerAddressParseAndAppend(
const envoy_api_v2_endpoint_LbEndpoint* lb_endpoint,
ServerAddressList* list) {
// If health_status is not HEALTHY or UNKNOWN, skip this endpoint.
const int32_t health_status =
envoy_api_v2_endpoint_LbEndpoint_health_status(lb_endpoint);
if (health_status != envoy_api_v2_core_UNKNOWN &&
health_status != envoy_api_v2_core_HEALTHY) {
return GRPC_ERROR_NONE;
}
// Find the ip:port.
const envoy_api_v2_endpoint_Endpoint* endpoint =
envoy_api_v2_endpoint_LbEndpoint_endpoint(lb_endpoint);

@ -736,11 +736,8 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
}
}
// Start load reporting if needed.
auto& lrs_call = ads_calld->chand()->lrs_calld_;
if (lrs_call != nullptr) {
LrsCallState* lrs_calld = lrs_call->calld();
if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked();
}
LrsCallState* lrs_calld = ads_calld->chand()->lrs_calld_->calld();
if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked();
// Ignore identical update.
const EdsUpdate& prev_update = xds_client->cluster_state_.eds_update;
const bool priority_list_changed =
@ -1322,18 +1319,14 @@ void XdsClient::CancelEndpointDataWatch(StringView cluster,
}
}
void XdsClient::AddClientStats(StringView lrs_server, StringView cluster,
void XdsClient::AddClientStats(StringView cluster,
XdsClientStats* client_stats) {
// TODO(roth): When we add support for direct federation, use the
// server name specified in lrs_server.
cluster_state_.client_stats.insert(client_stats);
chand_->MaybeStartLrsCall();
}
void XdsClient::RemoveClientStats(StringView lrs_server, StringView cluster,
void XdsClient::RemoveClientStats(StringView cluster,
XdsClientStats* client_stats) {
// TODO(roth): When we add support for direct federation, use the
// server name specified in lrs_server.
// TODO(roth): In principle, we should try to send a final load report
// containing whatever final stats have been accumulated since the
// last load report.
@ -1372,9 +1365,7 @@ void XdsClient::NotifyOnServiceConfig(void* arg, grpc_error* error) {
static const char* json =
"{\n"
" \"loadBalancingConfig\":[\n"
" { \"xds_experimental\":{\n"
" \"lrsLoadReportingServerName\": \"\"\n"
" } }\n"
" { \"xds_experimental\":{} }\n"
" ]\n"
"}";
RefCountedPtr<ServiceConfig> service_config =

@ -100,10 +100,8 @@ class XdsClient : public InternallyRefCounted<XdsClient> {
EndpointWatcherInterface* watcher);
// Adds and removes client stats for cluster.
void AddClientStats(StringView lrs_server, StringView cluster,
XdsClientStats* client_stats);
void RemoveClientStats(StringView lrs_server, StringView cluster,
XdsClientStats* client_stats);
void AddClientStats(StringView cluster, XdsClientStats* client_stats);
void RemoveClientStats(StringView cluster, XdsClientStats* client_stats);
// Resets connection backoff state.
void ResetBackoff();
@ -210,9 +208,8 @@ class XdsClient : public InternallyRefCounted<XdsClient> {
// The channel for communicating with the xds server.
OrphanablePtr<ChannelState> chand_;
// TODO(juanlishen): As part of adding CDS support, replace
// cluster_state_ with a map keyed by cluster name, so that we can
// support multiple clusters for both CDS and EDS.
// TODO(roth): When we need support for multiple clusters, replace
// cluster_state_ with a map keyed by cluster name.
ClusterState cluster_state_;
// Map<StringView /*cluster*/, ClusterState, StringLess> clusters_;

@ -286,8 +286,8 @@ static grpc_error* message_size_init_call_elem(
// Destructor for call_data.
static void message_size_destroy_call_elem(
grpc_call_element* elem, const grpc_call_final_info* final_info,
grpc_closure* ignored) {
grpc_call_element* elem, const grpc_call_final_info* /*final_info*/,
grpc_closure* /*ignored*/) {
call_data* calld = (call_data*)elem->call_data;
calld->~call_data();
}
@ -375,7 +375,7 @@ const grpc_channel_filter grpc_message_size_filter = {
// Used for GRPC_CLIENT_SUBCHANNEL
static bool maybe_add_message_size_filter_subchannel(
grpc_channel_stack_builder* builder, void* arg) {
grpc_channel_stack_builder* builder, void* /*arg*/) {
const grpc_channel_args* channel_args =
grpc_channel_stack_builder_get_channel_arguments(builder);
if (grpc_channel_args_want_minimal_stack(channel_args)) {
@ -388,7 +388,7 @@ static bool maybe_add_message_size_filter_subchannel(
// Used for GRPC_CLIENT_DIRECT_CHANNEL and GRPC_SERVER_CHANNEL. Adds the filter
// only if message size limits or service config is specified.
static bool maybe_add_message_size_filter(grpc_channel_stack_builder* builder,
void* arg) {
void* /*arg*/) {
const grpc_channel_args* channel_args =
grpc_channel_stack_builder_get_channel_arguments(builder);
bool enable = false;

@ -105,7 +105,7 @@ static void cronet_compression_start_transport_stream_op_batch(
// Constructor for call_data.
static grpc_error* cronet_compression_init_call_elem(
grpc_call_element* elem, const grpc_call_element_args* args) {
grpc_call_element* elem, const grpc_call_element_args* /*args*/) {
call_data* calld = static_cast<call_data*>(elem->call_data);
calld->next_recv_initial_metadata_ready = nullptr;
calld->workaround_active = false;
@ -117,18 +117,18 @@ static grpc_error* cronet_compression_init_call_elem(
// Destructor for call_data.
static void cronet_compression_destroy_call_elem(
grpc_call_element* elem, const grpc_call_final_info* final_info,
grpc_closure* ignored) {}
grpc_call_element* /*elem*/, const grpc_call_final_info* /*final_info*/,
grpc_closure* /*ignored*/) {}
// Constructor for channel_data.
static grpc_error* cronet_compression_init_channel_elem(
grpc_channel_element* elem, grpc_channel_element_args* args) {
grpc_channel_element* /*elem*/, grpc_channel_element_args* /*args*/) {
return GRPC_ERROR_NONE;
}
// Destructor for channel_data.
static void cronet_compression_destroy_channel_elem(
grpc_channel_element* elem) {}
grpc_channel_element* /*elem*/) {}
// Parse the user agent
static bool parse_user_agent(grpc_mdelem md) {
@ -183,7 +183,7 @@ const grpc_channel_filter grpc_workaround_cronet_compression_filter = {
"workaround_cronet_compression"};
static bool register_workaround_cronet_compression(
grpc_channel_stack_builder* builder, void* arg) {
grpc_channel_stack_builder* builder, void* /*arg*/) {
const grpc_channel_args* channel_args =
grpc_channel_stack_builder_get_channel_arguments(builder);
const grpc_arg* a = grpc_channel_args_find(

@ -240,7 +240,7 @@ static void on_accept(void* arg, grpc_endpoint* tcp,
}
/* Server callback: start listening on our ports */
static void server_start_listener(grpc_server* server, void* arg,
static void server_start_listener(grpc_server* /*server*/, void* arg,
grpc_pollset** pollsets,
size_t pollset_count) {
server_state* state = static_cast<server_state*>(arg);
@ -276,7 +276,7 @@ static void tcp_server_shutdown_complete(void* arg, grpc_error* error) {
/* Server callback: destroy the tcp listener (so we don't generate further
callbacks) */
static void server_destroy_listener(grpc_server* server, void* arg,
static void server_destroy_listener(grpc_server* /*server*/, void* arg,
grpc_closure* destroy_done) {
server_state* state = static_cast<server_state*>(arg);
gpr_mu_lock(&state->mu);

@ -525,7 +525,7 @@ grpc_chttp2_transport::grpc_chttp2_transport(
post_benign_reclaimer(this);
}
static void destroy_transport_locked(void* tp, grpc_error* error) {
static void destroy_transport_locked(void* tp, grpc_error* /*error*/) {
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
t->destroying = 1;
close_transport_locked(
@ -718,7 +718,7 @@ static int init_stream(grpc_transport* gt, grpc_stream* gs,
return 0;
}
static void destroy_stream_locked(void* sp, grpc_error* error) {
static void destroy_stream_locked(void* sp, grpc_error* /*error*/) {
GPR_TIMER_SCOPE("destroy_stream", 0);
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(sp);
s->~grpc_chttp2_stream();
@ -935,7 +935,7 @@ static const char* begin_writing_desc(bool partial) {
}
}
static void write_action_begin_locked(void* gt, grpc_error* error_ignored) {
static void write_action_begin_locked(void* gt, grpc_error* /*error_ignored*/) {
GPR_TIMER_SCOPE("write_action_begin_locked", 0);
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
GPR_ASSERT(t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE);
@ -974,7 +974,7 @@ static void write_action_begin_locked(void* gt, grpc_error* error_ignored) {
}
}
static void write_action(void* gt, grpc_error* error) {
static void write_action(void* gt, grpc_error* /*error*/) {
GPR_TIMER_SCOPE("write_action", 0);
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
void* cl = t->cl;
@ -1181,7 +1181,7 @@ static void null_then_sched_closure(grpc_closure** closure) {
}
void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_chttp2_stream* /*s*/,
grpc_closure** pclosure,
grpc_error* error, const char* desc) {
grpc_closure* closure = *pclosure;
@ -1338,7 +1338,7 @@ static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
}
static void perform_stream_op_locked(void* stream_op,
grpc_error* error_ignored) {
grpc_error* /*error_ignored*/) {
GPR_TIMER_SCOPE("perform_stream_op_locked", 0);
grpc_transport_stream_op_batch* op =
@ -1792,7 +1792,7 @@ void grpc_chttp2_add_ping_strike(grpc_chttp2_transport* t) {
}
static void perform_transport_op_locked(void* stream_op,
grpc_error* error_ignored) {
grpc_error* /*error_ignored*/) {
grpc_transport_op* op = static_cast<grpc_transport_op*>(stream_op);
grpc_chttp2_transport* t =
static_cast<grpc_chttp2_transport*>(op->handler_private.extra_arg);
@ -1854,8 +1854,8 @@ static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
* INPUT PROCESSING - GENERAL
*/
void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
void grpc_chttp2_maybe_complete_recv_initial_metadata(
grpc_chttp2_transport* /*t*/, grpc_chttp2_stream* s) {
if (s->recv_initial_metadata_ready != nullptr &&
s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) {
if (s->seen_error) {
@ -1871,7 +1871,7 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
}
}
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* /*t*/,
grpc_chttp2_stream* s) {
grpc_error* error = GRPC_ERROR_NONE;
if (s->recv_message_ready != nullptr) {
@ -2400,7 +2400,7 @@ typedef struct {
grpc_chttp2_transport* t;
} cancel_stream_cb_args;
static void cancel_stream_cb(void* user_data, uint32_t key, void* stream) {
static void cancel_stream_cb(void* user_data, uint32_t /*key*/, void* stream) {
cancel_stream_cb_args* args = static_cast<cancel_stream_cb_args*>(user_data);
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(stream);
grpc_chttp2_cancel_stream(args->t, s, GRPC_ERROR_REF(args->error));
@ -2909,13 +2909,13 @@ static void connectivity_state_set(grpc_chttp2_transport* t,
* POLLSET STUFF
*/
static void set_pollset(grpc_transport* gt, grpc_stream* gs,
static void set_pollset(grpc_transport* gt, grpc_stream* /*gs*/,
grpc_pollset* pollset) {
grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
grpc_endpoint_add_to_pollset(t->ep, pollset);
}
static void set_pollset_set(grpc_transport* gt, grpc_stream* gs,
static void set_pollset_set(grpc_transport* gt, grpc_stream* /*gs*/,
grpc_pollset_set* pollset_set) {
grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
grpc_endpoint_add_to_pollset_set(t->ep, pollset_set);
@ -2957,7 +2957,7 @@ Chttp2IncomingByteStream::Chttp2IncomingByteStream(
}
void Chttp2IncomingByteStream::OrphanLocked(void* arg,
grpc_error* error_ignored) {
grpc_error* /*error_ignored*/) {
Chttp2IncomingByteStream* bs = static_cast<Chttp2IncomingByteStream*>(arg);
grpc_chttp2_stream* s = bs->stream_;
grpc_chttp2_transport* t = s->t;
@ -2976,7 +2976,7 @@ void Chttp2IncomingByteStream::Orphan() {
}
void Chttp2IncomingByteStream::NextLocked(void* arg,
grpc_error* error_ignored) {
grpc_error* /*error_ignored*/) {
Chttp2IncomingByteStream* bs = static_cast<Chttp2IncomingByteStream*>(arg);
grpc_chttp2_transport* t = bs->transport_;
grpc_chttp2_stream* s = bs->stream_;

@ -40,10 +40,9 @@ grpc_chttp2_data_parser::~grpc_chttp2_data_parser() {
GRPC_ERROR_UNREF(error);
}
grpc_error* grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser* parser,
uint8_t flags,
uint32_t stream_id,
grpc_chttp2_stream* s) {
grpc_error* grpc_chttp2_data_parser_begin_frame(
grpc_chttp2_data_parser* /*parser*/, uint8_t flags, uint32_t stream_id,
grpc_chttp2_stream* s) {
if (flags & ~GRPC_CHTTP2_DATA_FLAG_END_STREAM) {
char* msg;
gpr_asprintf(&msg, "unsupported data flags: 0x%02x", flags);
@ -279,7 +278,7 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
return GRPC_ERROR_NONE;
}
grpc_error* grpc_chttp2_data_parser_parse(void* parser,
grpc_error* grpc_chttp2_data_parser_parse(void* /*parser*/,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
const grpc_slice& slice,

@ -37,7 +37,7 @@ void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p) {
grpc_error* grpc_chttp2_goaway_parser_begin_frame(grpc_chttp2_goaway_parser* p,
uint32_t length,
uint8_t flags) {
uint8_t /*flags*/) {
if (length < 8) {
char* msg;
gpr_asprintf(&msg, "goaway frame too short (%d bytes)", length);
@ -56,7 +56,7 @@ grpc_error* grpc_chttp2_goaway_parser_begin_frame(grpc_chttp2_goaway_parser* p,
grpc_error* grpc_chttp2_goaway_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_chttp2_stream* /*s*/,
const grpc_slice& slice,
int is_last) {
const uint8_t* const beg = GRPC_SLICE_START_PTR(slice);

@ -72,7 +72,7 @@ grpc_error* grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser* parser,
grpc_error* grpc_chttp2_ping_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_chttp2_stream* /*s*/,
const grpc_slice& slice,
int is_last) {
const uint8_t* const beg = GRPC_SLICE_START_PTR(slice);

@ -110,7 +110,7 @@ grpc_error* grpc_chttp2_settings_parser_begin_frame(
}
grpc_error* grpc_chttp2_settings_parser_parse(void* p, grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_chttp2_stream* /*s*/,
const grpc_slice& slice,
int is_last) {
grpc_chttp2_settings_parser* parser =

@ -224,7 +224,7 @@ static void UpdateAddOrEvict(Hashtable hashtable, const ValueType& value,
}
/* halve all counts because an element reached max */
static void HalveFilter(uint8_t idx, uint32_t* sum, uint8_t* elems) {
static void HalveFilter(uint8_t /*idx*/, uint32_t* sum, uint8_t* elems) {
*sum = 0;
for (int i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) {
elems[i] /= 2;
@ -452,8 +452,8 @@ static void add_key(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
}
}
static void emit_indexed(grpc_chttp2_hpack_compressor* c, uint32_t elem_index,
framer_state* st) {
static void emit_indexed(grpc_chttp2_hpack_compressor* /*c*/,
uint32_t elem_index, framer_state* st) {
GRPC_STATS_INC_HPACK_SEND_INDEXED();
uint32_t len = GRPC_CHTTP2_VARINT_LENGTH(elem_index, 1);
GRPC_CHTTP2_WRITE_VARINT(elem_index, 1, 0x80, add_tiny_header_data(st, len),
@ -511,7 +511,7 @@ enum class EmitLitHdrVType { INC_IDX_V, NO_IDX_V };
} // namespace
template <EmitLitHdrType type>
static void emit_lithdr(grpc_chttp2_hpack_compressor* c, uint32_t key_index,
static void emit_lithdr(grpc_chttp2_hpack_compressor* /*c*/, uint32_t key_index,
grpc_mdelem elem, framer_state* st) {
switch (type) {
case EmitLitHdrType::INC_IDX:
@ -549,7 +549,7 @@ static void emit_lithdr(grpc_chttp2_hpack_compressor* c, uint32_t key_index,
}
template <EmitLitHdrVType type>
static void emit_lithdr_v(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
static void emit_lithdr_v(grpc_chttp2_hpack_compressor* /*c*/, grpc_mdelem elem,
framer_state* st) {
switch (type) {
case EmitLitHdrVType::INC_IDX_V:

@ -659,7 +659,7 @@ static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md) {
}
static grpc_core::UnmanagedMemorySlice take_string_extern(
grpc_chttp2_hpack_parser* p, grpc_chttp2_hpack_parser_string* str) {
grpc_chttp2_hpack_parser* /*p*/, grpc_chttp2_hpack_parser_string* str) {
grpc_core::UnmanagedMemorySlice s;
if (!str->copied) {
GPR_DEBUG_ASSERT(!grpc_slice_is_interned(str->data.referenced));
@ -675,7 +675,7 @@ static grpc_core::UnmanagedMemorySlice take_string_extern(
}
static grpc_core::ManagedMemorySlice take_string_intern(
grpc_chttp2_hpack_parser* p, grpc_chttp2_hpack_parser_string* str) {
grpc_chttp2_hpack_parser* /*p*/, grpc_chttp2_hpack_parser_string* str) {
grpc_core::ManagedMemorySlice s;
if (!str->copied) {
s = grpc_core::ManagedMemorySlice(&str->data.referenced);
@ -1067,8 +1067,9 @@ static grpc_error* parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
}
/* a parse error: jam the parse state into parse_error, and return error */
static grpc_error* parse_error(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end, grpc_error* err) {
static grpc_error* parse_error(grpc_chttp2_hpack_parser* p,
const uint8_t* /*cur*/, const uint8_t* /*end*/,
grpc_error* err) {
GPR_ASSERT(err != GRPC_ERROR_NONE);
if (p->last_error == GRPC_ERROR_NONE) {
p->last_error = GRPC_ERROR_REF(err);
@ -1078,7 +1079,8 @@ static grpc_error* parse_error(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
}
static grpc_error* still_parse_error(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
const uint8_t* /*cur*/,
const uint8_t* /*end*/) {
return GRPC_ERROR_REF(p->last_error);
}
@ -1593,7 +1595,8 @@ static grpc_error* parse_value_string_with_literal_key(
}
/* "Uninitialized" header parser to save us a branch in on_hdr(). */
static grpc_error* on_header_uninitialized(void* user_data, grpc_mdelem md) {
static grpc_error* on_header_uninitialized(void* /*user_data*/,
grpc_mdelem md) {
GRPC_MDELEM_UNREF(md);
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set");
}
@ -1666,7 +1669,7 @@ static const maybe_complete_func_type maybe_complete_funcs[] = {
grpc_chttp2_maybe_complete_recv_initial_metadata,
grpc_chttp2_maybe_complete_recv_trailing_metadata};
static void force_client_rst_stream(void* sp, grpc_error* error) {
static void force_client_rst_stream(void* sp, grpc_error* /*error*/) {
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(sp);
grpc_chttp2_transport* t = s->t;
if (!s->write_closed) {
@ -1678,7 +1681,7 @@ static void force_client_rst_stream(void* sp, grpc_error* error) {
GRPC_CHTTP2_STREAM_UNREF(s, "final_rst");
}
static void parse_stream_compression_md(grpc_chttp2_transport* t,
static void parse_stream_compression_md(grpc_chttp2_transport* /*t*/,
grpc_chttp2_stream* s,
grpc_metadata_batch* initial_metadata) {
if (initial_metadata->idx.named.content_encoding == nullptr ||

@ -116,12 +116,13 @@ typedef TraceFlag DebugOnlyTraceFlag;
#else
class DebugOnlyTraceFlag {
public:
constexpr DebugOnlyTraceFlag(bool default_enabled, const char* name) {}
constexpr DebugOnlyTraceFlag(bool /*default_enabled*/, const char* /*name*/) {
}
constexpr bool enabled() const { return false; }
constexpr const char* name() const { return "DebugOnlyTraceFlag"; }
private:
void set_enabled(bool enabled) {}
void set_enabled(bool /*enabled*/) {}
};
#endif

@ -107,7 +107,7 @@ class Allocator {
pointer address(reference x) const { return &x; }
const_pointer address(const_reference x) const { return &x; }
pointer allocate(std::size_t n,
std::allocator<void>::const_pointer hint = nullptr) {
std::allocator<void>::const_pointer /*hint*/ = nullptr) {
return static_cast<pointer>(gpr_malloc(n * sizeof(T)));
}
void deallocate(T* p, std::size_t /* n */) { gpr_free(p); }
@ -132,7 +132,7 @@ bool operator==(Allocator<T> const&, Allocator<U> const&) noexcept {
}
template <class T, class U>
bool operator!=(Allocator<T> const& x, Allocator<U> const& y) noexcept {
bool operator!=(Allocator<T> const& /*x*/, Allocator<U> const& /*y*/) noexcept {
return false;
}

@ -69,7 +69,14 @@ class RefCount {
// Note: RefCount tracing is only enabled on debug builds, even when a
// TraceFlag is used.
template <typename TraceFlagT = TraceFlag>
constexpr explicit RefCount(Value init = 1, TraceFlagT* trace_flag = nullptr)
constexpr explicit RefCount(
Value init = 1,
TraceFlagT*
#ifndef NDEBUG
// Leave unnamed if NDEBUG to avoid unused parameter warning
trace_flag
#endif
= nullptr)
:
#ifndef NDEBUG
trace_flag_(trace_flag),
@ -98,6 +105,10 @@ class RefCount {
prior, prior + n, reason);
}
#else
// Use conditionally-important parameters
(void)location;
(void)reason;
value_.FetchAdd(n, MemoryOrder::RELAXED);
#endif
}
@ -125,6 +136,9 @@ class RefCount {
}
assert(prior > 0);
#else
// Avoid unused-parameter warnings for debug-only parameters
(void)location;
(void)reason;
RefNonZero();
#endif
}
@ -150,6 +164,9 @@ class RefCount {
prior, prior + 1, reason);
}
#endif
// Avoid unused-parameter warnings for debug-only parameters
(void)location;
(void)reason;
return value_.IncrementIfNonzero();
}
@ -184,6 +201,10 @@ class RefCount {
prior - 1, reason);
}
GPR_DEBUG_ASSERT(prior > 0);
#else
// Avoid unused-parameter warnings for debug-only parameters
(void)location;
(void)reason;
#endif
return prior == 1;
}

@ -66,7 +66,7 @@ static grpc_httpcli_get_override g_get_override = nullptr;
static grpc_httpcli_post_override g_post_override = nullptr;
static void plaintext_handshake(void* arg, grpc_endpoint* endpoint,
const char* host, grpc_millis deadline,
const char* /*host*/, grpc_millis /*deadline*/,
void (*on_done)(void* arg,
grpc_endpoint* endpoint)) {
on_done(arg, endpoint);

@ -67,7 +67,7 @@ class grpc_httpcli_ssl_channel_security_connector final
}
void add_handshakers(const grpc_channel_args* args,
grpc_pollset_set* interested_parties,
grpc_pollset_set* /*interested_parties*/,
grpc_core::HandshakeManager* handshake_mgr) override {
tsi_handshaker* handshaker = nullptr;
if (handshaker_factory_ != nullptr) {
@ -86,7 +86,7 @@ class grpc_httpcli_ssl_channel_security_connector final
return handshaker_factory_;
}
void check_peer(tsi_peer peer, grpc_endpoint* ep,
void check_peer(tsi_peer peer, grpc_endpoint* /*ep*/,
grpc_core::RefCountedPtr<grpc_auth_context>* /*auth_context*/,
grpc_closure* on_peer_checked) override {
grpc_error* error = GRPC_ERROR_NONE;
@ -111,15 +111,15 @@ class grpc_httpcli_ssl_channel_security_connector final
return strcmp(secure_peer_name_, other->secure_peer_name_);
}
bool check_call_host(grpc_core::StringView host,
grpc_auth_context* auth_context,
grpc_closure* on_call_host_checked,
bool check_call_host(grpc_core::StringView /*host*/,
grpc_auth_context* /*auth_context*/,
grpc_closure* /*on_call_host_checked*/,
grpc_error** error) override {
*error = GRPC_ERROR_NONE;
return true;
}
void cancel_check_call_host(grpc_closure* on_call_host_checked,
void cancel_check_call_host(grpc_closure* /*on_call_host_checked*/,
grpc_error* error) override {
GRPC_ERROR_UNREF(error);
}
@ -134,7 +134,7 @@ class grpc_httpcli_ssl_channel_security_connector final
static grpc_core::RefCountedPtr<grpc_channel_security_connector>
httpcli_ssl_channel_security_connector_create(
const char* pem_root_certs, const tsi_ssl_root_certs_store* root_store,
const char* secure_peer_name, grpc_channel_args* channel_args) {
const char* secure_peer_name, grpc_channel_args* /*channel_args*/) {
if (secure_peer_name != nullptr && pem_root_certs == nullptr) {
gpr_log(GPR_ERROR,
"Cannot assert a secure peer name without a trust root.");

@ -327,7 +327,7 @@ void grpc_http_parser_init(grpc_http_parser* parser, grpc_http_type type,
parser->cur_line_end_length = 2;
}
void grpc_http_parser_destroy(grpc_http_parser* parser) {}
void grpc_http_parser_destroy(grpc_http_parser* /*parser*/) {}
void grpc_http_request_destroy(grpc_http_request* request) {
size_t i;

@ -39,8 +39,8 @@ void fill_gpr_from_timestamp(gpr_timespec* gts, const struct timespec* ts) {
gts->clock_type = GPR_CLOCK_REALTIME;
}
void default_timestamps_callback(void* arg, grpc_core::Timestamps* ts,
grpc_error* shudown_err) {
void default_timestamps_callback(void* /*arg*/, grpc_core::Timestamps* /*ts*/,
grpc_error* /*shudown_err*/) {
gpr_log(GPR_DEBUG, "Timestamps callback has not been registered");
}
@ -293,9 +293,8 @@ void grpc_tcp_set_write_timestamps_callback(void (*fn)(void*,
#else /* GRPC_LINUX_ERRQUEUE */
namespace grpc_core {
void grpc_tcp_set_write_timestamps_callback(void (*fn)(void*,
grpc_core::Timestamps*,
grpc_error* error)) {
void grpc_tcp_set_write_timestamps_callback(
void (*/*fn*/)(void*, grpc_core::Timestamps*, grpc_error* error)) {
gpr_log(GPR_DEBUG, "Timestamps callback is not enabled for this platform");
}
} /* namespace grpc_core */

@ -146,7 +146,7 @@ class TracedBuffer {
class TracedBuffer {
public:
/* Dummy shutdown function */
static void Shutdown(grpc_core::TracedBuffer** head, void* remaining,
static void Shutdown(grpc_core::TracedBuffer** /*head*/, void* /*remaining*/,
grpc_error* shutdown_err) {
GRPC_ERROR_UNREF(shutdown_err);
}

@ -168,7 +168,7 @@ static void move_next() {
}
}
static void offload(void* arg, grpc_error* error) {
static void offload(void* arg, grpc_error* /*error*/) {
grpc_core::Combiner* lock = static_cast<grpc_core::Combiner*>(arg);
push_last_on_exec_ctx(lock);
}

@ -658,7 +658,7 @@ static int poll_deadline_to_millis_timeout(grpc_millis millis) {
NOTE ON SYNCRHONIZATION: Similar to do_epoll_wait(), this function is only
called by g_active_poller thread. So there is no need for synchronization
when accessing fields in g_epoll_set */
static grpc_error* process_epoll_events(grpc_pollset* pollset) {
static grpc_error* process_epoll_events(grpc_pollset* /*pollset*/) {
GPR_TIMER_SCOPE("process_epoll_events", 0);
static const char* err_desc = "process_events";
@ -1219,7 +1219,7 @@ done:
return ret_err;
}
static void pollset_add_fd(grpc_pollset* pollset, grpc_fd* fd) {}
static void pollset_add_fd(grpc_pollset* /*pollset*/, grpc_fd* /*fd*/) {}
/*******************************************************************************
* Pollset-set Definitions
@ -1229,21 +1229,23 @@ static grpc_pollset_set* pollset_set_create(void) {
return (grpc_pollset_set*)(static_cast<intptr_t>(0xdeafbeef));
}
static void pollset_set_destroy(grpc_pollset_set* pss) {}
static void pollset_set_destroy(grpc_pollset_set* /*pss*/) {}
static void pollset_set_add_fd(grpc_pollset_set* pss, grpc_fd* fd) {}
static void pollset_set_add_fd(grpc_pollset_set* /*pss*/, grpc_fd* /*fd*/) {}
static void pollset_set_del_fd(grpc_pollset_set* pss, grpc_fd* fd) {}
static void pollset_set_del_fd(grpc_pollset_set* /*pss*/, grpc_fd* /*fd*/) {}
static void pollset_set_add_pollset(grpc_pollset_set* pss, grpc_pollset* ps) {}
static void pollset_set_add_pollset(grpc_pollset_set* /*pss*/,
grpc_pollset* /*ps*/) {}
static void pollset_set_del_pollset(grpc_pollset_set* pss, grpc_pollset* ps) {}
static void pollset_set_del_pollset(grpc_pollset_set* /*pss*/,
grpc_pollset* /*ps*/) {}
static void pollset_set_add_pollset_set(grpc_pollset_set* bag,
grpc_pollset_set* item) {}
static void pollset_set_add_pollset_set(grpc_pollset_set* /*bag*/,
grpc_pollset_set* /*item*/) {}
static void pollset_set_del_pollset_set(grpc_pollset_set* bag,
grpc_pollset_set* item) {}
static void pollset_set_del_pollset_set(grpc_pollset_set* /*bag*/,
grpc_pollset_set* /*item*/) {}
/*******************************************************************************
* Event engine binding
@ -1253,8 +1255,8 @@ static bool is_any_background_poller_thread(void) { return false; }
static void shutdown_background_closure(void) {}
static bool add_closure_to_background_poller(grpc_closure* closure,
grpc_error* error) {
static bool add_closure_to_background_poller(grpc_closure* /*closure*/,
grpc_error* /*error*/) {
return false;
}
@ -1325,7 +1327,8 @@ static void reset_event_manager_on_fork() {
/* It is possible that GLIBC has epoll but the underlying kernel doesn't.
* Create epoll_fd (epoll_set_init() takes care of that) to make sure epoll
* support is available */
const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request) {
const grpc_event_engine_vtable* grpc_init_epoll1_linux(
bool /*explicit_request*/) {
if (!grpc_has_wakeup_fd()) {
gpr_log(GPR_ERROR, "Skipping epoll1 because of no wakeup fd.");
return nullptr;
@ -1356,7 +1359,8 @@ const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request) {
#include "src/core/lib/iomgr/ev_epoll1_linux.h"
/* If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return
* NULL */
const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request) {
const grpc_event_engine_vtable* grpc_init_epoll1_linux(
bool /*explicit_request*/) {
return nullptr;
}
#endif /* defined(GRPC_POSIX_SOCKET_EV_EPOLL1) */

@ -352,15 +352,23 @@ static void ref_by(grpc_fd* fd, int n, const char* reason, const char* file,
gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line);
}
#else
#define REF_BY(fd, n, reason) ref_by(fd, n)
#define UNREF_BY(fd, n, reason) unref_by(fd, n)
#define REF_BY(fd, n, reason) \
do { \
ref_by(fd, n); \
(void)(reason); \
} while (0)
#define UNREF_BY(fd, n, reason) \
do { \
unref_by(fd, n); \
(void)(reason); \
} while (0)
static void ref_by(grpc_fd* fd, int n) {
#endif
GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&fd->refst, n) > 0);
}
/* Uninitialize and add to the freelist */
static void fd_destroy(void* arg, grpc_error* error) {
static void fd_destroy(void* arg, grpc_error* /*error*/) {
grpc_fd* fd = static_cast<grpc_fd*>(arg);
fd->destroy();
@ -1042,7 +1050,7 @@ static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
}
static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
grpc_pollset_worker** worker_hdl) {
grpc_pollset_worker** /*worker_hdl*/) {
GPR_TIMER_SCOPE("end_worker", 0);
gpr_mu_lock(&pollset->mu);
gpr_mu_lock(&worker->pollable_obj->mu);
@ -1542,8 +1550,8 @@ static void pollset_set_add_pollset_set(grpc_pollset_set* a,
gpr_mu_unlock(&b->mu);
}
static void pollset_set_del_pollset_set(grpc_pollset_set* bag,
grpc_pollset_set* item) {}
static void pollset_set_del_pollset_set(grpc_pollset_set* /*bag*/,
grpc_pollset_set* /*item*/) {}
/*******************************************************************************
* Event engine binding
@ -1553,8 +1561,8 @@ static bool is_any_background_poller_thread(void) { return false; }
static void shutdown_background_closure(void) {}
static bool add_closure_to_background_poller(grpc_closure* closure,
grpc_error* error) {
static bool add_closure_to_background_poller(grpc_closure* /*closure*/,
grpc_error* /*error*/) {
return false;
}
@ -1603,7 +1611,7 @@ static const grpc_event_engine_vtable vtable = {
};
const grpc_event_engine_vtable* grpc_init_epollex_linux(
bool explicitly_requested) {
bool /*explicitly_requested*/) {
if (!grpc_has_wakeup_fd()) {
gpr_log(GPR_ERROR, "Skipping epollex because of no wakeup fd.");
return nullptr;
@ -1631,7 +1639,7 @@ const grpc_event_engine_vtable* grpc_init_epollex_linux(
/* If GRPC_LINUX_EPOLL_CREATE1 is not defined, it means
epoll_create1 is not available. Return NULL */
const grpc_event_engine_vtable* grpc_init_epollex_linux(
bool explicitly_requested) {
bool /*explicitly_requested*/) {
return nullptr;
}
#endif /* defined(GRPC_POSIX_SOCKET_EV_EPOLLEX) */

@ -323,8 +323,16 @@ static void ref_by(grpc_fd* fd, int n, const char* reason, const char* file,
gpr_atm_no_barrier_load(&fd->refst) + n, reason, file, line);
}
#else
#define REF_BY(fd, n, reason) ref_by(fd, n)
#define UNREF_BY(fd, n, reason) unref_by(fd, n)
#define REF_BY(fd, n, reason) \
do { \
ref_by(fd, n); \
(void)(reason); \
} while (0)
#define UNREF_BY(fd, n, reason) \
do { \
unref_by(fd, n); \
(void)(reason); \
} while (0)
static void ref_by(grpc_fd* fd, int n) {
#endif
GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&fd->refst, n) > 0);
@ -355,6 +363,8 @@ static void unref_by(grpc_fd* fd, int n) {
}
static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
// Avoid unused-parameter warning for debug-only parameter
(void)track_err;
GPR_DEBUG_ASSERT(track_err == false);
grpc_fd* r = static_cast<grpc_fd*>(gpr_malloc(sizeof(*r)));
gpr_mu_init(&r->mu);
@ -560,7 +570,7 @@ static void fd_notify_on_write(grpc_fd* fd, grpc_closure* closure) {
gpr_mu_unlock(&fd->mu);
}
static void fd_notify_on_error(grpc_fd* fd, grpc_closure* closure) {
static void fd_notify_on_error(grpc_fd* /*fd*/, grpc_closure* closure) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_ERROR, "Polling engine does not support tracking errors.");
}
@ -579,7 +589,7 @@ static void fd_set_writable(grpc_fd* fd) {
gpr_mu_unlock(&fd->mu);
}
static void fd_set_error(grpc_fd* fd) {
static void fd_set_error(grpc_fd* /*fd*/) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_ERROR, "Polling engine does not support tracking errors.");
}
@ -696,7 +706,7 @@ static void fd_end_poll(grpc_fd_watcher* watcher, int got_read, int got_write) {
GPR_TLS_DECL(g_current_thread_poller);
GPR_TLS_DECL(g_current_thread_worker);
static void remove_worker(grpc_pollset* p, grpc_pollset_worker* worker) {
static void remove_worker(grpc_pollset* /*p*/, grpc_pollset_worker* worker) {
worker->prev->next = worker->next;
worker->next->prev = worker->prev;
}
@ -1320,8 +1330,8 @@ static bool is_any_background_poller_thread(void) { return false; }
static void shutdown_background_closure(void) {}
static bool add_closure_to_background_poller(grpc_closure* closure,
grpc_error* error) {
static bool add_closure_to_background_poller(grpc_closure* /*closure*/,
grpc_error* /*error*/) {
return false;
}
@ -1392,7 +1402,8 @@ static void reset_event_manager_on_fork() {
gpr_mu_unlock(&fork_fd_list_mu);
}
const grpc_event_engine_vtable* grpc_init_poll_posix(bool explicit_request) {
const grpc_event_engine_vtable* grpc_init_poll_posix(
bool /*explicit_request*/) {
if (!grpc_has_wakeup_fd()) {
gpr_log(GPR_ERROR, "Skipping poll because of no wakeup fd.");
return nullptr;

@ -58,8 +58,7 @@ void ThreadPool::SharedThreadPoolConstructor() {
threads_ = static_cast<ThreadPoolWorker**>(
gpr_zalloc(num_threads_ * sizeof(ThreadPoolWorker*)));
for (int i = 0; i < num_threads_; ++i) {
threads_[i] =
New<ThreadPoolWorker>(thd_name_, this, queue_, thread_options_, i);
threads_[i] = New<ThreadPoolWorker>(thd_name_, queue_, thread_options_, i);
threads_[i]->Start();
}
}

@ -62,9 +62,8 @@ class ThreadPoolInterface {
// NULL closure.
class ThreadPoolWorker {
public:
ThreadPoolWorker(const char* thd_name, ThreadPoolInterface* /*pool*/,
MPMCQueueInterface* queue, Thread::Options& options,
int index)
ThreadPoolWorker(const char* thd_name, MPMCQueueInterface* queue,
Thread::Options& options, int index)
: queue_(queue), thd_name_(thd_name), index_(index) {
thd_ = Thread(thd_name,
[](void* th) { static_cast<ThreadPoolWorker*>(th)->Run(); },

@ -45,7 +45,7 @@ static bool iomgr_platform_is_any_background_poller_thread(void) {
return false;
}
static bool iomgr_platform_add_closure_to_background_poller(
grpc_closure* closure, grpc_error* error) {
grpc_closure* /*closure*/, grpc_error* /*error*/) {
return false;
}

@ -53,7 +53,7 @@ static void pollset_init(grpc_pollset* pollset, gpr_mu** mu) {
*mu = &pollset->mu;
}
static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
static void pollset_shutdown(grpc_pollset* /*pollset*/, grpc_closure* closure) {
GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
GRPC_CLOSURE_SCHED(closure, GRPC_ERROR_NONE);
}
@ -64,7 +64,7 @@ static void pollset_destroy(grpc_pollset* pollset) {
}
static grpc_error* pollset_work(grpc_pollset* pollset,
grpc_pollset_worker** worker_hdl,
grpc_pollset_worker** /*worker_hdl*/,
grpc_millis deadline) {
GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
gpr_mu_unlock(&pollset->mu);
@ -87,8 +87,8 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
return GRPC_ERROR_NONE;
}
static grpc_error* pollset_kick(grpc_pollset* pollset,
grpc_pollset_worker* specific_worker) {
static grpc_error* pollset_kick(grpc_pollset* /*pollset*/,
grpc_pollset_worker* /*specific_worker*/) {
GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
poller_vtable->kick();
return GRPC_ERROR_NONE;

@ -26,19 +26,19 @@ grpc_pollset_set* pollset_set_create(void) {
return (grpc_pollset_set*)((intptr_t)0xdeafbeef);
}
void pollset_set_destroy(grpc_pollset_set* pollset_set) {}
void pollset_set_destroy(grpc_pollset_set* /*pollset_set*/) {}
void pollset_set_add_pollset(grpc_pollset_set* pollset_set,
grpc_pollset* pollset) {}
void pollset_set_add_pollset(grpc_pollset_set* /*pollset_set*/,
grpc_pollset* /*pollset*/) {}
void pollset_set_del_pollset(grpc_pollset_set* pollset_set,
grpc_pollset* pollset) {}
void pollset_set_del_pollset(grpc_pollset_set* /*pollset_set*/,
grpc_pollset* /*pollset*/) {}
void pollset_set_add_pollset_set(grpc_pollset_set* bag,
grpc_pollset_set* item) {}
void pollset_set_add_pollset_set(grpc_pollset_set* /*bag*/,
grpc_pollset_set* /*item*/) {}
void pollset_set_del_pollset_set(grpc_pollset_set* bag,
grpc_pollset_set* item) {}
void pollset_set_del_pollset_set(grpc_pollset_set* /*bag*/,
grpc_pollset_set* /*item*/) {}
static grpc_pollset_set_vtable vtable = {
pollset_set_create, pollset_set_destroy,

@ -151,7 +151,7 @@ static grpc_error* blocking_resolve_address_impl(
}
static void resolve_address_impl(const char* name, const char* default_port,
grpc_pollset_set* interested_parties,
grpc_pollset_set* /*interested_parties*/,
grpc_closure* on_done,
grpc_resolved_addresses** addrs) {
grpc_custom_resolver* r = nullptr;

@ -150,7 +150,7 @@ typedef struct {
/* Callback to be passed to grpc Executor to asynch-ify
* grpc_blocking_resolve_address */
static void do_request_thread(void* rp, grpc_error* error) {
static void do_request_thread(void* rp, grpc_error* /*error*/) {
request* r = static_cast<request*>(rp);
GRPC_CLOSURE_SCHED(r->on_done, grpc_blocking_resolve_address(
r->name, r->default_port, r->addrs_out));
@ -160,7 +160,7 @@ static void do_request_thread(void* rp, grpc_error* error) {
}
static void posix_resolve_address(const char* name, const char* default_port,
grpc_pollset_set* interested_parties,
grpc_pollset_set* /*interested_parties*/,
grpc_closure* on_done,
grpc_resolved_addresses** addrs) {
request* r = static_cast<request*>(gpr_malloc(sizeof(request)));

@ -274,7 +274,7 @@ static bool rq_reclaim_from_per_user_free_pool(
grpc_resource_quota* resource_quota);
static bool rq_reclaim(grpc_resource_quota* resource_quota, bool destructive);
static void rq_step(void* rq, grpc_error* error) {
static void rq_step(void* rq, grpc_error* /*error*/) {
grpc_resource_quota* resource_quota = static_cast<grpc_resource_quota*>(rq);
resource_quota->step_scheduled = false;
do {
@ -479,7 +479,7 @@ static grpc_slice ru_slice_create(grpc_resource_user* resource_user,
* the combiner
*/
static void ru_allocate(void* ru, grpc_error* error) {
static void ru_allocate(void* ru, grpc_error* /*error*/) {
grpc_resource_user* resource_user = static_cast<grpc_resource_user*>(ru);
if (rulist_empty(resource_user->resource_quota,
GRPC_RULIST_AWAITING_ALLOCATION)) {
@ -488,7 +488,7 @@ static void ru_allocate(void* ru, grpc_error* error) {
rulist_add_tail(resource_user, GRPC_RULIST_AWAITING_ALLOCATION);
}
static void ru_add_to_free_pool(void* ru, grpc_error* error) {
static void ru_add_to_free_pool(void* ru, grpc_error* /*error*/) {
grpc_resource_user* resource_user = static_cast<grpc_resource_user*>(ru);
if (!rulist_empty(resource_user->resource_quota,
GRPC_RULIST_AWAITING_ALLOCATION) &&
@ -513,7 +513,7 @@ static bool ru_post_reclaimer(grpc_resource_user* resource_user,
return true;
}
static void ru_post_benign_reclaimer(void* ru, grpc_error* error) {
static void ru_post_benign_reclaimer(void* ru, grpc_error* /*error*/) {
grpc_resource_user* resource_user = static_cast<grpc_resource_user*>(ru);
if (!ru_post_reclaimer(resource_user, false)) return;
if (!rulist_empty(resource_user->resource_quota,
@ -527,7 +527,7 @@ static void ru_post_benign_reclaimer(void* ru, grpc_error* error) {
rulist_add_tail(resource_user, GRPC_RULIST_RECLAIMER_BENIGN);
}
static void ru_post_destructive_reclaimer(void* ru, grpc_error* error) {
static void ru_post_destructive_reclaimer(void* ru, grpc_error* /*error*/) {
grpc_resource_user* resource_user = static_cast<grpc_resource_user*>(ru);
if (!ru_post_reclaimer(resource_user, true)) return;
if (!rulist_empty(resource_user->resource_quota,
@ -543,7 +543,7 @@ static void ru_post_destructive_reclaimer(void* ru, grpc_error* error) {
rulist_add_tail(resource_user, GRPC_RULIST_RECLAIMER_DESTRUCTIVE);
}
static void ru_shutdown(void* ru, grpc_error* error) {
static void ru_shutdown(void* ru, grpc_error* /*error*/) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
gpr_log(GPR_INFO, "RU shutdown %p", ru);
}
@ -561,7 +561,7 @@ static void ru_shutdown(void* ru, grpc_error* error) {
gpr_mu_unlock(&resource_user->mu);
}
static void ru_destroy(void* ru, grpc_error* error) {
static void ru_destroy(void* ru, grpc_error* /*error*/) {
grpc_resource_user* resource_user = static_cast<grpc_resource_user*>(ru);
GPR_ASSERT(gpr_atm_no_barrier_load(&resource_user->refs) == 0);
// Free all the remaining thread quota
@ -611,7 +611,7 @@ typedef struct {
grpc_closure closure;
} rq_resize_args;
static void rq_resize(void* args, grpc_error* error) {
static void rq_resize(void* args, grpc_error* /*error*/) {
rq_resize_args* a = static_cast<rq_resize_args*>(args);
int64_t delta = a->size - a->resource_quota->size;
a->resource_quota->size += delta;
@ -622,7 +622,7 @@ static void rq_resize(void* args, grpc_error* error) {
gpr_free(a);
}
static void rq_reclamation_done(void* rq, grpc_error* error) {
static void rq_reclamation_done(void* rq, grpc_error* /*error*/) {
grpc_resource_quota* resource_quota = static_cast<grpc_resource_quota*>(rq);
resource_quota->reclaiming = false;
rq_step_sched(resource_quota);

@ -84,11 +84,16 @@ grpc_error* grpc_set_socket_no_sigpipe_if_possible(int fd) {
if ((newval != 0) != (val != 0)) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to set SO_NOSIGPIPE");
}
#else
// Avoid unused parameter warning for conditional parameter
(void)fd;
#endif
return GRPC_ERROR_NONE;
}
grpc_error* grpc_set_socket_ip_pktinfo_if_possible(int fd) {
// Use conditionally-important parameter to avoid warning
(void)fd;
#ifdef GRPC_HAVE_IP_PKTINFO
int get_local_ip = 1;
if (0 != setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &get_local_ip,
@ -100,6 +105,8 @@ grpc_error* grpc_set_socket_ip_pktinfo_if_possible(int fd) {
}
grpc_error* grpc_set_socket_ipv6_recvpktinfo_if_possible(int fd) {
// Use conditionally-important parameter to avoid warning
(void)fd;
#ifdef GRPC_HAVE_IPV6_RECVPKTINFO
int get_local_ip = 1;
if (0 != setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &get_local_ip,
@ -256,6 +263,10 @@ void config_default_tcp_user_timeout(bool enable, int timeout, bool is_client) {
/* Set TCP_USER_TIMEOUT */
grpc_error* grpc_set_socket_tcp_user_timeout(
int fd, const grpc_channel_args* channel_args, bool is_client) {
// Use conditionally-important parameter to avoid warning
(void)fd;
(void)channel_args;
(void)is_client;
#ifdef GRPC_HAVE_TCP_USER_TIMEOUT
bool enable;
int timeout;

@ -58,7 +58,7 @@ static void custom_tcp_connect_cleanup(grpc_custom_tcp_connect* connect) {
}
}
static void custom_close_callback(grpc_custom_socket* socket) {}
static void custom_close_callback(grpc_custom_socket* /*socket*/) {}
static void on_alarm(void* acp, grpc_error* error) {
int done;

@ -193,7 +193,7 @@ static void tcp_read_allocation_done(void* tcpp, grpc_error* error) {
}
static void endpoint_read(grpc_endpoint* ep, grpc_slice_buffer* read_slices,
grpc_closure* cb, bool urgent) {
grpc_closure* cb, bool /*urgent*/) {
custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)ep;
GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
GPR_ASSERT(tcp->read_cb == nullptr);
@ -224,7 +224,7 @@ static void custom_write_callback(grpc_custom_socket* socket,
}
static void endpoint_write(grpc_endpoint* ep, grpc_slice_buffer* write_slices,
grpc_closure* cb, void* arg) {
grpc_closure* cb, void* /*arg*/) {
custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)ep;
GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
@ -327,9 +327,9 @@ static grpc_resource_user* endpoint_get_resource_user(grpc_endpoint* ep) {
return tcp->resource_user;
}
static int endpoint_get_fd(grpc_endpoint* ep) { return -1; }
static int endpoint_get_fd(grpc_endpoint* /*ep*/) { return -1; }
static bool endpoint_can_track_err(grpc_endpoint* ep) { return false; }
static bool endpoint_can_track_err(grpc_endpoint* /*ep*/) { return false; }
static grpc_endpoint_vtable vtable = {endpoint_read,
endpoint_write,

@ -161,7 +161,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, grpc_error* error);
static void tcp_drop_uncovered_then_handle_write(void* arg /* grpc_tcp */,
grpc_error* error);
static void done_poller(void* bp, grpc_error* error_ignored) {
static void done_poller(void* bp, grpc_error* /*error_ignored*/) {
backup_poller* p = static_cast<backup_poller*>(bp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "BACKUP_POLLER:%p destroy", p);
@ -170,7 +170,7 @@ static void done_poller(void* bp, grpc_error* error_ignored) {
gpr_free(p);
}
static void run_poller(void* bp, grpc_error* error_ignored) {
static void run_poller(void* bp, grpc_error* /*error_ignored*/) {
backup_poller* p = static_cast<backup_poller*>(bp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
gpr_log(GPR_INFO, "BACKUP_POLLER:%p run", p);
@ -206,7 +206,7 @@ static void run_poller(void* bp, grpc_error* error_ignored) {
}
}
static void drop_uncovered(grpc_tcp* tcp) {
static void drop_uncovered(grpc_tcp* /*tcp*/) {
backup_poller* p = (backup_poller*)gpr_atm_acq_load(&g_backup_poller);
gpr_atm old_count =
gpr_atm_full_fetch_add(&g_uncovered_notifications_pending, -1);
@ -876,15 +876,16 @@ static void tcp_handle_error(void* arg /* grpc_tcp */, grpc_error* error) {
}
#else /* GRPC_LINUX_ERRQUEUE */
static bool tcp_write_with_timestamps(grpc_tcp* tcp, struct msghdr* msg,
size_t sending_length,
ssize_t* sent_length) {
static bool tcp_write_with_timestamps(grpc_tcp* /*tcp*/, struct msghdr* /*msg*/,
size_t /*sending_length*/,
ssize_t* /*sent_length*/) {
gpr_log(GPR_ERROR, "Write with timestamps not supported for this platform");
GPR_ASSERT(0);
return false;
}
static void tcp_handle_error(void* arg /* grpc_tcp */, grpc_error* error) {
static void tcp_handle_error(void* /*arg*/ /* grpc_tcp */,
grpc_error* /*error*/) {
gpr_log(GPR_ERROR, "Error handling is not supported for this platform");
GPR_ASSERT(0);
}

@ -439,13 +439,13 @@ static void tcp_server_start(grpc_tcp_server* server, grpc_pollset** pollsets,
}
}
static unsigned tcp_server_port_fd_count(grpc_tcp_server* s,
unsigned port_index) {
static unsigned tcp_server_port_fd_count(grpc_tcp_server* /*s*/,
unsigned /*port_index*/) {
return 0;
}
static int tcp_server_port_fd(grpc_tcp_server* s, unsigned port_index,
unsigned fd_index) {
static int tcp_server_port_fd(grpc_tcp_server* /*s*/, unsigned /*port_index*/,
unsigned /*fd_index*/) {
return -1;
}
@ -459,7 +459,7 @@ static void tcp_server_shutdown_listeners(grpc_tcp_server* s) {
}
static grpc_core::TcpServerFdHandler* tcp_server_create_fd_handler(
grpc_tcp_server* s) {
grpc_tcp_server* /*s*/) {
return nullptr;
}

@ -124,7 +124,7 @@ static void finish_shutdown(grpc_tcp_server* s) {
gpr_free(s);
}
static void destroyed_port(void* server, grpc_error* error) {
static void destroyed_port(void* server, grpc_error* /*error*/) {
grpc_tcp_server* s = static_cast<grpc_tcp_server*>(server);
gpr_mu_lock(&s->mu);
s->destroyed_ports++;

@ -30,7 +30,7 @@
static grpc_custom_timer_vtable* custom_timer_impl;
void grpc_custom_timer_callback(grpc_custom_timer* t, grpc_error* error) {
void grpc_custom_timer_callback(grpc_custom_timer* t, grpc_error* /*error*/) {
GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
grpc_core::ExecCtx exec_ctx;
@ -75,7 +75,7 @@ static void timer_cancel(grpc_timer* timer) {
}
}
static grpc_timer_check_result timer_check(grpc_millis* next) {
static grpc_timer_check_result timer_check(grpc_millis* /*next*/) {
return GRPC_TIMERS_NOT_CHECKED;
}

@ -260,7 +260,7 @@ static void finish_shutdown(grpc_udp_server* s) {
grpc_core::Delete(s);
}
static void destroyed_port(void* server, grpc_error* error) {
static void destroyed_port(void* server, grpc_error* /*error*/) {
grpc_udp_server* s = static_cast<grpc_udp_server*>(server);
gpr_mu_lock(&s->mu);
s->destroyed_ports++;
@ -495,7 +495,8 @@ void GrpcUdpListener::OnRead(grpc_error* error, void* do_read_arg) {
// static
// Wrapper of grpc_fd_notify_on_write() with a grpc_closure callback interface.
void GrpcUdpListener::fd_notify_on_write_wrapper(void* arg, grpc_error* error) {
void GrpcUdpListener::fd_notify_on_write_wrapper(void* arg,
grpc_error* /*error*/) {
GrpcUdpListener* sp = static_cast<GrpcUdpListener*>(arg);
gpr_mu_lock(sp->mutex());
if (!sp->notify_on_write_armed_) {

@ -287,7 +287,7 @@ void gpr_timers_global_init(void) {}
void gpr_timers_global_destroy(void) {}
void gpr_timers_set_log_filename(const char* filename) {}
void gpr_timers_set_log_filename(const char* /*filename*/) {}
void gpr_timer_set_enabled(int enabled) {}
void gpr_timer_set_enabled(int /*enabled*/) {}
#endif /* GRPC_BASIC_PROFILER */

@ -50,8 +50,8 @@ grpc_alts_credentials::~grpc_alts_credentials() {
grpc_core::RefCountedPtr<grpc_channel_security_connector>
grpc_alts_credentials::create_security_connector(
grpc_core::RefCountedPtr<grpc_call_credentials> call_creds,
const char* target_name, const grpc_channel_args* args,
grpc_channel_args** new_args) {
const char* target_name, const grpc_channel_args* /*args*/,
grpc_channel_args** /*new_args*/) {
return grpc_alts_channel_security_connector_create(
this->Ref(), std::move(call_creds), target_name);
}

@ -31,7 +31,7 @@ static grpc_alts_credentials_options* alts_server_options_copy(
const grpc_alts_credentials_options* options);
static void alts_server_options_destroy(
grpc_alts_credentials_options* options) {}
grpc_alts_credentials_options* /*options*/) {}
static const grpc_alts_credentials_options_vtable vtable = {
alts_server_options_copy, alts_server_options_destroy};

@ -45,7 +45,7 @@ class grpc_fake_channel_credentials final : public grpc_channel_credentials {
create_security_connector(
grpc_core::RefCountedPtr<grpc_call_credentials> call_creds,
const char* target, const grpc_channel_args* args,
grpc_channel_args** new_args) override {
grpc_channel_args** /*new_args*/) override {
return grpc_fake_channel_security_connector_create(
this->Ref(), std::move(call_creds), target, args);
}
@ -89,9 +89,9 @@ const char* grpc_fake_transport_get_expected_targets(
/* -- Metadata-only test credentials. -- */
bool grpc_md_only_test_credentials::get_request_metadata(
grpc_polling_entity* pollent, grpc_auth_metadata_context context,
grpc_polling_entity* /*pollent*/, grpc_auth_metadata_context /*context*/,
grpc_credentials_mdelem_array* md_array, grpc_closure* on_request_metadata,
grpc_error** error) {
grpc_error** /*error*/) {
grpc_credentials_mdelem_array_add(md_array, md_);
if (is_async_) {
GRPC_CLOSURE_SCHED(on_request_metadata, GRPC_ERROR_NONE);
@ -101,7 +101,7 @@ bool grpc_md_only_test_credentials::get_request_metadata(
}
void grpc_md_only_test_credentials::cancel_get_request_metadata(
grpc_credentials_mdelem_array* md_array, grpc_error* error) {
grpc_credentials_mdelem_array* /*md_array*/, grpc_error* error) {
GRPC_ERROR_UNREF(error);
}

@ -66,6 +66,8 @@ grpc_slice GetSystemRootCerts() {
grpc_load_file(kLinuxCertFiles[i], 1, &valid_bundle_slice);
if (error == GRPC_ERROR_NONE) {
return valid_bundle_slice;
} else {
GRPC_ERROR_UNREF(error);
}
}
return grpc_empty_slice();

@ -37,11 +37,8 @@ extern grpc_core::DebugOnlyTraceFlag grpc_trace_metadata;
/* This file provides a mechanism for tracking metadata through the grpc stack.
It's not intended for consumption outside of the library.
Metadata is tracked in the context of a grpc_mdctx. For the time being there
is one of these per-channel, avoiding cross channel interference with memory
use and lock contention.
The context tracks unique strings (grpc_mdstr) and pairs of strings
Metadata is tracked in the context of a sharded global grpc_mdctx. The
context tracks unique strings (grpc_mdstr) and pairs of strings
(grpc_mdelem). Any of these objects can be checked for equality by comparing
their pointers. These objects are reference counted.

@ -97,4 +97,4 @@ grpc_status_code grpc_http2_status_to_grpc_status(int status) {
}
}
int grpc_status_to_http2_status(grpc_status_code status) { return 200; }
int grpc_status_to_http2_status(grpc_status_code /*status*/) { return 200; }

@ -28,7 +28,7 @@
*/
#define STATUS_OFFSET 1
static void destroy_status(void* ignored) {}
static void destroy_status(void* /*ignored*/) {}
grpc_status_code grpc_get_status_code_from_metadata(grpc_mdelem md) {
if (grpc_mdelem_static_value_eq(md, GRPC_MDELEM_GRPC_STATUS_0)) {

@ -80,12 +80,12 @@ grpc_slice grpc_slice_from_stream_owned_buffer(grpc_stream_refcount* refcount,
}
#ifndef NDEBUG
void grpc_stream_ref_init(grpc_stream_refcount* refcount, int initial_refs,
void grpc_stream_ref_init(grpc_stream_refcount* refcount, int /*initial_refs*/,
grpc_iomgr_cb_func cb, void* cb_arg,
const char* object_type) {
refcount->object_type = object_type;
#else
void grpc_stream_ref_init(grpc_stream_refcount* refcount, int initial_refs,
void grpc_stream_ref_init(grpc_stream_refcount* refcount, int /*initial_refs*/,
grpc_iomgr_cb_func cb, void* cb_arg) {
#endif
GRPC_CLOSURE_INIT(&refcount->destroy, cb, cb_arg, grpc_schedule_on_exec_ctx);

@ -72,7 +72,10 @@ void grpc_stream_ref_init(grpc_stream_refcount* refcount, int initial_refs,
void grpc_stream_ref_init(grpc_stream_refcount* refcount, int initial_refs,
grpc_iomgr_cb_func cb, void* cb_arg);
#define GRPC_STREAM_REF_INIT(rc, ir, cb, cb_arg, objtype) \
grpc_stream_ref_init(rc, ir, cb, cb_arg)
do { \
grpc_stream_ref_init(rc, ir, cb, cb_arg); \
(void)(objtype); \
} while (0)
#endif
#ifndef NDEBUG

@ -33,7 +33,7 @@ static void maybe_copy_error_msg(const char* src, char** dst) {
/* Perform input santity check. */
static grpc_status_code unseal_check(alts_crypter* c, const unsigned char* data,
size_t data_allocated_size,
size_t /*data_allocated_size*/,
size_t data_size, size_t* output_size,
char** error_details) {
/* Do common input sanity check. */

@ -30,7 +30,7 @@ alts_shared_resource_dedicated* grpc_alts_get_shared_resource_dedicated(void) {
return &g_alts_resource_dedicated;
}
static void thread_worker(void* arg) {
static void thread_worker(void* /*arg*/) {
while (true) {
grpc_event event =
grpc_completion_queue_next(g_alts_resource_dedicated.cq,

@ -264,18 +264,18 @@ static void on_handshaker_service_resp_recv(void* arg, grpc_error* error) {
/* gRPC provided callback used when dedicatd CQ and thread are used.
* It serves to safely bring the control back to application. */
static void on_handshaker_service_resp_recv_dedicated(void* arg,
grpc_error* error) {
grpc_error* /*error*/) {
alts_shared_resource_dedicated* resource =
grpc_alts_get_shared_resource_dedicated();
grpc_cq_end_op(resource->cq, arg, GRPC_ERROR_NONE,
[](void* done_arg, grpc_cq_completion* storage) {}, nullptr,
&resource->storage);
[](void* /*done_arg*/, grpc_cq_completion* /*storage*/) {},
nullptr, &resource->storage);
}
static tsi_result handshaker_next(
tsi_handshaker* self, const unsigned char* received_bytes,
size_t received_bytes_size, const unsigned char** bytes_to_send,
size_t* bytes_to_send_size, tsi_handshaker_result** result,
size_t received_bytes_size, const unsigned char** /*bytes_to_send*/,
size_t* /*bytes_to_send_size*/, tsi_handshaker_result** /*result*/,
tsi_handshaker_on_next_done_cb cb, void* user_data) {
if (self == nullptr || cb == nullptr) {
gpr_log(GPR_ERROR, "Invalid arguments to handshaker_next()");

@ -495,7 +495,7 @@ typedef struct {
} fake_handshaker_result;
static tsi_result fake_handshaker_result_extract_peer(
const tsi_handshaker_result* self, tsi_peer* peer) {
const tsi_handshaker_result* /*self*/, tsi_peer* peer) {
/* Construct a tsi_peer with 1 property: certificate type. */
tsi_result result = tsi_construct_peer(1, peer);
if (result != TSI_OK) return result;
@ -507,7 +507,8 @@ static tsi_result fake_handshaker_result_extract_peer(
}
static tsi_result fake_handshaker_result_create_zero_copy_grpc_protector(
const tsi_handshaker_result* self, size_t* max_output_protected_frame_size,
const tsi_handshaker_result* /*self*/,
size_t* max_output_protected_frame_size,
tsi_zero_copy_grpc_protector** protector) {
*protector =
tsi_create_fake_zero_copy_grpc_protector(max_output_protected_frame_size);
@ -515,8 +516,8 @@ static tsi_result fake_handshaker_result_create_zero_copy_grpc_protector(
}
static tsi_result fake_handshaker_result_create_frame_protector(
const tsi_handshaker_result* self, size_t* max_output_protected_frame_size,
tsi_frame_protector** protector) {
const tsi_handshaker_result* /*self*/,
size_t* max_output_protected_frame_size, tsi_frame_protector** protector) {
*protector = tsi_create_fake_frame_protector(max_output_protected_frame_size);
return TSI_OK;
}
@ -670,7 +671,7 @@ static tsi_result fake_handshaker_next(
tsi_handshaker* self, const unsigned char* received_bytes,
size_t received_bytes_size, const unsigned char** bytes_to_send,
size_t* bytes_to_send_size, tsi_handshaker_result** handshaker_result,
tsi_handshaker_on_next_done_cb cb, void* user_data) {
tsi_handshaker_on_next_done_cb /*cb*/, void* /*user_data*/) {
/* Sanity check the arguments. */
if ((received_bytes_size > 0 && received_bytes == nullptr) ||
bytes_to_send == nullptr || bytes_to_send_size == nullptr ||

@ -105,12 +105,13 @@ tsi_result local_zero_copy_grpc_protector_create(
/* --- tsi_handshaker_result methods implementation. --- */
static tsi_result handshaker_result_extract_peer(
const tsi_handshaker_result* self, tsi_peer* peer) {
const tsi_handshaker_result* /*self*/, tsi_peer* /*peer*/) {
return TSI_OK;
}
static tsi_result handshaker_result_create_zero_copy_grpc_protector(
const tsi_handshaker_result* self, size_t* max_output_protected_frame_size,
const tsi_handshaker_result* self,
size_t* /*max_output_protected_frame_size*/,
tsi_zero_copy_grpc_protector** protector) {
if (self == nullptr || protector == nullptr) {
gpr_log(GPR_ERROR,
@ -158,10 +159,10 @@ static tsi_result create_handshaker_result(bool is_client,
/* --- tsi_handshaker methods implementation. --- */
static tsi_result handshaker_next(
tsi_handshaker* self, const unsigned char* received_bytes,
size_t received_bytes_size, const unsigned char** bytes_to_send,
tsi_handshaker* self, const unsigned char* /*received_bytes*/,
size_t /*received_bytes_size*/, const unsigned char** /*bytes_to_send*/,
size_t* bytes_to_send_size, tsi_handshaker_result** result,
tsi_handshaker_on_next_done_cb cb, void* user_data) {
tsi_handshaker_on_next_done_cb /*cb*/, void* /*user_data*/) {
if (self == nullptr) {
gpr_log(GPR_ERROR, "Invalid arguments to handshaker_next()");
return TSI_INVALID_ARGUMENT;

@ -28,18 +28,20 @@
namespace tsi {
static void cache_key_avl_destroy(void* key, void* unused) {}
static void cache_key_avl_destroy(void* /*key*/, void* /*unused*/) {}
static void* cache_key_avl_copy(void* key, void* unused) { return key; }
static void* cache_key_avl_copy(void* key, void* /*unused*/) { return key; }
static long cache_key_avl_compare(void* key1, void* key2, void* unused) {
static long cache_key_avl_compare(void* key1, void* key2, void* /*unused*/) {
return grpc_slice_cmp(*static_cast<grpc_slice*>(key1),
*static_cast<grpc_slice*>(key2));
}
static void cache_value_avl_destroy(void* value, void* unused) {}
static void cache_value_avl_destroy(void* /*value*/, void* /*unused*/) {}
static void* cache_value_avl_copy(void* value, void* unused) { return value; }
static void* cache_value_avl_copy(void* value, void* /*unused*/) {
return value;
}
// AVL only stores pointers, ownership belonges to the linked list.
static const grpc_avl_vtable cache_avl_vtable = {

@ -774,7 +774,7 @@ static tsi_result build_alpn_protocol_name_list(
// the server's certificate, but we need to pull it anyway, in case a higher
// layer wants to look at it. In this case the verification may fail, but
// we don't really care.
static int NullVerifyCallback(int preverify_ok, X509_STORE_CTX* ctx) {
static int NullVerifyCallback(int /*preverify_ok*/, X509_STORE_CTX* /*ctx*/) {
return 1;
}
@ -1265,7 +1265,7 @@ static tsi_result ssl_handshaker_next(
tsi_handshaker* self, const unsigned char* received_bytes,
size_t received_bytes_size, const unsigned char** bytes_to_send,
size_t* bytes_to_send_size, tsi_handshaker_result** handshaker_result,
tsi_handshaker_on_next_done_cb cb, void* user_data) {
tsi_handshaker_on_next_done_cb /*cb*/, void* /*user_data*/) {
/* Input sanity check. */
if ((received_bytes_size > 0 && received_bytes == nullptr) ||
bytes_to_send == nullptr || bytes_to_send_size == nullptr ||
@ -1465,11 +1465,9 @@ static void tsi_ssl_client_handshaker_factory_destroy(
gpr_free(self);
}
static int client_handshaker_factory_npn_callback(SSL* ssl, unsigned char** out,
unsigned char* outlen,
const unsigned char* in,
unsigned int inlen,
void* arg) {
static int client_handshaker_factory_npn_callback(
SSL* /*ssl*/, unsigned char** out, unsigned char* outlen,
const unsigned char* in, unsigned int inlen, void* arg) {
tsi_ssl_client_handshaker_factory* factory =
static_cast<tsi_ssl_client_handshaker_factory*>(arg);
return select_protocol_list((const unsigned char**)out, outlen,
@ -1556,7 +1554,8 @@ static int does_entry_match_name(grpc_core::StringView entry,
return !entry.empty() && name_subdomain == entry;
}
static int ssl_server_handshaker_factory_servername_callback(SSL* ssl, int* ap,
static int ssl_server_handshaker_factory_servername_callback(SSL* ssl,
int* /*ap*/,
void* arg) {
tsi_ssl_server_handshaker_factory* impl =
static_cast<tsi_ssl_server_handshaker_factory*>(arg);
@ -1579,7 +1578,7 @@ static int ssl_server_handshaker_factory_servername_callback(SSL* ssl, int* ap,
#if TSI_OPENSSL_ALPN_SUPPORT
static int server_handshaker_factory_alpn_callback(
SSL* ssl, const unsigned char** out, unsigned char* outlen,
SSL* /*ssl*/, const unsigned char** out, unsigned char* outlen,
const unsigned char* in, unsigned int inlen, void* arg) {
tsi_ssl_server_handshaker_factory* factory =
static_cast<tsi_ssl_server_handshaker_factory*>(arg);
@ -1590,7 +1589,7 @@ static int server_handshaker_factory_alpn_callback(
#endif /* TSI_OPENSSL_ALPN_SUPPORT */
static int server_handshaker_factory_npn_advertised_callback(
SSL* ssl, const unsigned char** out, unsigned int* outlen, void* arg) {
SSL* /*ssl*/, const unsigned char** out, unsigned int* outlen, void* arg) {
tsi_ssl_server_handshaker_factory* factory =
static_cast<tsi_ssl_server_handshaker_factory*>(arg);
*out = factory->alpn_protocol_list;

@ -180,7 +180,7 @@ class TagSaver final : public ::grpc::internal::CompletionQueueTag {
public:
explicit TagSaver(void* tag) : tag_(tag) {}
~TagSaver() override {}
bool FinalizeResult(void** tag, bool* status) override {
bool FinalizeResult(void** tag, bool* /*status*/) override {
*tag = tag_;
delete this;
return true;

@ -39,8 +39,8 @@ class DefaultGlobalClientCallbacks final
: public ClientContext::GlobalCallbacks {
public:
~DefaultGlobalClientCallbacks() override {}
void DefaultConstructor(ClientContext* context) override {}
void Destructor(ClientContext* context) override {}
void DefaultConstructor(ClientContext* /*context*/) override {}
void Destructor(ClientContext* /*context*/) override {}
};
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;

@ -41,7 +41,7 @@ class AlarmImpl : public ::grpc::internal::CompletionQueueTag {
grpc_timer_init_unset(&timer_);
}
~AlarmImpl() {}
bool FinalizeResult(void** tag, bool* status) override {
bool FinalizeResult(void** tag, bool* /*status*/) override {
*tag = tag_;
Unref();
return true;
@ -53,22 +53,23 @@ class AlarmImpl : public ::grpc::internal::CompletionQueueTag {
cq_ = cq->cq();
tag_ = tag;
GPR_ASSERT(grpc_cq_begin_op(cq_, this));
GRPC_CLOSURE_INIT(&on_alarm_,
[](void* arg, grpc_error* error) {
// queue the op on the completion queue
AlarmImpl* alarm = static_cast<AlarmImpl*>(arg);
alarm->Ref();
// Preserve the cq and reset the cq_ so that the alarm
// can be reset when the alarm tag is delivered.
grpc_completion_queue* cq = alarm->cq_;
alarm->cq_ = nullptr;
grpc_cq_end_op(
cq, alarm, error,
[](void* arg, grpc_cq_completion* completion) {},
arg, &alarm->completion_);
GRPC_CQ_INTERNAL_UNREF(cq, "alarm");
},
this, grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(
&on_alarm_,
[](void* arg, grpc_error* error) {
// queue the op on the completion queue
AlarmImpl* alarm = static_cast<AlarmImpl*>(arg);
alarm->Ref();
// Preserve the cq and reset the cq_ so that the alarm
// can be reset when the alarm tag is delivered.
grpc_completion_queue* cq = alarm->cq_;
alarm->cq_ = nullptr;
grpc_cq_end_op(
cq, alarm, error,
[](void* /*arg*/, grpc_cq_completion* /*completion*/) {}, arg,
&alarm->completion_);
GRPC_CQ_INTERNAL_UNREF(cq, "alarm");
},
this, grpc_schedule_on_exec_ctx);
grpc_timer_init(&timer_, grpc_timespec_to_millis_round_up(deadline),
&on_alarm_);
}

@ -31,7 +31,8 @@ std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
args->SetString(name_, value_);
}
virtual void UpdatePlugins(
std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override {}
std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/)
override {}
private:
const grpc::string name_;
@ -51,7 +52,8 @@ std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
args->SetInt(name_, value_);
}
virtual void UpdatePlugins(
std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override {}
std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/)
override {}
private:
const grpc::string name_;

@ -30,6 +30,6 @@ void HealthCheckServiceServerBuilderOption::UpdateArguments(
}
void HealthCheckServiceServerBuilderOption::UpdatePlugins(
std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) {}
std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/) {}
} // namespace grpc

@ -74,6 +74,9 @@ class ServerContext::CompletionOp final
// But this class is not trivially destructible, so must actually call delete
// before allowing the arena to be freed
static void operator delete(void* /*ptr*/, std::size_t size) {
// Use size to avoid unused-parameter warning since assert seems to be
// compiled out and treated as unused in some gcc optimized versions.
(void)size;
assert(size == sizeof(CompletionOp));
}

File diff suppressed because it is too large Load Diff

@ -20,6 +20,7 @@ import threading
import time
import grpc
import grpc.experimental
from grpc import _compression
from grpc import _common
from grpc import _grpcio_metadata
@ -248,16 +249,47 @@ def _consume_request_iterator(request_iterator, state, call, request_serializer,
consumption_thread.start()
class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too-many-ancestors
class _SingleThreadedRendezvous(grpc.RpcError, grpc.Call): # pylint: disable=too-many-ancestors
"""An RPC iterator operating entirely on a single thread.
The __next__ method of _SingleThreadedRendezvous does not depend on the
existence of any other thread, including the "channel spin thread".
However, this means that its interface is entirely synchronous. So this
class cannot fulfill the grpc.Future interface.
Attributes:
_state: An instance of _RPCState.
_call: An instance of SegregatedCall or (for subclasses) IntegratedCall.
In either case, the _call object is expected to have operate, cancel,
and next_event methods.
_response_deserializer: A callable taking bytes and return a Python
object.
_deadline: A float representing the deadline of the RPC in seconds. Or
possibly None, to represent an RPC with no deadline at all.
"""
def __init__(self, state, call, response_deserializer, deadline):
super(_Rendezvous, self).__init__()
super(_SingleThreadedRendezvous, self).__init__()
self._state = state
self._call = call
self._response_deserializer = response_deserializer
self._deadline = deadline
def is_active(self):
"""See grpc.RpcContext.is_active"""
with self._state.condition:
return self._state.code is None
def time_remaining(self):
"""See grpc.RpcContext.time_remaining"""
with self._state.condition:
if self._deadline is None:
return None
else:
return max(self._deadline - time.time(), 0)
def cancel(self):
"""See grpc.RpcContext.cancel"""
with self._state.condition:
if self._state.code is None:
code = grpc.StatusCode.CANCELLED
@ -267,7 +299,154 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too
self._state.cancelled = True
_abort(self._state, code, details)
self._state.condition.notify_all()
return False
return True
else:
return False
def add_callback(self, callback):
"""See grpc.RpcContext.add_callback"""
with self._state.condition:
if self._state.callbacks is None:
return False
else:
self._state.callbacks.append(callback)
return True
def initial_metadata(self):
"""See grpc.Call.initial_metadata"""
with self._state.condition:
def _done():
return self._state.initial_metadata is not None
_common.wait(self._state.condition.wait, _done)
return self._state.initial_metadata
def trailing_metadata(self):
"""See grpc.Call.trailing_metadata"""
with self._state.condition:
def _done():
return self._state.trailing_metadata is not None
_common.wait(self._state.condition.wait, _done)
return self._state.trailing_metadata
# TODO(https://github.com/grpc/grpc/issues/20763): Drive RPC progress using
# the calling thread.
def code(self):
"""See grpc.Call.code"""
with self._state.condition:
def _done():
return self._state.code is not None
_common.wait(self._state.condition.wait, _done)
return self._state.code
def details(self):
"""See grpc.Call.details"""
with self._state.condition:
def _done():
return self._state.details is not None
_common.wait(self._state.condition.wait, _done)
return _common.decode(self._state.details)
def _next(self):
with self._state.condition:
if self._state.code is None:
operating = self._call.operate(
(cygrpc.ReceiveMessageOperation(_EMPTY_FLAGS),), None)
if operating:
self._state.due.add(cygrpc.OperationType.receive_message)
elif self._state.code is grpc.StatusCode.OK:
raise StopIteration()
else:
raise self
while True:
event = self._call.next_event()
with self._state.condition:
callbacks = _handle_event(event, self._state,
self._response_deserializer)
for callback in callbacks:
try:
callback()
except Exception as e: # pylint: disable=broad-except
# NOTE(rbellevi): We suppress but log errors here so as not to
# kill the channel spin thread.
logging.error('Exception in callback %s: %s',
repr(callback.func), repr(e))
if self._state.response is not None:
response = self._state.response
self._state.response = None
return response
elif cygrpc.OperationType.receive_message not in self._state.due:
if self._state.code is grpc.StatusCode.OK:
raise StopIteration()
elif self._state.code is not None:
raise self
def __next__(self):
return self._next()
def next(self):
return self._next()
def __iter__(self):
return self
def debug_error_string(self):
with self._state.condition:
def _done():
return self._state.debug_error_string is not None
_common.wait(self._state.condition.wait, _done)
return _common.decode(self._state.debug_error_string)
def _repr(self):
with self._state.condition:
if self._state.code is None:
return '<{} object of in-flight RPC>'.format(
self.__class__.__name__)
elif self._state.code is grpc.StatusCode.OK:
return _OK_RENDEZVOUS_REPR_FORMAT.format(
self._state.code, self._state.details)
else:
return _NON_OK_RENDEZVOUS_REPR_FORMAT.format(
self._state.code, self._state.details,
self._state.debug_error_string)
def __repr__(self):
return self._repr()
def __str__(self):
return self._repr()
def __del__(self):
with self._state.condition:
if self._state.code is None:
self._state.code = grpc.StatusCode.CANCELLED
self._state.details = 'Cancelled upon garbage collection!'
self._state.cancelled = True
self._call.cancel(
_common.STATUS_CODE_TO_CYGRPC_STATUS_CODE[self._state.code],
self._state.details)
self._state.condition.notify_all()
class _Rendezvous(_SingleThreadedRendezvous, grpc.Future): # pylint: disable=too-many-ancestors
"""An RPC iterator that depends on a channel spin thread.
This iterator relies upon a per-channel thread running in the background,
dequeueing events from the completion queue, and notifying threads waiting
on the threading.Condition object in the _RPCState object.
This extra thread allows _Rendezvous to fulfill the grpc.Future interface
and to mediate a bidirection streaming RPC.
"""
def cancelled(self):
with self._state.condition:
@ -381,25 +560,6 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too
elif self._state.code is not None:
raise self
def __iter__(self):
return self
def __next__(self):
return self._next()
def next(self):
return self._next()
def is_active(self):
with self._state.condition:
return self._state.code is None
def time_remaining(self):
if self._deadline is None:
return None
else:
return max(self._deadline - time.time(), 0)
def add_callback(self, callback):
with self._state.condition:
if self._state.callbacks is None:
@ -408,80 +568,6 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too
self._state.callbacks.append(callback)
return True
def initial_metadata(self):
with self._state.condition:
def _done():
return self._state.initial_metadata is not None
_common.wait(self._state.condition.wait, _done)
return self._state.initial_metadata
def trailing_metadata(self):
with self._state.condition:
def _done():
return self._state.trailing_metadata is not None
_common.wait(self._state.condition.wait, _done)
return self._state.trailing_metadata
def code(self):
with self._state.condition:
def _done():
return self._state.code is not None
_common.wait(self._state.condition.wait, _done)
return self._state.code
def details(self):
with self._state.condition:
def _done():
return self._state.details is not None
_common.wait(self._state.condition.wait, _done)
return _common.decode(self._state.details)
def debug_error_string(self):
with self._state.condition:
def _done():
return self._state.debug_error_string is not None
_common.wait(self._state.condition.wait, _done)
return _common.decode(self._state.debug_error_string)
def _repr(self):
with self._state.condition:
if self._state.code is None:
return '<_Rendezvous object of in-flight RPC>'
elif self._state.code is grpc.StatusCode.OK:
return _OK_RENDEZVOUS_REPR_FORMAT.format(
self._state.code, self._state.details)
else:
return _NON_OK_RENDEZVOUS_REPR_FORMAT.format(
self._state.code, self._state.details,
self._state.debug_error_string)
def __repr__(self):
return self._repr()
def __str__(self):
return self._repr()
def __del__(self):
with self._state.condition:
if self._state.code is None:
self._state.code = grpc.StatusCode.CANCELLED
self._state.details = 'Cancelled upon garbage collection!'
self._state.cancelled = True
self._call.cancel(
_common.STATUS_CODE_TO_CYGRPC_STATUS_CODE[self._state.code],
self._state.details)
self._state.condition.notify_all()
def _start_unary_request(request, timeout, request_serializer):
deadline = _deadline(timeout)
@ -636,6 +722,54 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
deadline)
class _SingleThreadedUnaryStreamMultiCallable(grpc.UnaryStreamMultiCallable):
# pylint: disable=too-many-arguments
def __init__(self, channel, method, request_serializer,
response_deserializer):
self._channel = channel
self._method = method
self._request_serializer = request_serializer
self._response_deserializer = response_deserializer
self._context = cygrpc.build_census_context()
def __call__( # pylint: disable=too-many-locals
self,
request,
timeout=None,
metadata=None,
credentials=None,
wait_for_ready=None,
compression=None):
deadline = _deadline(timeout)
serialized_request = _common.serialize(request,
self._request_serializer)
if serialized_request is None:
state = _RPCState((), (), (), grpc.StatusCode.INTERNAL,
'Exception serializing request!')
raise _Rendezvous(state, None, None, deadline)
state = _RPCState(_UNARY_STREAM_INITIAL_DUE, None, None, None, None)
call_credentials = None if credentials is None else credentials._credentials
initial_metadata_flags = _InitialMetadataFlags().with_wait_for_ready(
wait_for_ready)
augmented_metadata = _compression.augment_metadata(
metadata, compression)
operations_and_tags = ((
(cygrpc.SendInitialMetadataOperation(augmented_metadata,
initial_metadata_flags),
cygrpc.SendMessageOperation(serialized_request, _EMPTY_FLAGS),
cygrpc.SendCloseFromClientOperation(_EMPTY_FLAGS),
cygrpc.ReceiveStatusOnClientOperation(_EMPTY_FLAGS)), None),) + (((
cygrpc.ReceiveInitialMetadataOperation(_EMPTY_FLAGS),), None),)
call = self._channel.segregated_call(
cygrpc.PropagationConstants.GRPC_PROPAGATE_DEFAULTS, self._method,
None, _determine_deadline(deadline), metadata, call_credentials,
operations_and_tags, self._context)
return _SingleThreadedRendezvous(state, call,
self._response_deserializer, deadline)
class _UnaryStreamMultiCallable(grpc.UnaryStreamMultiCallable):
# pylint: disable=too-many-arguments
@ -1042,6 +1176,18 @@ def _augment_options(base_options, compression):
),)
def _separate_channel_options(options):
"""Separates core channel options from Python channel options."""
core_options = []
python_options = []
for pair in options:
if pair[0] == grpc.experimental.ChannelOptions.SingleThreadedUnaryStream:
python_options.append(pair)
else:
core_options.append(pair)
return python_options, core_options
class Channel(grpc.Channel):
"""A cygrpc.Channel-backed implementation of grpc.Channel."""
@ -1055,13 +1201,22 @@ class Channel(grpc.Channel):
compression: An optional value indicating the compression method to be
used over the lifetime of the channel.
"""
python_options, core_options = _separate_channel_options(options)
self._single_threaded_unary_stream = False
self._process_python_options(python_options)
self._channel = cygrpc.Channel(
_common.encode(target), _augment_options(options, compression),
_common.encode(target), _augment_options(core_options, compression),
credentials)
self._call_state = _ChannelCallState(self._channel)
self._connectivity_state = _ChannelConnectivityState(self._channel)
cygrpc.fork_register_channel(self)
def _process_python_options(self, python_options):
"""Sets channel attributes according to python-only channel options."""
for pair in python_options:
if pair[0] == grpc.experimental.ChannelOptions.SingleThreadedUnaryStream:
self._single_threaded_unary_stream = True
def subscribe(self, callback, try_to_connect=None):
_subscribe(self._connectivity_state, callback, try_to_connect)
@ -1080,9 +1235,21 @@ class Channel(grpc.Channel):
method,
request_serializer=None,
response_deserializer=None):
return _UnaryStreamMultiCallable(
self._channel, _channel_managed_call_management(self._call_state),
_common.encode(method), request_serializer, response_deserializer)
# NOTE(rbellevi): Benchmarks have shown that running a unary-stream RPC
# on a single Python thread results in an appreciable speed-up. However,
# due to slight differences in capability, the multi-threaded variant'
# remains the default.
if self._single_threaded_unary_stream:
return _SingleThreadedUnaryStreamMultiCallable(
self._channel, _common.encode(method), request_serializer,
response_deserializer)
else:
return _UnaryStreamMultiCallable(self._channel,
_channel_managed_call_management(
self._call_state),
_common.encode(method),
request_serializer,
response_deserializer)
def stream_unary(self,
method,

@ -420,8 +420,6 @@ cdef _close(Channel channel, grpc_status_code code, object details,
else:
while state.integrated_call_states:
state.condition.wait()
while state.segregated_call_states:
state.condition.wait()
while state.connectivity_due:
state.condition.wait()

@ -15,3 +15,14 @@
These APIs are subject to be removed during any minor version release.
"""
class ChannelOptions(object):
"""Indicates a channel option unique to gRPC Python.
This enumeration is part of an EXPERIMENTAL API.
Attributes:
SingleThreadedUnaryStream: Perform unary-stream RPCs on a single thread.
"""
SingleThreadedUnaryStream = "SingleThreadedUnaryStream"

@ -0,0 +1,30 @@
load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library")
proto_library(
name = "unary_stream_benchmark_proto",
srcs = ["unary_stream_benchmark.proto"],
deps = [],
)
py_proto_library(
name = "unary_stream_benchmark_py_pb2",
deps = [":unary_stream_benchmark_proto"],
)
py_grpc_library(
name = "unary_stream_benchmark_py_pb2_grpc",
srcs = [":unary_stream_benchmark_proto"],
deps = [":unary_stream_benchmark_py_pb2"],
)
py_binary(
name = "unary_stream_benchmark",
srcs_version = "PY3",
python_version = "PY3",
srcs = ["unary_stream_benchmark.py"],
deps = [
"//src/python/grpcio/grpc:grpcio",
":unary_stream_benchmark_py_pb2",
":unary_stream_benchmark_py_pb2_grpc",
]
)

@ -0,0 +1,27 @@
// Copyright 2019 The 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.
syntax = "proto3";
message BenchmarkRequest {
int32 message_size = 1;
int32 response_count = 2;
}
message BenchmarkResponse {
bytes response = 1;
}
service UnaryStreamBenchmarkService {
rpc Benchmark(BenchmarkRequest) returns (stream BenchmarkResponse);
}

@ -0,0 +1,104 @@
# Copyright 2019 The 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.
import datetime
import threading
import grpc
import grpc.experimental
import subprocess
import sys
import time
import contextlib
_PORT = 5741
_MESSAGE_SIZE = 4
_RESPONSE_COUNT = 32 * 1024
_SERVER_CODE = """
import datetime
import threading
import grpc
from concurrent import futures
from src.python.grpcio_tests.tests.stress import unary_stream_benchmark_pb2
from src.python.grpcio_tests.tests.stress import unary_stream_benchmark_pb2_grpc
class Handler(unary_stream_benchmark_pb2_grpc.UnaryStreamBenchmarkServiceServicer):
def Benchmark(self, request, context):
payload = b'\\x00\\x01' * int(request.message_size / 2)
for _ in range(request.response_count):
yield unary_stream_benchmark_pb2.BenchmarkResponse(response=payload)
server = grpc.server(futures.ThreadPoolExecutor(max_workers=1))
server.add_insecure_port('[::]:%d')
unary_stream_benchmark_pb2_grpc.add_UnaryStreamBenchmarkServiceServicer_to_server(Handler(), server)
server.start()
server.wait_for_termination()
""" % _PORT
try:
from src.python.grpcio_tests.tests.stress import unary_stream_benchmark_pb2
from src.python.grpcio_tests.tests.stress import unary_stream_benchmark_pb2_grpc
_GRPC_CHANNEL_OPTIONS = [
('grpc.max_metadata_size', 16 * 1024 * 1024),
('grpc.max_receive_message_length', 64 * 1024 * 1024),
(grpc.experimental.ChannelOptions.SingleThreadedUnaryStream, 1),
]
@contextlib.contextmanager
def _running_server():
server_process = subprocess.Popen(
[sys.executable, '-c', _SERVER_CODE],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
try:
yield
finally:
server_process.terminate()
server_process.wait()
sys.stdout.write("stdout: {}".format(server_process.stdout.read()))
sys.stdout.flush()
sys.stdout.write("stderr: {}".format(server_process.stderr.read()))
sys.stdout.flush()
def profile(message_size, response_count):
request = unary_stream_benchmark_pb2.BenchmarkRequest(
message_size=message_size, response_count=response_count)
with grpc.insecure_channel(
'[::]:{}'.format(_PORT),
options=_GRPC_CHANNEL_OPTIONS) as channel:
stub = unary_stream_benchmark_pb2_grpc.UnaryStreamBenchmarkServiceStub(
channel)
start = datetime.datetime.now()
call = stub.Benchmark(request, wait_for_ready=True)
for message in call:
pass
end = datetime.datetime.now()
return end - start
def main():
with _running_server():
for i in range(1000):
latency = profile(_MESSAGE_SIZE, 1024)
sys.stdout.write("{}\n".format(latency.total_seconds()))
sys.stdout.flush()
if __name__ == '__main__':
main()
except ImportError:
# NOTE(rbellevi): The test runner should not load this module.
pass

@ -23,6 +23,7 @@ GRPCIO_TESTS_UNIT = [
"_invocation_defects_test.py",
"_local_credentials_test.py",
"_logging_test.py",
"_metadata_flags_test.py",
"_metadata_code_details_test.py",
"_metadata_test.py",
# TODO: Issue 16336

@ -255,8 +255,8 @@ class MetadataCodeDetailsTest(unittest.TestCase):
response_iterator_call = self._unary_stream(
_SERIALIZED_REQUEST, metadata=_CLIENT_METADATA)
received_initial_metadata = response_iterator_call.initial_metadata()
list(response_iterator_call)
received_initial_metadata = response_iterator_call.initial_metadata()
self.assertTrue(
test_common.metadata_transmitted(
@ -349,11 +349,14 @@ class MetadataCodeDetailsTest(unittest.TestCase):
response_iterator_call = self._unary_stream(
_SERIALIZED_REQUEST, metadata=_CLIENT_METADATA)
received_initial_metadata = \
response_iterator_call.initial_metadata()
# NOTE: In the single-threaded case, we cannot grab the initial_metadata
# without running the RPC first (or concurrently, in another
# thread).
with self.assertRaises(grpc.RpcError):
self.assertEqual(len(list(response_iterator_call)), 0)
received_initial_metadata = \
response_iterator_call.initial_metadata()
self.assertTrue(
test_common.metadata_transmitted(
_CLIENT_METADATA,
@ -454,9 +457,9 @@ class MetadataCodeDetailsTest(unittest.TestCase):
response_iterator_call = self._unary_stream(
_SERIALIZED_REQUEST, metadata=_CLIENT_METADATA)
received_initial_metadata = response_iterator_call.initial_metadata()
with self.assertRaises(grpc.RpcError):
list(response_iterator_call)
received_initial_metadata = response_iterator_call.initial_metadata()
self.assertTrue(
test_common.metadata_transmitted(
@ -547,9 +550,9 @@ class MetadataCodeDetailsTest(unittest.TestCase):
response_iterator_call = self._unary_stream(
_SERIALIZED_REQUEST, metadata=_CLIENT_METADATA)
received_initial_metadata = response_iterator_call.initial_metadata()
with self.assertRaises(grpc.RpcError):
list(response_iterator_call)
received_initial_metadata = response_iterator_call.initial_metadata()
self.assertTrue(
test_common.metadata_transmitted(

@ -94,10 +94,10 @@ class _GenericHandler(grpc.GenericRpcHandler):
def get_free_loopback_tcp_port():
tcp = socket.socket(socket.AF_INET6)
tcp = socket.socket(socket.AF_INET)
tcp.bind(('', 0))
address_tuple = tcp.getsockname()
return tcp, "[::1]:%s" % (address_tuple[1])
return tcp, "localhost:%s" % (address_tuple[1])
def create_dummy_channel():
@ -183,7 +183,7 @@ class MetadataFlagsTest(unittest.TestCase):
fn(channel, wait_for_ready)
self.fail("The Call should fail")
except BaseException as e: # pylint: disable=broad-except
self.assertIn('StatusCode.UNAVAILABLE', str(e))
self.assertIs(grpc.StatusCode.UNAVAILABLE, e.code())
def test_call_wait_for_ready_default(self):
for perform_call in _ALL_CALL_CASES:

@ -202,6 +202,9 @@ class MetadataTest(unittest.TestCase):
def testUnaryStream(self):
multi_callable = self._channel.unary_stream(_UNARY_STREAM)
call = multi_callable(_REQUEST, metadata=_INVOCATION_METADATA)
# TODO(https://github.com/grpc/grpc/issues/20762): Make the call to
# `next()` unnecessary.
next(call)
self.assertTrue(
test_common.metadata_transmitted(_EXPECTED_INITIAL_METADATA,
call.initial_metadata()))

@ -71,12 +71,17 @@
cmake_minimum_required(VERSION 3.5.1)
set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "${settings.cpp_version}")
set(gRPC_CORE_VERSION "${settings.core_version}")
set(PACKAGE_STRING "<%text>${PACKAGE_NAME} ${PACKAGE_VERSION}</%text>")
set(PACKAGE_TARNAME "<%text>${PACKAGE_NAME}-${PACKAGE_VERSION}</%text>")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "${settings.cpp_version}")
set(gRPC_CORE_VERSION "${settings.core_version}")
set(gRPC_CORE_SOVERSION "${settings.core_version.major}")
set(gRPC_CPP_VERSION "${settings.cpp_version}")
set(gRPC_CPP_SOVERSION "${settings.cpp_version.major}")
set(gRPC_CSHARP_VERSION "${settings.csharp_version}")
set(gRPC_CSHARP_SOVERSION "${settings.csharp_version.major}")
set(PACKAGE_STRING "<%text>${PACKAGE_NAME} ${PACKAGE_VERSION}</%text>")
set(PACKAGE_TARNAME "<%text>${PACKAGE_NAME}-${PACKAGE_VERSION}</%text>")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
project(<%text>${PACKAGE_NAME}</%text> LANGUAGES C CXX)
set(gRPC_INSTALL_BINDIR "bin" CACHE STRING "Installation directory for executables")
@ -400,6 +405,19 @@
% endfor
)
set_target_properties(${lib.name} PROPERTIES
% if lib.language == 'c++':
VERSION <%text>${gRPC_CPP_VERSION}</%text>
SOVERSION <%text>${gRPC_CPP_SOVERSION}</%text>
% elif lib.language == 'csharp':
VERSION <%text>${gRPC_CSHARP_VERSION}</%text>
SOVERSION <%text>${gRPC_CSHARP_SOVERSION}</%text>
% else:
VERSION <%text>${gRPC_CORE_VERSION}</%text>
SOVERSION <%text>${gRPC_CORE_SOVERSION}</%text>
% endif
)
if(WIN32 AND MSVC)
set_target_properties(${lib.name} PROPERTIES COMPILE_PDB_NAME "${lib.name}"
COMPILE_PDB_OUTPUT_DIRECTORY <%text>"${CMAKE_BINARY_DIR}</%text>"

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

Loading…
Cancel
Save