Merge remote-tracking branch 'origin/master' into bump_bazel_cython

pull/25221/head
Richard Belleville 4 years ago
commit f34f0a3f0f
  1. 3
      BUILD
  2. 2
      BUILD.gn
  3. 13
      CMakeLists.txt
  4. 1
      Makefile
  5. 1
      Package.swift
  6. 2
      Rakefile
  7. 1
      bazel/copts.bzl
  8. 8
      bazel/grpc_deps.bzl
  9. 15
      bazel/update_mirror.sh
  10. 4
      build_autogenerated.yaml
  11. 1
      config.m4
  12. 1
      config.w32
  13. 4
      gRPC-C++.podspec
  14. 5
      gRPC-Core.podspec
  15. 4
      grpc.gemspec
  16. 2
      grpc.gyp
  17. 48
      include/grpcpp/support/error_details.h
  18. 2
      package.xml
  19. 12
      src/core/ext/filters/client_channel/client_channel.cc
  20. 2
      src/core/ext/filters/client_channel/config_selector.h
  21. 8
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  22. 3
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
  23. 3
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
  24. 3
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
  25. 2
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
  26. 2
      src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
  27. 2
      src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
  28. 4
      src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
  29. 2
      src/core/ext/transport/chttp2/client/chttp2_connector.cc
  30. 2
      src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
  31. 36
      src/core/ext/transport/cronet/transport/cronet_api_dummy.cc
  32. 25
      src/core/ext/transport/cronet/transport/cronet_transport.cc
  33. 2
      src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h
  34. 4
      src/core/ext/xds/xds_api.cc
  35. 79
      src/core/ext/xds/xds_bootstrap.cc
  36. 19
      src/core/ext/xds/xds_bootstrap.h
  37. 4
      src/core/ext/xds/xds_client.cc
  38. 8
      src/core/lib/gpr/cpu_linux.cc
  39. 103
      src/core/lib/gpr/strerror.cc
  40. 35
      src/core/lib/gpr/strerror.h
  41. 5
      src/core/lib/gpr/tmpfile_posix.cc
  42. 2
      src/core/lib/gprpp/ref_counted.h
  43. 5
      src/core/lib/gprpp/stat_posix.cc
  44. 5
      src/core/lib/gprpp/stat_windows.cc
  45. 9
      src/core/lib/iomgr/error.cc
  46. 7
      src/core/lib/iomgr/ev_epoll1_linux.cc
  47. 3
      src/core/lib/iomgr/internal_errqueue.cc
  48. 6
      src/core/lib/iomgr/socket_utils_common_posix.cc
  49. 8
      src/core/lib/iomgr/tcp_posix.cc
  50. 10
      src/core/lib/iomgr/tcp_server_posix.cc
  51. 15
      src/core/lib/iomgr/udp_server.cc
  52. 4
      src/core/lib/iomgr/wakeup_fd_pipe.cc
  53. 2
      src/core/lib/security/authorization/mock_cel/activation.h
  54. 16
      src/core/lib/security/authorization/mock_cel/cel_value.h
  55. 2
      src/core/lib/security/credentials/external/aws_external_account_credentials.cc
  56. 2
      src/core/lib/security/credentials/external/file_external_account_credentials.cc
  57. 2
      src/core/lib/security/credentials/external/url_external_account_credentials.cc
  58. 2
      src/core/lib/security/credentials/fake/fake_credentials.cc
  59. 10
      src/core/lib/security/security_connector/insecure/insecure_security_connector.cc
  60. 4
      src/core/lib/surface/server.cc
  61. 4
      src/core/lib/transport/metadata.cc
  62. 2
      src/core/tsi/fake_transport_security.cc
  63. 4
      src/cpp/ext/filters/census/channel_filter.cc
  64. 4
      src/cpp/ext/filters/census/client_filter.cc
  65. 7
      src/cpp/ext/filters/census/context.cc
  66. 5
      src/cpp/ext/filters/census/context.h
  67. 17
      src/cpp/ext/filters/census/server_filter.cc
  68. 2
      src/cpp/server/load_reporter/load_reporter_async_service_impl.cc
  69. 2
      src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.cc
  70. 4
      src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.h
  71. 31
      src/cpp/util/error_details.cc
  72. 12
      src/csharp/ext/grpc_csharp_ext.c
  73. 1
      src/python/grpcio/grpc_core_dependencies.py
  74. 2
      templates/gRPC-C++.podspec.template
  75. 2
      templates/gRPC-Core.podspec.template
  76. 2
      templates/grpc.gemspec.template
  77. 8
      test/core/client_channel/certificate_provider_registry_test.cc
  78. 4
      test/core/end2end/cq_verifier.cc
  79. 6
      test/core/iomgr/fd_posix_test.cc
  80. 3
      test/core/iomgr/tcp_server_posix_test.cc
  81. 43
      test/core/network_benchmarks/low_level_ping_pong.cc
  82. 26
      test/core/security/credentials_test.cc
  83. 8
      test/core/security/grpc_tls_certificate_distributor_test.cc
  84. 2
      test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc
  85. 4
      test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc
  86. 8
      test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
  87. 4
      test/core/tsi/ssl_session_cache_test.cc
  88. 25
      test/core/util/eval_args_mock_endpoint.cc
  89. 6
      test/core/util/subprocess_posix.cc
  90. 2
      test/core/util/test_config.cc
  91. 12
      test/core/xds/certificate_provider_store_test.cc
  92. 2
      test/core/xds/xds_bootstrap_test.cc
  93. 5
      test/cpp/end2end/context_allocator_end2end_test.cc
  94. 2
      test/cpp/end2end/nonblocking_test.cc
  95. 76
      test/cpp/end2end/xds_end2end_test.cc
  96. 2
      test/cpp/ext/filters/census/stats_plugin_end2end_test.cc
  97. 10
      test/cpp/interop/xds_interop_client.cc
  98. 6
      test/cpp/interop/xds_interop_server.cc
  99. 2
      test/cpp/microbenchmarks/bm_opencensus_plugin.cc
  100. 1
      test/cpp/util/BUILD
  101. Some files were not shown because too many files have changed in this diff Show More

@ -462,7 +462,6 @@ grpc_cc_library(
standalone = True, standalone = True,
deps = [ deps = [
"grpc++", "grpc++",
"//src/proto/grpc/status:status_proto",
], ],
) )
@ -540,7 +539,6 @@ grpc_cc_library(
"src/core/lib/gpr/log_posix.cc", "src/core/lib/gpr/log_posix.cc",
"src/core/lib/gpr/log_windows.cc", "src/core/lib/gpr/log_windows.cc",
"src/core/lib/gpr/murmur_hash.cc", "src/core/lib/gpr/murmur_hash.cc",
"src/core/lib/gpr/strerror.cc",
"src/core/lib/gpr/string.cc", "src/core/lib/gpr/string.cc",
"src/core/lib/gpr/string_posix.cc", "src/core/lib/gpr/string_posix.cc",
"src/core/lib/gpr/string_util_windows.cc", "src/core/lib/gpr/string_util_windows.cc",
@ -577,7 +575,6 @@ grpc_cc_library(
"src/core/lib/gpr/env.h", "src/core/lib/gpr/env.h",
"src/core/lib/gpr/murmur_hash.h", "src/core/lib/gpr/murmur_hash.h",
"src/core/lib/gpr/spinlock.h", "src/core/lib/gpr/spinlock.h",
"src/core/lib/gpr/strerror.h",
"src/core/lib/gpr/string.h", "src/core/lib/gpr/string.h",
"src/core/lib/gpr/string_windows.h", "src/core/lib/gpr/string_windows.h",
"src/core/lib/gpr/time_precise.h", "src/core/lib/gpr/time_precise.h",

@ -117,8 +117,6 @@ config("grpc_config") {
"src/core/lib/gpr/murmur_hash.cc", "src/core/lib/gpr/murmur_hash.cc",
"src/core/lib/gpr/murmur_hash.h", "src/core/lib/gpr/murmur_hash.h",
"src/core/lib/gpr/spinlock.h", "src/core/lib/gpr/spinlock.h",
"src/core/lib/gpr/strerror.cc",
"src/core/lib/gpr/strerror.h",
"src/core/lib/gpr/string.cc", "src/core/lib/gpr/string.cc",
"src/core/lib/gpr/string.h", "src/core/lib/gpr/string.h",
"src/core/lib/gpr/string_posix.cc", "src/core/lib/gpr/string_posix.cc",

@ -1308,7 +1308,6 @@ add_library(gpr
src/core/lib/gpr/log_posix.cc src/core/lib/gpr/log_posix.cc
src/core/lib/gpr/log_windows.cc src/core/lib/gpr/log_windows.cc
src/core/lib/gpr/murmur_hash.cc src/core/lib/gpr/murmur_hash.cc
src/core/lib/gpr/strerror.cc
src/core/lib/gpr/string.cc src/core/lib/gpr/string.cc
src/core/lib/gpr/string_posix.cc src/core/lib/gpr/string_posix.cc
src/core/lib/gpr/string_util_windows.cc src/core/lib/gpr/string_util_windows.cc
@ -3040,12 +3039,7 @@ if(gRPC_INSTALL)
endif() endif()
if(gRPC_BUILD_CODEGEN)
add_library(grpc++_error_details add_library(grpc++_error_details
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.h
src/cpp/util/error_details.cc src/cpp/util/error_details.cc
) )
@ -3098,9 +3092,7 @@ foreach(_hdr
DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
) )
endforeach() endforeach()
endif()
if(gRPC_BUILD_CODEGEN)
if(gRPC_INSTALL) if(gRPC_INSTALL)
install(TARGETS grpc++_error_details EXPORT gRPCTargets install(TARGETS grpc++_error_details EXPORT gRPCTargets
@ -3110,7 +3102,6 @@ if(gRPC_INSTALL)
) )
endif() endif()
endif()
if(gRPC_BUILD_CODEGEN) if(gRPC_BUILD_CODEGEN)
add_library(grpc++_reflection add_library(grpc++_reflection
@ -10858,6 +10849,10 @@ endif()
if(gRPC_BUILD_TESTS) if(gRPC_BUILD_TESTS)
add_executable(error_details_test add_executable(error_details_test
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.grpc.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.h

@ -920,7 +920,6 @@ LIBGPR_SRC = \
src/core/lib/gpr/log_posix.cc \ src/core/lib/gpr/log_posix.cc \
src/core/lib/gpr/log_windows.cc \ src/core/lib/gpr/log_windows.cc \
src/core/lib/gpr/murmur_hash.cc \ src/core/lib/gpr/murmur_hash.cc \
src/core/lib/gpr/strerror.cc \
src/core/lib/gpr/string.cc \ src/core/lib/gpr/string.cc \
src/core/lib/gpr/string_posix.cc \ src/core/lib/gpr/string_posix.cc \
src/core/lib/gpr/string_util_windows.cc \ src/core/lib/gpr/string_util_windows.cc \

@ -106,7 +106,6 @@ let package = Package(
"src/cpp/server/load_reporter/", "src/cpp/server/load_reporter/",
"src/cpp/util/core_stats.cc", "src/cpp/util/core_stats.cc",
"src/cpp/util/core_stats.h", "src/cpp/util/core_stats.h",
"src/cpp/util/error_details.cc",
], ],
sources: [ sources: [
"src/cpp/", "src/cpp/",

@ -121,7 +121,7 @@ task 'gem:native' do
verbose = ENV['V'] || '0' verbose = ENV['V'] || '0'
grpc_config = ENV['GRPC_CONFIG'] || 'opt' grpc_config = ENV['GRPC_CONFIG'] || 'opt'
ruby_cc_versions = ['3.0.0', '2.7.0', '2.6.0', '2.5.0', '2.4.0', '2.3.0'].join(':') ruby_cc_versions = ['3.0.0', '2.7.0', '2.6.0', '2.5.0', '2.4.0'].join(':')
if RUBY_PLATFORM =~ /darwin/ if RUBY_PLATFORM =~ /darwin/
FileUtils.touch 'grpc_c.32.ruby' FileUtils.touch 'grpc_c.32.ruby'

@ -47,7 +47,6 @@ GRPC_LLVM_WARNING_FLAGS = [
"-Wno-missing-field-initializers", "-Wno-missing-field-initializers",
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-unused-function", "-Wno-unused-function",
"-Wno-unused-parameter",
] ]
GRPC_DEFAULT_COPTS = select({ GRPC_DEFAULT_COPTS = select({

@ -245,11 +245,11 @@ def grpc_deps():
if "com_google_absl" not in native.existing_rules(): if "com_google_absl" not in native.existing_rules():
http_archive( http_archive(
name = "com_google_absl", name = "com_google_absl",
sha256 = "3d74cdc98b42fd4257d91f652575206de195e2c824fcd8d6e6d227f85cb143ef", sha256 = "62c27e7a633e965a2f40ff16b487c3b778eae440bab64cad83b34ef1cbe3aa93",
strip_prefix = "abseil-cpp-0f3bb466b868b523cf1dc9b2aaaed65c77b28862", strip_prefix = "abseil-cpp-6f9d96a1f41439ac172ee2ef7ccd8edf0e5d068c",
urls = [ urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/0f3bb466b868b523cf1dc9b2aaaed65c77b28862.tar.gz", "https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/6f9d96a1f41439ac172ee2ef7ccd8edf0e5d068c.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/0f3bb466b868b523cf1dc9b2aaaed65c77b28862.tar.gz", "https://github.com/abseil/abseil-cpp/archive/6f9d96a1f41439ac172ee2ef7ccd8edf0e5d068c.tar.gz",
], ],
) )

@ -34,13 +34,18 @@ trap cleanup EXIT
function upload { function upload {
local file="$1" local file="$1"
echo "Downloading https://${file}" if gsutil stat "gs://grpc-bazel-mirror/${file}" > /dev/null
curl -L --fail --output "${tmpdir}/archive" "https://${file}" then
echo "Skipping ${file}"
else
echo "Downloading https://${file}"
curl -L --fail --output "${tmpdir}/archive" "https://${file}"
echo "Uploading https://${file} to https://storage.googleapis.com/grpc-bazel-mirror/${file}" echo "Uploading https://${file} to https://storage.googleapis.com/grpc-bazel-mirror/${file}"
gsutil cp -n "${tmpdir}/archive" "gs://grpc-bazel-mirror/${file}" # "-n" will skip existing files gsutil cp "${tmpdir}/archive" "gs://grpc-bazel-mirror/${file}"
rm -rf "${tmpdir}/archive" rm -rf "${tmpdir}/archive"
fi
} }
# How to check that all mirror URLs work: # How to check that all mirror URLs work:

@ -283,7 +283,6 @@ libs:
- src/core/lib/gpr/env.h - src/core/lib/gpr/env.h
- src/core/lib/gpr/murmur_hash.h - src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h - src/core/lib/gpr/spinlock.h
- src/core/lib/gpr/strerror.h
- src/core/lib/gpr/string.h - src/core/lib/gpr/string.h
- src/core/lib/gpr/string_windows.h - src/core/lib/gpr/string_windows.h
- src/core/lib/gpr/time_precise.h - src/core/lib/gpr/time_precise.h
@ -326,7 +325,6 @@ libs:
- src/core/lib/gpr/log_posix.cc - src/core/lib/gpr/log_posix.cc
- src/core/lib/gpr/log_windows.cc - src/core/lib/gpr/log_windows.cc
- src/core/lib/gpr/murmur_hash.cc - src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gpr/strerror.cc
- src/core/lib/gpr/string.cc - src/core/lib/gpr/string.cc
- src/core/lib/gpr/string_posix.cc - src/core/lib/gpr/string_posix.cc
- src/core/lib/gpr/string_util_windows.cc - src/core/lib/gpr/string_util_windows.cc
@ -2395,7 +2393,6 @@ libs:
- include/grpcpp/support/error_details.h - include/grpcpp/support/error_details.h
headers: [] headers: []
src: src:
- src/proto/grpc/status/status.proto
- src/cpp/util/error_details.cc - src/cpp/util/error_details.cc
deps: deps:
- grpc++ - grpc++
@ -5916,6 +5913,7 @@ targets:
language: c++ language: c++
headers: [] headers: []
src: src:
- src/proto/grpc/status/status.proto
- src/proto/grpc/testing/echo_messages.proto - src/proto/grpc/testing/echo_messages.proto
- test/cpp/util/error_details_test.cc - test/cpp/util/error_details_test.cc
deps: deps:

@ -354,7 +354,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/gpr/log_posix.cc \ src/core/lib/gpr/log_posix.cc \
src/core/lib/gpr/log_windows.cc \ src/core/lib/gpr/log_windows.cc \
src/core/lib/gpr/murmur_hash.cc \ src/core/lib/gpr/murmur_hash.cc \
src/core/lib/gpr/strerror.cc \
src/core/lib/gpr/string.cc \ src/core/lib/gpr/string.cc \
src/core/lib/gpr/string_posix.cc \ src/core/lib/gpr/string_posix.cc \
src/core/lib/gpr/string_util_windows.cc \ src/core/lib/gpr/string_util_windows.cc \

@ -321,7 +321,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\gpr\\log_posix.cc " + "src\\core\\lib\\gpr\\log_posix.cc " +
"src\\core\\lib\\gpr\\log_windows.cc " + "src\\core\\lib\\gpr\\log_windows.cc " +
"src\\core\\lib\\gpr\\murmur_hash.cc " + "src\\core\\lib\\gpr\\murmur_hash.cc " +
"src\\core\\lib\\gpr\\strerror.cc " +
"src\\core\\lib\\gpr\\string.cc " + "src\\core\\lib\\gpr\\string.cc " +
"src\\core\\lib\\gpr\\string_posix.cc " + "src\\core\\lib\\gpr\\string_posix.cc " +
"src\\core\\lib\\gpr\\string_util_windows.cc " + "src\\core\\lib\\gpr\\string_util_windows.cc " +

@ -185,7 +185,7 @@ Pod::Spec.new do |s|
ss.header_mappings_dir = '.' ss.header_mappings_dir = '.'
ss.dependency "#{s.name}/Interface", version ss.dependency "#{s.name}/Interface", version
ss.dependency 'gRPC-Core', version ss.dependency 'gRPC-Core', version
abseil_version = '1.20200923.2' abseil_version = '1.20200923.3'
ss.dependency 'abseil/base/base', abseil_version ss.dependency 'abseil/base/base', abseil_version
ss.dependency 'abseil/container/flat_hash_map', abseil_version ss.dependency 'abseil/container/flat_hash_map', abseil_version
ss.dependency 'abseil/container/flat_hash_set', abseil_version ss.dependency 'abseil/container/flat_hash_set', abseil_version
@ -486,7 +486,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/env.h', 'src/core/lib/gpr/env.h',
'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h', 'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/strerror.h',
'src/core/lib/gpr/string.h', 'src/core/lib/gpr/string.h',
'src/core/lib/gpr/string_windows.h', 'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/time_precise.h', 'src/core/lib/gpr/time_precise.h',
@ -1105,7 +1104,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/env.h', 'src/core/lib/gpr/env.h',
'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h', 'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/strerror.h',
'src/core/lib/gpr/string.h', 'src/core/lib/gpr/string.h',
'src/core/lib/gpr/string_windows.h', 'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/time_precise.h', 'src/core/lib/gpr/time_precise.h',

@ -46,7 +46,7 @@ Pod::Spec.new do |s|
s.requires_arc = false s.requires_arc = false
name = 'grpc' name = 'grpc'
abseil_version = '1.20200923.2' abseil_version = '1.20200923.3'
# When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework. # When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework.
# This lets users write their includes like `#include <grpc/grpc.h>` as opposed to `#include # This lets users write their includes like `#include <grpc/grpc.h>` as opposed to `#include
@ -790,8 +790,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/murmur_hash.cc', 'src/core/lib/gpr/murmur_hash.cc',
'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h', 'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/strerror.cc',
'src/core/lib/gpr/strerror.h',
'src/core/lib/gpr/string.cc', 'src/core/lib/gpr/string.cc',
'src/core/lib/gpr/string.h', 'src/core/lib/gpr/string.h',
'src/core/lib/gpr/string_posix.cc', 'src/core/lib/gpr/string_posix.cc',
@ -1638,7 +1636,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/env.h', 'src/core/lib/gpr/env.h',
'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h', 'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/strerror.h',
'src/core/lib/gpr/string.h', 'src/core/lib/gpr/string.h',
'src/core/lib/gpr/string_windows.h', 'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/time_precise.h', 'src/core/lib/gpr/time_precise.h',

@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.description = 'Send RPCs from Ruby using GRPC' s.description = 'Send RPCs from Ruby using GRPC'
s.license = 'Apache-2.0' s.license = 'Apache-2.0'
s.required_ruby_version = '>= 2.3.0' s.required_ruby_version = '>= 2.4.0'
s.files = %w( Makefile .yardopts ) s.files = %w( Makefile .yardopts )
s.files += %w( etc/roots.pem ) s.files += %w( etc/roots.pem )
@ -705,8 +705,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/murmur_hash.cc ) s.files += %w( src/core/lib/gpr/murmur_hash.cc )
s.files += %w( src/core/lib/gpr/murmur_hash.h ) s.files += %w( src/core/lib/gpr/murmur_hash.h )
s.files += %w( src/core/lib/gpr/spinlock.h ) s.files += %w( src/core/lib/gpr/spinlock.h )
s.files += %w( src/core/lib/gpr/strerror.cc )
s.files += %w( src/core/lib/gpr/strerror.h )
s.files += %w( src/core/lib/gpr/string.cc ) s.files += %w( src/core/lib/gpr/string.cc )
s.files += %w( src/core/lib/gpr/string.h ) s.files += %w( src/core/lib/gpr/string.h )
s.files += %w( src/core/lib/gpr/string_posix.cc ) s.files += %w( src/core/lib/gpr/string_posix.cc )

@ -404,7 +404,6 @@
'src/core/lib/gpr/log_posix.cc', 'src/core/lib/gpr/log_posix.cc',
'src/core/lib/gpr/log_windows.cc', 'src/core/lib/gpr/log_windows.cc',
'src/core/lib/gpr/murmur_hash.cc', 'src/core/lib/gpr/murmur_hash.cc',
'src/core/lib/gpr/strerror.cc',
'src/core/lib/gpr/string.cc', 'src/core/lib/gpr/string.cc',
'src/core/lib/gpr/string_posix.cc', 'src/core/lib/gpr/string_posix.cc',
'src/core/lib/gpr/string_util_windows.cc', 'src/core/lib/gpr/string_util_windows.cc',
@ -1471,7 +1470,6 @@
'upb', 'upb',
], ],
'sources': [ 'sources': [
'src/proto/grpc/status/status.proto',
'src/cpp/util/error_details.cc', 'src/cpp/util/error_details.cc',
], ],
}, },

@ -21,12 +21,6 @@
#include <grpcpp/support/status.h> #include <grpcpp/support/status.h>
namespace google {
namespace rpc {
class Status;
} // namespace rpc
} // namespace google
namespace grpc { namespace grpc {
/// Map a \a grpc::Status to a \a google::rpc::Status. /// Map a \a grpc::Status to a \a google::rpc::Status.
@ -34,14 +28,48 @@ namespace grpc {
/// On success, returns status with OK. /// On success, returns status with OK.
/// Returns status with \a INVALID_ARGUMENT, if failed to deserialize. /// Returns status with \a INVALID_ARGUMENT, if failed to deserialize.
/// Returns status with \a FAILED_PRECONDITION, if \a to is nullptr. /// Returns status with \a FAILED_PRECONDITION, if \a to is nullptr.
grpc::Status ExtractErrorDetails(const grpc::Status& from, ///
::google::rpc::Status* to); /// \note
/// This function is a template to avoid a build dep on \a status.proto.
/// However, this function still requires that \tparam T is of type
/// \a google::rpc::Status, which is defined at
/// https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto
template <typename T>
grpc::Status ExtractErrorDetails(const grpc::Status& from, T* to) {
if (to == nullptr) {
return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, "");
}
if (!to->ParseFromString(from.error_details())) {
return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, "");
}
return grpc::Status::OK;
}
inline grpc::Status ExtractErrorDetails(const grpc::Status&, std::nullptr_t) {
return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, "");
}
/// Map \a google::rpc::Status to a \a grpc::Status. /// Map \a google::rpc::Status to a \a grpc::Status.
/// Returns OK on success. /// Returns OK on success.
/// Returns status with \a FAILED_PRECONDITION if \a to is nullptr. /// Returns status with \a FAILED_PRECONDITION if \a to is nullptr.
grpc::Status SetErrorDetails(const ::google::rpc::Status& from, ///
grpc::Status* to); /// \note
/// This function is a template to avoid a build dep on \a status.proto.
/// However, this function still requires that \tparam T is of type
/// \a google::rpc::Status, which is defined at
/// https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto
template <typename T>
grpc::Status SetErrorDetails(const T& from, grpc::Status* to) {
if (to == nullptr) {
return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, "");
}
grpc::StatusCode code = grpc::StatusCode::UNKNOWN;
if (from.code() >= grpc::StatusCode::OK &&
from.code() <= grpc::StatusCode::UNAUTHENTICATED) {
code = static_cast<grpc::StatusCode>(from.code());
}
*to = grpc::Status(code, from.message(), from.SerializeAsString());
return grpc::Status::OK;
}
} // namespace grpc } // namespace grpc

@ -685,8 +685,6 @@
<file baseinstalldir="/" name="src/core/lib/gpr/murmur_hash.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/gpr/murmur_hash.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/murmur_hash.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/gpr/murmur_hash.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/spinlock.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/gpr/spinlock.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/strerror.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/strerror.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/gpr/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/gpr/string.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string_posix.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/gpr/string_posix.cc" role="src" />

@ -1047,7 +1047,7 @@ class LoadBalancedCall {
// Channel arg pointer vtable for GRPC_ARG_CLIENT_CHANNEL_DATA. // Channel arg pointer vtable for GRPC_ARG_CLIENT_CHANNEL_DATA.
void* ChannelDataArgCopy(void* p) { return p; } void* ChannelDataArgCopy(void* p) { return p; }
void ChannelDataArgDestroy(void* p) {} void ChannelDataArgDestroy(void* /*p*/) {}
int ChannelDataArgCmp(void* p, void* q) { return GPR_ICMP(p, q); } int ChannelDataArgCmp(void* p, void* q) { return GPR_ICMP(p, q); }
const grpc_arg_pointer_vtable kChannelDataArgPointerVtable = { const grpc_arg_pointer_vtable kChannelDataArgPointerVtable = {
ChannelDataArgCopy, ChannelDataArgDestroy, ChannelDataArgCmp}; ChannelDataArgCopy, ChannelDataArgDestroy, ChannelDataArgCmp};
@ -1079,10 +1079,10 @@ class DynamicTerminationFilterChannelData {
} }
// Will never be called. // Will never be called.
static void StartTransportOp(grpc_channel_element* elem, static void StartTransportOp(grpc_channel_element* /*elem*/,
grpc_transport_op* op) {} grpc_transport_op* /*op*/) {}
static void GetChannelInfo(grpc_channel_element* elem, static void GetChannelInfo(grpc_channel_element* /*elem*/,
const grpc_channel_info* info) {} const grpc_channel_info* /*info*/) {}
ChannelData* chand() const { return chand_; } ChannelData* chand() const { return chand_; }
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data() const { RefCountedPtr<ServerRetryThrottleData> retry_throttle_data() const {
@ -1117,7 +1117,7 @@ class DynamicTerminationFilterCallData {
} }
static void Destroy(grpc_call_element* elem, static void Destroy(grpc_call_element* elem,
const grpc_call_final_info* final_info, const grpc_call_final_info* /*final_info*/,
grpc_closure* then_schedule_closure) { grpc_closure* then_schedule_closure) {
auto* calld = auto* calld =
static_cast<DynamicTerminationFilterCallData*>(elem->call_data); static_cast<DynamicTerminationFilterCallData*>(elem->call_data);

@ -106,7 +106,7 @@ class DefaultConfigSelector : public ConfigSelector {
// Only comparing the ConfigSelector itself, not the underlying // Only comparing the ConfigSelector itself, not the underlying
// service config, so we always return true. // service config, so we always return true.
bool Equals(const ConfigSelector* other) const override { return true; } bool Equals(const ConfigSelector* /*other*/) const override { return true; }
CallConfig GetCallConfig(GetCallConfigArgs args) override { CallConfig GetCallConfig(GetCallConfigArgs args) override {
CallConfig call_config; CallConfig call_config;

@ -1259,12 +1259,10 @@ ServerAddressList ExtractBalancerAddresses(const grpc_channel_args& args) {
* stream for the reception of load balancing updates. * stream for the reception of load balancing updates.
* *
* Inputs: * Inputs:
* - \a addresses: corresponding to the balancers.
* - \a response_generator: in order to propagate updates from the resolver * - \a response_generator: in order to propagate updates from the resolver
* above the grpclb policy. * above the grpclb policy.
* - \a args: other args inherited from the grpclb policy. */ * - \a args: other args inherited from the grpclb policy. */
grpc_channel_args* BuildBalancerChannelArgs( grpc_channel_args* BuildBalancerChannelArgs(
const ServerAddressList& addresses,
FakeResolverResponseGenerator* response_generator, FakeResolverResponseGenerator* response_generator,
const grpc_channel_args* args) { const grpc_channel_args* args) {
// Channel args to remove. // Channel args to remove.
@ -1313,7 +1311,7 @@ grpc_channel_args* BuildBalancerChannelArgs(
args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add.data(), args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add.data(),
args_to_add.size()); args_to_add.size());
// Make any necessary modifications for security. // Make any necessary modifications for security.
return ModifyGrpclbBalancerChannelArgs(addresses, new_args); return ModifyGrpclbBalancerChannelArgs(new_args);
} }
// //
@ -1464,8 +1462,8 @@ void GrpcLb::ProcessAddressesAndChannelArgsLocked(
&args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), &new_arg, 1); &args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), &new_arg, 1);
// Construct args for balancer channel. // Construct args for balancer channel.
ServerAddressList balancer_addresses = ExtractBalancerAddresses(args); ServerAddressList balancer_addresses = ExtractBalancerAddresses(args);
grpc_channel_args* lb_channel_args = BuildBalancerChannelArgs( grpc_channel_args* lb_channel_args =
balancer_addresses, response_generator_.get(), &args); BuildBalancerChannelArgs(response_generator_.get(), &args);
// Create balancer channel if needed. // Create balancer channel if needed.
if (lb_channel_ == nullptr) { if (lb_channel_ == nullptr) {
std::string uri_str = absl::StrCat("fake:///", server_name_); std::string uri_str = absl::StrCat("fake:///", server_name_);

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

@ -33,8 +33,7 @@ namespace grpc_core {
/// Takes ownership of \a args. /// Takes ownership of \a args.
/// ///
/// Caller takes ownership of the returned args. /// Caller takes ownership of the returned args.
grpc_channel_args* ModifyGrpclbBalancerChannelArgs( grpc_channel_args* ModifyGrpclbBalancerChannelArgs(grpc_channel_args* args);
const ServerAddressList& addresses, grpc_channel_args* args);
grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri, grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri,
const grpc_channel_args& args); const grpc_channel_args& args);

@ -39,8 +39,7 @@
namespace grpc_core { namespace grpc_core {
grpc_channel_args* ModifyGrpclbBalancerChannelArgs( grpc_channel_args* ModifyGrpclbBalancerChannelArgs(grpc_channel_args* args) {
const ServerAddressList& addresses, grpc_channel_args* args) {
absl::InlinedVector<const char*, 1> args_to_remove; absl::InlinedVector<const char*, 1> args_to_remove;
absl::InlinedVector<grpc_arg, 1> args_to_add; absl::InlinedVector<grpc_arg, 1> args_to_add;
// Substitute the channel credentials with a version without call // Substitute the channel credentials with a version without call

@ -497,7 +497,7 @@ class PickFirstFactory : public LoadBalancingPolicyFactory {
const char* name() const override { return kPickFirst; } const char* name() const override { return kPickFirst; }
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig( RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
const Json& json, grpc_error** /*error*/) const override { const Json& /*json*/, grpc_error** /*error*/) const override {
return MakeRefCounted<PickFirstConfig>(); return MakeRefCounted<PickFirstConfig>();
} }
}; };

@ -1236,7 +1236,7 @@ class XdsClusterResolverLbFactory : public LoadBalancingPolicyFactory {
} }
OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy( OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
const char* name, LoadBalancingPolicy::Args args) const override { const char* /*name*/, LoadBalancingPolicy::Args args) const override {
return MakeOrphanable<XdsClusterResolverLb>(xds_client_, std::move(args)); return MakeOrphanable<XdsClusterResolverLb>(xds_client_, std::move(args));
} }

@ -150,7 +150,7 @@ class UnixResolverFactory : public ResolverFactory {
return CreateSockaddrResolver(std::move(args), grpc_parse_unix); return CreateSockaddrResolver(std::move(args), grpc_parse_unix);
} }
std::string GetDefaultAuthority(const URI& uri) const override { std::string GetDefaultAuthority(const URI& /*uri*/) const override {
return "localhost"; return "localhost";
} }

@ -72,7 +72,7 @@ grpc_error* ServerLoadReportingChannelData::Init(
void ServerLoadReportingCallData::Destroy( void ServerLoadReportingCallData::Destroy(
grpc_call_element* elem, const grpc_call_final_info* final_info, grpc_call_element* elem, const grpc_call_final_info* final_info,
grpc_closure* then_call_closure) { grpc_closure* /*then_call_closure*/) {
ServerLoadReportingChannelData* chand = ServerLoadReportingChannelData* chand =
reinterpret_cast<ServerLoadReportingChannelData*>(elem->channel_data); reinterpret_cast<ServerLoadReportingChannelData*>(elem->channel_data);
// Only record an end if we've recorded its corresponding start, which is // Only record an end if we've recorded its corresponding start, which is
@ -265,7 +265,7 @@ void ServerLoadReportingCallData::RecvInitialMetadataReady(void* arg,
} }
grpc_error* ServerLoadReportingCallData::Init( grpc_error* ServerLoadReportingCallData::Init(
grpc_call_element* elem, const grpc_call_element_args* args) { grpc_call_element* elem, const grpc_call_element_args* /*args*/) {
service_method_ = grpc_empty_slice(); service_method_ = grpc_empty_slice();
GRPC_CLOSURE_INIT(&recv_initial_metadata_ready_, RecvInitialMetadataReady, GRPC_CLOSURE_INIT(&recv_initial_metadata_ready_, RecvInitialMetadataReady,
elem, grpc_schedule_on_exec_ctx); elem, grpc_schedule_on_exec_ctx);

@ -220,7 +220,7 @@ void Chttp2Connector::OnReceiveSettings(void* arg, grpc_error* error) {
self->Unref(); self->Unref();
} }
void Chttp2Connector::OnTimeout(void* arg, grpc_error* error) { void Chttp2Connector::OnTimeout(void* arg, grpc_error* /*error*/) {
Chttp2Connector* self = static_cast<Chttp2Connector*>(arg); Chttp2Connector* self = static_cast<Chttp2Connector*>(arg);
{ {
MutexLock lock(&self->mu_); MutexLock lock(&self->mu_);

@ -30,7 +30,7 @@
namespace { namespace {
grpc_channel_args* ModifyArgsForConnection(grpc_channel_args* args, grpc_channel_args* ModifyArgsForConnection(grpc_channel_args* args,
grpc_error** error) { grpc_error** /*error*/) {
return args; return args;
} }

@ -32,51 +32,55 @@ library, so we can build it in all environments */
#else #else
/* Dummy implementation of cronet API just to test for build-ability */ /* Dummy implementation of cronet API just to test for build-ability */
bidirectional_stream* bidirectional_stream_create( bidirectional_stream* bidirectional_stream_create(
stream_engine* engine, void* annotation, stream_engine* /*engine*/, void* /*annotation*/,
bidirectional_stream_callback* callback) { bidirectional_stream_callback* /*callback*/) {
GPR_ASSERT(0); GPR_ASSERT(0);
return nullptr; return nullptr;
} }
int bidirectional_stream_destroy(bidirectional_stream* stream) { int bidirectional_stream_destroy(bidirectional_stream* /*stream*/) {
GPR_ASSERT(0); GPR_ASSERT(0);
return 0; return 0;
} }
int bidirectional_stream_start(bidirectional_stream* stream, const char* url, int bidirectional_stream_start(
int priority, const char* method, bidirectional_stream* /*stream*/, const char* /*url*/, int /*priority*/,
const bidirectional_stream_header_array* headers, const char* /*method*/,
bool end_of_stream) { const bidirectional_stream_header_array* /*headers*/,
bool /*end_of_stream*/) {
GPR_ASSERT(0); GPR_ASSERT(0);
return 0; return 0;
} }
int bidirectional_stream_read(bidirectional_stream* stream, char* buffer, int bidirectional_stream_read(bidirectional_stream* /*stream*/,
int capacity) { char* /*buffer*/, int /*capacity*/) {
GPR_ASSERT(0); GPR_ASSERT(0);
return 0; return 0;
} }
int bidirectional_stream_write(bidirectional_stream* stream, const char* buffer, int bidirectional_stream_write(bidirectional_stream* /*stream*/,
int count, bool end_of_stream) { const char* /*buffer*/, int /*count*/,
bool /*end_of_stream*/) {
GPR_ASSERT(0); GPR_ASSERT(0);
return 0; return 0;
} }
void bidirectional_stream_cancel(bidirectional_stream* stream) { void bidirectional_stream_cancel(bidirectional_stream* /*stream*/) {
GPR_ASSERT(0); GPR_ASSERT(0);
} }
void bidirectional_stream_disable_auto_flush(bidirectional_stream* stream, void bidirectional_stream_disable_auto_flush(bidirectional_stream* /*stream*/,
bool disable_auto_flush) { bool /*disable_auto_flush*/) {
GPR_ASSERT(0); GPR_ASSERT(0);
} }
void bidirectional_stream_delay_request_headers_until_flush( void bidirectional_stream_delay_request_headers_until_flush(
bidirectional_stream* stream, bool delay_headers_until_flush) { bidirectional_stream* /*stream*/, bool /*delay_headers_until_flush*/) {
GPR_ASSERT(0); GPR_ASSERT(0);
} }
void bidirectional_stream_flush(bidirectional_stream* stream) { GPR_ASSERT(0); } void bidirectional_stream_flush(bidirectional_stream* /*stream*/) {
GPR_ASSERT(0);
}
#endif /* GRPC_COMPILE_WITH_CRONET */ #endif /* GRPC_COMPILE_WITH_CRONET */

@ -1420,19 +1420,20 @@ inline stream_obj::~stream_obj() {
} }
static int init_stream(grpc_transport* gt, grpc_stream* gs, static int init_stream(grpc_transport* gt, grpc_stream* gs,
grpc_stream_refcount* refcount, const void* server_data, grpc_stream_refcount* refcount,
grpc_core::Arena* arena) { const void* /*server_data*/, grpc_core::Arena* arena) {
new (gs) stream_obj(gt, gs, refcount, arena); new (gs) stream_obj(gt, gs, refcount, arena);
return 0; return 0;
} }
static void set_pollset_do_nothing(grpc_transport* gt, grpc_stream* gs, static void set_pollset_do_nothing(grpc_transport* /*gt*/, grpc_stream* /*gs*/,
grpc_pollset* pollset) {} grpc_pollset* /*pollset*/) {}
static void set_pollset_set_do_nothing(grpc_transport* gt, grpc_stream* gs, static void set_pollset_set_do_nothing(grpc_transport* /*gt*/,
grpc_pollset_set* pollset_set) {} grpc_stream* /*gs*/,
grpc_pollset_set* /*pollset_set*/) {}
static void perform_stream_op(grpc_transport* gt, grpc_stream* gs, static void perform_stream_op(grpc_transport* /*gt*/, grpc_stream* gs,
grpc_transport_stream_op_batch* op) { grpc_transport_stream_op_batch* op) {
CRONET_LOG(GPR_DEBUG, "perform_stream_op"); CRONET_LOG(GPR_DEBUG, "perform_stream_op");
if (op->send_initial_metadata && if (op->send_initial_metadata &&
@ -1466,7 +1467,7 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
execute_from_storage(s); execute_from_storage(s);
} }
static void destroy_stream(grpc_transport* gt, grpc_stream* gs, static void destroy_stream(grpc_transport* /*gt*/, grpc_stream* gs,
grpc_closure* then_schedule_closure) { grpc_closure* then_schedule_closure) {
stream_obj* s = reinterpret_cast<stream_obj*>(gs); stream_obj* s = reinterpret_cast<stream_obj*>(gs);
s->~stream_obj(); s->~stream_obj();
@ -1474,11 +1475,11 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
GRPC_ERROR_NONE); GRPC_ERROR_NONE);
} }
static void destroy_transport(grpc_transport* gt) {} static void destroy_transport(grpc_transport* /*gt*/) {}
static grpc_endpoint* get_endpoint(grpc_transport* gt) { return nullptr; } static grpc_endpoint* get_endpoint(grpc_transport* /*gt*/) { return nullptr; }
static void perform_op(grpc_transport* gt, grpc_transport_op* op) {} static void perform_op(grpc_transport* /*gt*/, grpc_transport_op* /*op*/) {}
static const grpc_transport_vtable grpc_cronet_vtable = { static const grpc_transport_vtable grpc_cronet_vtable = {
sizeof(stream_obj), sizeof(stream_obj),
@ -1494,7 +1495,7 @@ static const grpc_transport_vtable grpc_cronet_vtable = {
grpc_transport* grpc_create_cronet_transport(void* engine, const char* target, grpc_transport* grpc_create_cronet_transport(void* engine, const char* target,
const grpc_channel_args* args, const grpc_channel_args* args,
void* reserved) { void* /*reserved*/) {
grpc_cronet_transport* ct = static_cast<grpc_cronet_transport*>( grpc_cronet_transport* ct = static_cast<grpc_cronet_transport*>(
gpr_malloc(sizeof(grpc_cronet_transport))); gpr_malloc(sizeof(grpc_cronet_transport)));
if (!ct) { if (!ct) {

@ -93,7 +93,7 @@ class GoogleMeshCaCertificateProviderFactory
grpc_error** error) override; grpc_error** error) override;
RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider( RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider(
RefCountedPtr<CertificateProviderFactory::Config> config) override { RefCountedPtr<CertificateProviderFactory::Config> /*config*/) override {
// TODO(yashykt) : To be implemented // TODO(yashykt) : To be implemented
return nullptr; return nullptr;
} }

@ -1389,8 +1389,8 @@ grpc_error* LdsResponseParseClient(
grpc_error* LdsResponseParseServer( grpc_error* LdsResponseParseServer(
upb_arena* arena, const envoy_config_listener_v3_Listener* listener, upb_arena* arena, const envoy_config_listener_v3_Listener* listener,
const std::string& listener_name, const std::string& /*listener_name*/,
const envoy_config_core_v3_Address* address, const envoy_config_core_v3_Address* /*address*/,
XdsApi::LdsUpdate* lds_update) { XdsApi::LdsUpdate* lds_update) {
lds_update->type = XdsApi::LdsUpdate::ListenerType::kTcpListener; lds_update->type = XdsApi::LdsUpdate::ListenerType::kTcpListener;
// TODO(yashykt): Support filter chain match. // TODO(yashykt): Support filter chain match.

@ -48,8 +48,8 @@ bool XdsChannelCredsRegistry::IsSupported(const std::string& creds_type) {
creds_type == "fake"; creds_type == "fake";
} }
bool XdsChannelCredsRegistry::IsValidConfig(const std::string& creds_type, bool XdsChannelCredsRegistry::IsValidConfig(const std::string& /*creds_type*/,
const Json& config) { const Json& /*config*/) {
// Currently, none of the creds types actually take a config, but we // Currently, none of the creds types actually take a config, but we
// ignore whatever might be specified in the bootstrap file for // ignore whatever might be specified in the bootstrap file for
// forward compatibility reasons. // forward compatibility reasons.
@ -58,7 +58,7 @@ bool XdsChannelCredsRegistry::IsValidConfig(const std::string& creds_type,
RefCountedPtr<grpc_channel_credentials> RefCountedPtr<grpc_channel_credentials>
XdsChannelCredsRegistry::MakeChannelCreds(const std::string& creds_type, XdsChannelCredsRegistry::MakeChannelCreds(const std::string& creds_type,
const Json& config) { const Json& /*config*/) {
if (creds_type == "google_default") { if (creds_type == "google_default") {
return grpc_google_default_credentials_create(nullptr); return grpc_google_default_credentials_create(nullptr);
} else if (creds_type == "insecure") { } else if (creds_type == "insecure") {
@ -157,38 +157,51 @@ std::unique_ptr<XdsBootstrap> ParseJsonAndCreate(
} // namespace } // namespace
std::unique_ptr<XdsBootstrap> XdsBootstrap::ReadFromFile( std::unique_ptr<XdsBootstrap> XdsBootstrap::Create(XdsClient* client,
XdsClient* client, TraceFlag* tracer, const char* fallback_config, TraceFlag* tracer,
grpc_error** error) { const char* fallback_config,
grpc_error** error) {
// First, try GRPC_XDS_BOOTSTRAP env var.
grpc_core::UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP")); grpc_core::UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP"));
if (path == nullptr) { if (path != nullptr) {
if (fallback_config != nullptr) { if (GRPC_TRACE_FLAG_ENABLED(*tracer)) {
return ParseJsonAndCreate(client, tracer, fallback_config, gpr_log(GPR_INFO,
"fallback config", error); "[xds_client %p] Got bootstrap file location from "
"GRPC_XDS_BOOTSTRAP environment variable: %s",
client, path.get());
} }
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( grpc_slice contents;
"Environment variable GRPC_XDS_BOOTSTRAP not defined"); *error =
return nullptr; grpc_load_file(path.get(), /*add_null_terminator=*/true, &contents);
} if (*error != GRPC_ERROR_NONE) return nullptr;
if (GRPC_TRACE_FLAG_ENABLED(*tracer)) { absl::string_view contents_str_view = StringViewFromSlice(contents);
gpr_log(GPR_INFO, if (GRPC_TRACE_FLAG_ENABLED(*tracer)) {
"[xds_client %p] Got bootstrap file location from " gpr_log(GPR_DEBUG, "[xds_client %p] Bootstrap file contents: %s", client,
"GRPC_XDS_BOOTSTRAP environment variable: %s", std::string(contents_str_view).c_str());
client, path.get()); }
} std::string bootstrap_source = absl::StrCat("file ", path.get());
grpc_slice contents; auto result = ParseJsonAndCreate(client, tracer, contents_str_view,
*error = grpc_load_file(path.get(), /*add_null_terminator=*/true, &contents); bootstrap_source, error);
if (*error != GRPC_ERROR_NONE) return nullptr; grpc_slice_unref_internal(contents);
absl::string_view contents_str_view = StringViewFromSlice(contents); return result;
if (GRPC_TRACE_FLAG_ENABLED(*tracer)) { }
gpr_log(GPR_DEBUG, "[xds_client %p] Bootstrap file contents: %s", client, // Next, try GRPC_XDS_BOOTSTRAP_CONFIG env var.
std::string(contents_str_view).c_str()); grpc_core::UniquePtr<char> env_config(
} gpr_getenv("GRPC_XDS_BOOTSTRAP_CONFIG"));
std::string bootstrap_source = absl::StrCat("file ", path.get()); if (env_config != nullptr) {
auto result = ParseJsonAndCreate(client, tracer, contents_str_view, return ParseJsonAndCreate(client, tracer, env_config.get(),
bootstrap_source, error); "GRPC_XDS_BOOTSTRAP_CONFIG env var", error);
grpc_slice_unref_internal(contents); }
return result; // Finally, try fallback config.
if (fallback_config != nullptr) {
return ParseJsonAndCreate(client, tracer, fallback_config,
"fallback config", error);
}
// No bootstrap config found.
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Environment variables GRPC_XDS_BOOTSTRAP or GRPC_XDS_BOOTSTRAP_CONFIG "
"not defined");
return nullptr;
} }
XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) { XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) {

@ -67,14 +67,19 @@ class XdsBootstrap {
bool ShouldUseV3() const; bool ShouldUseV3() const;
}; };
// Normally locates the bootstrap file via an env var. If no env var // Creates bootstrap object, obtaining the bootstrap JSON as appropriate
// is set, fallback_config will be used instead (if non-null). // for the environment:
// - If the GRPC_XDS_BOOTSTRAP env var is set, reads the file it specifies
// to obtain the bootstrap JSON.
// - Otherwise, if the GRPC_XDS_BOOTSTRAP_CONFIG env var is set, reads the
// content of that env var to obtain the bootstrap JSON.
// - Otherwise, the JSON will be read from fallback_config (if non-null).
// If *error is not GRPC_ERROR_NONE after returning, then there was an // If *error is not GRPC_ERROR_NONE after returning, then there was an
// error reading the file. // error (e.g., no config found or error reading the file).
static std::unique_ptr<XdsBootstrap> ReadFromFile(XdsClient* client, static std::unique_ptr<XdsBootstrap> Create(XdsClient* client,
TraceFlag* tracer, TraceFlag* tracer,
const char* fallback_config, const char* fallback_config,
grpc_error** error); grpc_error** error);
// Do not instantiate directly -- use ReadFromFile() above instead. // Do not instantiate directly -- use ReadFromFile() above instead.
XdsBootstrap(Json json, grpc_error** error); XdsBootstrap(Json json, grpc_error** error);

@ -1734,8 +1734,8 @@ XdsClient::XdsClient(grpc_error** error)
: nullptr), : nullptr),
request_timeout_(GetRequestTimeout()), request_timeout_(GetRequestTimeout()),
interested_parties_(grpc_pollset_set_create()), interested_parties_(grpc_pollset_set_create()),
bootstrap_(XdsBootstrap::ReadFromFile( bootstrap_(XdsBootstrap::Create(this, &grpc_xds_client_trace,
this, &grpc_xds_client_trace, g_fallback_bootstrap_config, error)), g_fallback_bootstrap_config, error)),
certificate_provider_store_(MakeOrphanable<CertificateProviderStore>( certificate_provider_store_(MakeOrphanable<CertificateProviderStore>(
bootstrap_ == nullptr bootstrap_ == nullptr
? CertificateProviderStore::PluginDefinitionMap() ? CertificateProviderStore::PluginDefinitionMap()

@ -33,15 +33,12 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include "src/core/lib/gpr/strerror.h"
static int ncpus = 0; static int ncpus = 0;
static void init_num_cpus() { static void init_num_cpus() {
#ifndef GPR_MUSL_LIBC_COMPAT #ifndef GPR_MUSL_LIBC_COMPAT
if (sched_getcpu() < 0) { if (sched_getcpu() < 0) {
gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno));
grpc_core::StrError(errno).c_str());
ncpus = 1; ncpus = 1;
return; return;
} }
@ -71,8 +68,7 @@ unsigned gpr_cpu_current_cpu(void) {
} }
int cpu = sched_getcpu(); int cpu = sched_getcpu();
if (cpu < 0) { if (cpu < 0) {
gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno));
grpc_core::StrError(errno).c_str());
return 0; return 0;
} }
if (static_cast<unsigned>(cpu) >= gpr_cpu_num_cores()) { if (static_cast<unsigned>(cpu) >= gpr_cpu_num_cores()) {

@ -1,103 +0,0 @@
/*
*
* Copyright 2020 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpc/support/port_platform.h>
#include "src/core/lib/gpr/strerror.h"
#include <array>
#include <cerrno>
#include <cstddef>
#include <cstdio>
#include <cstring>
#include <string>
#include <type_traits>
// The implementation below is mostly copied from abseil because it is internal
// there.
namespace grpc_core {
namespace {
// `ErrnoSaver` captures the value of `errno` upon construction and restores it
// upon deletion. It is used in low-level code and must be super fast. Do not
// add instrumentation, even in debug modes.
class ErrnoSaver {
public:
ErrnoSaver() : saved_errno_(errno) {}
~ErrnoSaver() { errno = saved_errno_; }
int operator()() const { return saved_errno_; }
private:
const int saved_errno_;
};
const char* StrErrorAdaptor(int errnum, char* buf, size_t buflen) {
#if defined(GPR_WINDOWS)
int rc = strerror_s(buf, buflen, errnum);
buf[buflen - 1] = '\0'; // guarantee NUL termination
if (rc == 0 && strncmp(buf, "Unknown error", buflen) == 0) *buf = '\0';
return buf;
#else
// The type of `ret` is platform-specific; both of these branches must compile
// either way but only one will execute on any given platform:
auto ret = strerror_r(errnum, buf, buflen);
if (std::is_same<decltype(ret), int>::value) {
// XSI `strerror_r`; `ret` is `int`:
if (ret) *buf = '\0';
return buf;
} else {
// GNU `strerror_r`; `ret` is `char *`:
return reinterpret_cast<const char*>(ret);
}
#endif
}
std::string StrErrorInternal(int errnum) {
char buf[100];
const char* str = StrErrorAdaptor(errnum, buf, sizeof buf);
if (*str == '\0') {
snprintf(buf, sizeof buf, "Unknown error %d", errnum);
str = buf;
}
return str;
}
// kSysNerr is the number of errors from a recent glibc. `StrError()` falls back
// to `StrErrorAdaptor()` if the value is larger than this.
constexpr int kSysNerr = 135;
std::array<std::string, kSysNerr>* NewStrErrorTable() {
auto* table = new std::array<std::string, kSysNerr>;
for (int i = 0; i < static_cast<int>(table->size()); ++i) {
(*table)[i] = StrErrorInternal(i);
}
return table;
}
} // namespace
std::string StrError(int errnum) {
ErrnoSaver errno_saver;
static const auto* table = NewStrErrorTable();
if (errnum >= 0 && errnum < static_cast<int>(table->size())) {
return (*table)[errnum];
}
return StrErrorInternal(errnum);
}
} // namespace grpc_core

@ -1,35 +0,0 @@
/*
*
* Copyright 2020 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_CORE_LIB_GPR_STRERROR_H
#define GRPC_CORE_LIB_GPR_STRERROR_H
#include <grpc/support/port_platform.h>
#include <string>
namespace grpc_core {
// `strerror` is not thread-safe. This wrapper is a portable thread-safe
// implementation. It does not modify `errno`.
// The implementation is copied from abseil's internal.
std::string StrError(int errnum);
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPR_STRERROR_H */

@ -31,7 +31,6 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/string_util.h> #include <grpc/support/string_util.h>
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/string.h"
FILE* gpr_tmpfile(const char* prefix, char** tmp_filename) { FILE* gpr_tmpfile(const char* prefix, char** tmp_filename) {
@ -47,13 +46,13 @@ FILE* gpr_tmpfile(const char* prefix, char** tmp_filename) {
fd = mkstemp(filename_template); fd = mkstemp(filename_template);
if (fd == -1) { if (fd == -1) {
gpr_log(GPR_ERROR, "mkstemp failed for filename_template %s with error %s.", gpr_log(GPR_ERROR, "mkstemp failed for filename_template %s with error %s.",
filename_template, grpc_core::StrError(errno).c_str()); filename_template, strerror(errno));
goto end; goto end;
} }
result = fdopen(fd, "w+"); result = fdopen(fd, "w+");
if (result == nullptr) { if (result == nullptr) {
gpr_log(GPR_ERROR, "Could not open file %s from fd %d (error = %s).", gpr_log(GPR_ERROR, "Could not open file %s from fd %d (error = %s).",
filename_template, fd, grpc_core::StrError(errno).c_str()); filename_template, fd, strerror(errno));
unlink(filename_template); unlink(filename_template);
close(fd); close(fd);
goto end; goto end;

@ -226,7 +226,7 @@ class Delete<T, true> {
template <typename T> template <typename T>
class Delete<T, false> { class Delete<T, false> {
public: public:
explicit Delete(T* t) {} explicit Delete(T* /*t*/) {}
}; };
} // namespace internal } // namespace internal

@ -25,7 +25,6 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gprpp/stat.h" #include "src/core/lib/gprpp/stat.h"
namespace grpc_core { namespace grpc_core {
@ -35,9 +34,9 @@ absl::Status GetFileModificationTime(const char* filename, time_t* timestamp) {
GPR_ASSERT(timestamp != nullptr); GPR_ASSERT(timestamp != nullptr);
struct stat buf; struct stat buf;
if (stat(filename, &buf) != 0) { if (stat(filename, &buf) != 0) {
std::string error_msg = StrError(errno); const char* error_msg = strerror(errno);
gpr_log(GPR_ERROR, "stat failed for filename %s with error %s.", filename, gpr_log(GPR_ERROR, "stat failed for filename %s with error %s.", filename,
error_msg.c_str()); error_msg);
return absl::Status(absl::StatusCode::kInternal, error_msg); return absl::Status(absl::StatusCode::kInternal, error_msg);
} }
// Last file/directory modification time. // Last file/directory modification time.

@ -24,7 +24,6 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gprpp/stat.h" #include "src/core/lib/gprpp/stat.h"
namespace grpc_core { namespace grpc_core {
@ -34,9 +33,9 @@ absl::Status GetFileModificationTime(const char* filename, time_t* timestamp) {
GPR_ASSERT(timestamp != nullptr); GPR_ASSERT(timestamp != nullptr);
struct _stat buf; struct _stat buf;
if (_stat(filename, &buf) != 0) { if (_stat(filename, &buf) != 0) {
std::string error_msg = StrError(errno); const char* error_msg = strerror(errno);
gpr_log(GPR_ERROR, "_stat failed for filename %s with error %s.", filename, gpr_log(GPR_ERROR, "_stat failed for filename %s with error %s.", filename,
error_msg.c_str()); error_msg);
return absl::Status(absl::StatusCode::kInternal, error_msg); return absl::Status(absl::StatusCode::kInternal, error_msg);
} }
// Last file/directory modification time. // Last file/directory modification time.

@ -32,7 +32,6 @@
#endif #endif
#include "src/core/lib/debug/trace.h" #include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gpr/useful.h" #include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/error_internal.h" #include "src/core/lib/iomgr/error_internal.h"
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
@ -778,15 +777,15 @@ const char* grpc_error_string(grpc_error* err) {
grpc_error* grpc_os_error(const char* file, int line, int err, grpc_error* grpc_os_error(const char* file, int line, int err,
const char* call_name) { const char* call_name) {
std::string err_string = grpc_core::StrError(err);
return grpc_error_set_str( return grpc_error_set_str(
grpc_error_set_str( grpc_error_set_str(
grpc_error_set_int( grpc_error_set_int(
grpc_error_create(file, line, grpc_error_create(file, line,
grpc_slice_from_cpp_string(err_string), nullptr, grpc_slice_from_static_string(strerror(err)),
0), nullptr, 0),
GRPC_ERROR_INT_ERRNO, err), GRPC_ERROR_INT_ERRNO, err),
GRPC_ERROR_STR_OS_ERROR, grpc_slice_from_cpp_string(err_string)), GRPC_ERROR_STR_OS_ERROR,
grpc_slice_from_static_string(strerror(err))),
GRPC_ERROR_STR_SYSCALL, grpc_slice_from_copied_string(call_name)); GRPC_ERROR_STR_SYSCALL, grpc_slice_from_copied_string(call_name));
} }

@ -49,7 +49,6 @@
#include <grpc/support/cpu.h> #include <grpc/support/cpu.h>
#include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tls.h" #include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gpr/useful.h" #include "src/core/lib/gpr/useful.h"
@ -372,8 +371,7 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
ev.data.ptr = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(new_fd) | ev.data.ptr = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(new_fd) |
(track_err ? 1 : 0)); (track_err ? 1 : 0));
if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_ADD, fd, &ev) != 0) { if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_ADD, fd, &ev) != 0) {
gpr_log(GPR_ERROR, "epoll_ctl failed: %s", gpr_log(GPR_ERROR, "epoll_ctl failed: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
} }
return new_fd; return new_fd;
@ -394,8 +392,7 @@ static void fd_shutdown_internal(grpc_fd* fd, grpc_error* why,
epoll_event dummy_event; epoll_event dummy_event;
if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_DEL, fd->fd, &dummy_event) != if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_DEL, fd->fd, &dummy_event) !=
0) { 0) {
gpr_log(GPR_ERROR, "epoll_ctl failed: %s", gpr_log(GPR_ERROR, "epoll_ctl failed: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
} }
} }
fd->write_closure->SetShutdown(GRPC_ERROR_REF(why)); fd->write_closure->SetShutdown(GRPC_ERROR_REF(why));

@ -21,7 +21,6 @@
#include "src/core/lib/iomgr/port.h" #include "src/core/lib/iomgr/port.h"
#include <grpc/impl/codegen/log.h> #include <grpc/impl/codegen/log.h>
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/iomgr/internal_errqueue.h" #include "src/core/lib/iomgr/internal_errqueue.h"
#ifdef GRPC_POSIX_SOCKET_TCP #ifdef GRPC_POSIX_SOCKET_TCP
@ -42,7 +41,7 @@ void grpc_errqueue_init() {
#ifdef GRPC_LINUX_ERRQUEUE #ifdef GRPC_LINUX_ERRQUEUE
struct utsname buffer; struct utsname buffer;
if (uname(&buffer) != 0) { if (uname(&buffer) != 0) {
gpr_log(GPR_ERROR, "uname: %s", StrError(errno).c_str()); gpr_log(GPR_ERROR, "uname: %s", strerror(errno));
return; return;
} }
char* release = buffer.release; char* release = buffer.release;

@ -48,7 +48,6 @@
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/iomgr/sockaddr_utils.h"
@ -63,6 +62,7 @@ grpc_error* grpc_set_socket_zerocopy(int fd) {
} }
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
#else #else
(void)fd;
return GRPC_OS_ERROR(ENOSYS, "setsockopt(SO_ZEROCOPY)"); return GRPC_OS_ERROR(ENOSYS, "setsockopt(SO_ZEROCOPY)");
#endif #endif
} }
@ -364,12 +364,12 @@ grpc_error* grpc_set_socket_tcp_user_timeout(
if (0 != setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &timeout, if (0 != setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &timeout,
sizeof(timeout))) { sizeof(timeout))) {
gpr_log(GPR_ERROR, "setsockopt(TCP_USER_TIMEOUT) %s", gpr_log(GPR_ERROR, "setsockopt(TCP_USER_TIMEOUT) %s",
grpc_core::StrError(errno).c_str()); strerror(errno));
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
if (0 != getsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &newval, &len)) { if (0 != getsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &newval, &len)) {
gpr_log(GPR_ERROR, "getsockopt(TCP_USER_TIMEOUT) %s", gpr_log(GPR_ERROR, "getsockopt(TCP_USER_TIMEOUT) %s",
grpc_core::StrError(errno).c_str()); strerror(errno));
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
if (newval != timeout) { if (newval != timeout) {

@ -1241,11 +1241,11 @@ static void tcp_handle_error(void* arg /* grpc_tcp */, grpc_error* error) {
#else /* GRPC_LINUX_ERRQUEUE */ #else /* GRPC_LINUX_ERRQUEUE */
static TcpZerocopySendRecord* tcp_get_send_zerocopy_record( static TcpZerocopySendRecord* tcp_get_send_zerocopy_record(
grpc_tcp* tcp, grpc_slice_buffer* buf) { grpc_tcp* /*tcp*/, grpc_slice_buffer* /*buf*/) {
return nullptr; return nullptr;
} }
static void ZerocopyDisableAndWaitForRemaining(grpc_tcp* tcp) {} static void ZerocopyDisableAndWaitForRemaining(grpc_tcp* /*tcp*/) {}
static bool tcp_write_with_timestamps(grpc_tcp* /*tcp*/, struct msghdr* /*msg*/, static bool tcp_write_with_timestamps(grpc_tcp* /*tcp*/, struct msghdr* /*msg*/,
size_t /*sending_length*/, size_t /*sending_length*/,
@ -1391,8 +1391,8 @@ static bool do_tcp_flush_zerocopy(grpc_tcp* tcp, TcpZerocopySendRecord* record,
static void UnrefMaybePutZerocopySendRecord(grpc_tcp* tcp, static void UnrefMaybePutZerocopySendRecord(grpc_tcp* tcp,
TcpZerocopySendRecord* record, TcpZerocopySendRecord* record,
uint32_t seq, uint32_t /*seq*/,
const char* /* tag */) { const char* /*tag*/) {
if (record->Unref()) { if (record->Unref()) {
tcp->tcp_zerocopy_send_ctx.PutSendRecord(record); tcp->tcp_zerocopy_send_ctx.PutSendRecord(record);
} }

@ -48,7 +48,6 @@
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/exec_ctx.h"
@ -214,8 +213,7 @@ static void on_read(void* arg, grpc_error* err) {
default: default:
gpr_mu_lock(&sp->server->mu); gpr_mu_lock(&sp->server->mu);
if (!sp->server->shutdown_listeners) { if (!sp->server->shutdown_listeners) {
gpr_log(GPR_ERROR, "Failed accept4: %s", gpr_log(GPR_ERROR, "Failed accept4: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
} else { } else {
/* if we have shutdown listeners, accept4 could fail, and we /* if we have shutdown listeners, accept4 could fail, and we
needn't notify users */ needn't notify users */
@ -232,8 +230,7 @@ static void on_read(void* arg, grpc_error* err) {
addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage)); addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage));
if (getsockname(fd, reinterpret_cast<struct sockaddr*>(addr.addr), if (getsockname(fd, reinterpret_cast<struct sockaddr*>(addr.addr),
&(addr.len)) < 0) { &(addr.len)) < 0) {
gpr_log(GPR_ERROR, "Failed getsockname: %s", gpr_log(GPR_ERROR, "Failed getsockname: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
close(fd); close(fd);
goto error; goto error;
} }
@ -583,8 +580,7 @@ class ExternalConnectionHandler : public grpc_core::TcpServerFdHandler {
if (getpeername(fd, reinterpret_cast<struct sockaddr*>(addr.addr), if (getpeername(fd, reinterpret_cast<struct sockaddr*>(addr.addr),
&(addr.len)) < 0) { &(addr.len)) < 0) {
gpr_log(GPR_ERROR, "Failed getpeername: %s", gpr_log(GPR_ERROR, "Failed getpeername: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
close(fd); close(fd);
return; return;
} }

@ -57,7 +57,6 @@
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/error.h"
@ -368,13 +367,11 @@ static int prepare_socket(grpc_socket_factory* socket_factory, int fd,
} }
if (grpc_set_socket_nonblocking(fd, 1) != GRPC_ERROR_NONE) { if (grpc_set_socket_nonblocking(fd, 1) != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Unable to set nonblocking %d: %s", fd, gpr_log(GPR_ERROR, "Unable to set nonblocking %d: %s", fd, strerror(errno));
grpc_core::StrError(errno).c_str());
goto error; goto error;
} }
if (grpc_set_socket_cloexec(fd, 1) != GRPC_ERROR_NONE) { if (grpc_set_socket_cloexec(fd, 1) != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Unable to set cloexec %d: %s", fd, gpr_log(GPR_ERROR, "Unable to set cloexec %d: %s", fd, strerror(errno));
grpc_core::StrError(errno).c_str());
goto error; goto error;
} }
@ -416,8 +413,7 @@ static int prepare_socket(grpc_socket_factory* socket_factory, int fd,
if (bind_socket(socket_factory, fd, addr) < 0) { if (bind_socket(socket_factory, fd, addr) < 0) {
std::string addr_str = grpc_sockaddr_to_string(addr, false); std::string addr_str = grpc_sockaddr_to_string(addr, false);
gpr_log(GPR_ERROR, "bind addr=%s: %s", addr_str.c_str(), gpr_log(GPR_ERROR, "bind addr=%s: %s", addr_str.c_str(), strerror(errno));
grpc_core::StrError(errno).c_str());
goto error; goto error;
} }
@ -426,7 +422,7 @@ static int prepare_socket(grpc_socket_factory* socket_factory, int fd,
if (getsockname(fd, reinterpret_cast<grpc_sockaddr*>(sockname_temp.addr), if (getsockname(fd, reinterpret_cast<grpc_sockaddr*>(sockname_temp.addr),
&sockname_temp.len) < 0) { &sockname_temp.len) < 0) {
gpr_log(GPR_ERROR, "Unable to get the address socket %d is bound to: %s", gpr_log(GPR_ERROR, "Unable to get the address socket %d is bound to: %s",
fd, grpc_core::StrError(errno).c_str()); fd, strerror(errno));
goto error; goto error;
} }
@ -674,8 +670,7 @@ int grpc_udp_server_add_port(grpc_udp_server* s, grpc_resolved_address* addr,
GRPC_ERROR_UNREF(grpc_create_dualstack_socket_using_factory( GRPC_ERROR_UNREF(grpc_create_dualstack_socket_using_factory(
s->socket_factory, addr, SOCK_DGRAM, IPPROTO_UDP, &dsmode, &fd)); s->socket_factory, addr, SOCK_DGRAM, IPPROTO_UDP, &dsmode, &fd));
if (fd < 0) { if (fd < 0) {
gpr_log(GPR_ERROR, "Unable to create socket: %s", gpr_log(GPR_ERROR, "Unable to create socket: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
} }
if (dsmode == GRPC_DSMODE_IPV4 && if (dsmode == GRPC_DSMODE_IPV4 &&
grpc_sockaddr_is_v4mapped(addr, &addr4_copy)) { grpc_sockaddr_is_v4mapped(addr, &addr4_copy)) {

@ -31,15 +31,13 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/iomgr/socket_utils_posix.h" #include "src/core/lib/iomgr/socket_utils_posix.h"
static grpc_error* pipe_init(grpc_wakeup_fd* fd_info) { static grpc_error* pipe_init(grpc_wakeup_fd* fd_info) {
int pipefd[2]; int pipefd[2];
int r = pipe(pipefd); int r = pipe(pipefd);
if (0 != r) { if (0 != r) {
gpr_log(GPR_ERROR, "pipe creation failed (%d): %s", errno, gpr_log(GPR_ERROR, "pipe creation failed (%d): %s", errno, strerror(errno));
grpc_core::StrError(errno).c_str());
return GRPC_OS_ERROR(errno, "pipe"); return GRPC_OS_ERROR(errno, "pipe");
} }
grpc_error* err; grpc_error* err;

@ -48,7 +48,7 @@ class Activation : public BaseActivation {
Activation& operator=(const Activation&) = delete; Activation& operator=(const Activation&) = delete;
// Insert value into Activation. // Insert value into Activation.
void InsertValue(absl::string_view name, const CelValue& value) {} void InsertValue(absl::string_view /*name*/, const CelValue& /*value*/) {}
}; };
} // namespace mock_cel } // namespace mock_cel

@ -61,23 +61,25 @@ class CelValue {
// We rely on copy elision to avoid extra copying. // We rely on copy elision to avoid extra copying.
static CelValue CreateNull() { return CelValue(nullptr); } static CelValue CreateNull() { return CelValue(nullptr); }
static CelValue CreateInt64(int64_t value) { return CreateNull(); } static CelValue CreateInt64(int64_t /*value*/) { return CreateNull(); }
static CelValue CreateUint64(uint64_t value) { return CreateNull(); } static CelValue CreateUint64(uint64_t /*value*/) { return CreateNull(); }
static CelValue CreateStringView(absl::string_view value) { static CelValue CreateStringView(absl::string_view /*value*/) {
return CreateNull(); return CreateNull();
} }
static CelValue CreateString(const std::string* str) { return CreateNull(); } static CelValue CreateString(const std::string* /*str*/) {
return CreateNull();
}
static CelValue CreateMap(const CelMap* value) { return CreateNull(); } static CelValue CreateMap(const CelMap* /*value*/) { return CreateNull(); }
private: private:
// Constructs CelValue wrapping value supplied as argument. // Constructs CelValue wrapping value supplied as argument.
// Value type T should be supported by specification of ValueHolder. // Value type T should be supported by specification of ValueHolder.
template <class T> template <class T>
explicit CelValue(T value) {} explicit CelValue(T /*value*/) {}
}; };
// CelMap implementation that uses STL map container as backing storage. // CelMap implementation that uses STL map container as backing storage.
@ -86,7 +88,7 @@ class ContainerBackedMapImpl : public CelMap {
ContainerBackedMapImpl() = default; ContainerBackedMapImpl() = default;
static std::unique_ptr<CelMap> Create( static std::unique_ptr<CelMap> Create(
absl::Span<std::pair<CelValue, CelValue>> key_values) { absl::Span<std::pair<CelValue, CelValue>> /*key_values*/) {
return absl::make_unique<ContainerBackedMapImpl>(); return absl::make_unique<ContainerBackedMapImpl>();
} }
}; };

@ -120,7 +120,7 @@ AwsExternalAccountCredentials::AwsExternalAccountCredentials(
} }
void AwsExternalAccountCredentials::RetrieveSubjectToken( void AwsExternalAccountCredentials::RetrieveSubjectToken(
HTTPRequestContext* ctx, const Options& options, HTTPRequestContext* ctx, const Options& /*options*/,
std::function<void(std::string, grpc_error*)> cb) { std::function<void(std::string, grpc_error*)> cb) {
if (ctx == nullptr) { if (ctx == nullptr) {
FinishRetrieveSubjectToken( FinishRetrieveSubjectToken(

@ -91,7 +91,7 @@ FileExternalAccountCredentials::FileExternalAccountCredentials(
} }
void FileExternalAccountCredentials::RetrieveSubjectToken( void FileExternalAccountCredentials::RetrieveSubjectToken(
HTTPRequestContext* ctx, const Options& options, HTTPRequestContext* /*ctx*/, const Options& /*options*/,
std::function<void(std::string, grpc_error*)> cb) { std::function<void(std::string, grpc_error*)> cb) {
struct SliceWrapper { struct SliceWrapper {
~SliceWrapper() { grpc_slice_unref_internal(slice); } ~SliceWrapper() { grpc_slice_unref_internal(slice); }

@ -112,7 +112,7 @@ UrlExternalAccountCredentials::UrlExternalAccountCredentials(
} }
void UrlExternalAccountCredentials::RetrieveSubjectToken( void UrlExternalAccountCredentials::RetrieveSubjectToken(
HTTPRequestContext* ctx, const Options& options, HTTPRequestContext* ctx, const Options& /*options*/,
std::function<void(std::string, grpc_error*)> cb) { std::function<void(std::string, grpc_error*)> cb) {
if (ctx == nullptr) { if (ctx == nullptr) {
FinishRetrieveSubjectToken( FinishRetrieveSubjectToken(

@ -59,7 +59,7 @@ class grpc_fake_server_credentials final : public grpc_server_credentials {
~grpc_fake_server_credentials() override = default; ~grpc_fake_server_credentials() override = default;
grpc_core::RefCountedPtr<grpc_server_security_connector> grpc_core::RefCountedPtr<grpc_server_security_connector>
create_security_connector(const grpc_channel_args* args) override { create_security_connector(const grpc_channel_args* /*args*/) override {
return grpc_fake_server_security_connector_create(this->Ref()); return grpc_fake_server_security_connector_create(this->Ref());
} }
}; };

@ -51,14 +51,14 @@ RefCountedPtr<grpc_auth_context> TestOnlyMakeInsecureAuthContext() {
// check_call_host and cancel_check_call_host are no-ops since we want to // check_call_host and cancel_check_call_host are no-ops since we want to
// provide an insecure channel. // provide an insecure channel.
bool InsecureChannelSecurityConnector::check_call_host( bool InsecureChannelSecurityConnector::check_call_host(
absl::string_view host, grpc_auth_context* auth_context, absl::string_view /*host*/, grpc_auth_context* /*auth_context*/,
grpc_closure* on_call_host_checked, grpc_error** error) { grpc_closure* /*on_call_host_checked*/, grpc_error** error) {
*error = GRPC_ERROR_NONE; *error = GRPC_ERROR_NONE;
return true; return true;
} }
void InsecureChannelSecurityConnector::cancel_check_call_host( void InsecureChannelSecurityConnector::cancel_check_call_host(
grpc_closure* on_call_host_checked, grpc_error* error) { grpc_closure* /*on_call_host_checked*/, grpc_error* error) {
GRPC_ERROR_UNREF(error); GRPC_ERROR_UNREF(error);
} }
@ -76,7 +76,7 @@ void InsecureChannelSecurityConnector::add_handshakers(
} }
void InsecureChannelSecurityConnector::check_peer( void InsecureChannelSecurityConnector::check_peer(
tsi_peer peer, grpc_endpoint* ep, tsi_peer peer, grpc_endpoint* /*ep*/,
RefCountedPtr<grpc_auth_context>* auth_context, RefCountedPtr<grpc_auth_context>* auth_context,
grpc_closure* on_peer_checked) { grpc_closure* on_peer_checked) {
*auth_context = MakeAuthContext(); *auth_context = MakeAuthContext();
@ -104,7 +104,7 @@ void InsecureServerSecurityConnector::add_handshakers(
} }
void InsecureServerSecurityConnector::check_peer( void InsecureServerSecurityConnector::check_peer(
tsi_peer peer, grpc_endpoint* ep, tsi_peer peer, grpc_endpoint* /*ep*/,
grpc_core::RefCountedPtr<grpc_auth_context>* auth_context, grpc_core::RefCountedPtr<grpc_auth_context>* auth_context,
grpc_closure* on_peer_checked) { grpc_closure* on_peer_checked) {
*auth_context = MakeAuthContext(); *auth_context = MakeAuthContext();

@ -513,7 +513,7 @@ grpc_resource_user* CreateDefaultResourceUser(const grpc_channel_args* args) {
} }
RefCountedPtr<channelz::ServerNode> CreateChannelzNode( RefCountedPtr<channelz::ServerNode> CreateChannelzNode(
Server* server, const grpc_channel_args* args) { const grpc_channel_args* args) {
RefCountedPtr<channelz::ServerNode> channelz_node; RefCountedPtr<channelz::ServerNode> channelz_node;
if (grpc_channel_args_find_bool(args, GRPC_ARG_ENABLE_CHANNELZ, if (grpc_channel_args_find_bool(args, GRPC_ARG_ENABLE_CHANNELZ,
GRPC_ENABLE_CHANNELZ_DEFAULT)) { GRPC_ENABLE_CHANNELZ_DEFAULT)) {
@ -534,7 +534,7 @@ RefCountedPtr<channelz::ServerNode> CreateChannelzNode(
Server::Server(const grpc_channel_args* args) Server::Server(const grpc_channel_args* args)
: channel_args_(grpc_channel_args_copy(args)), : channel_args_(grpc_channel_args_copy(args)),
default_resource_user_(CreateDefaultResourceUser(args)), default_resource_user_(CreateDefaultResourceUser(args)),
channelz_node_(CreateChannelzNode(this, args)) {} channelz_node_(CreateChannelzNode(args)) {}
Server::~Server() { Server::~Server() {
grpc_channel_args_destroy(channel_args_); grpc_channel_args_destroy(channel_args_);

@ -673,6 +673,10 @@ void grpc_mdelem_do_unref(grpc_mdelem gmd DEBUG_ARGS) {
void grpc_mdelem_on_final_unref(grpc_mdelem_data_storage storage, void* ptr, void grpc_mdelem_on_final_unref(grpc_mdelem_data_storage storage, void* ptr,
uint32_t hash DEBUG_ARGS) { uint32_t hash DEBUG_ARGS) {
#ifndef NDEBUG
(void)file;
(void)line;
#endif
switch (storage) { switch (storage) {
case GRPC_MDELEM_STORAGE_EXTERNAL: case GRPC_MDELEM_STORAGE_EXTERNAL:
case GRPC_MDELEM_STORAGE_STATIC: case GRPC_MDELEM_STORAGE_STATIC:

@ -490,7 +490,7 @@ struct fake_handshaker_result {
size_t unused_bytes_size; size_t unused_bytes_size;
}; };
static tsi_result fake_handshaker_result_extract_peer( 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, security_level. */ /* Construct a tsi_peer with 1 property: certificate type, security_level. */
tsi_result result = tsi_construct_peer(2, peer); tsi_result result = tsi_construct_peer(2, peer);
if (result != TSI_OK) return result; if (result != TSI_OK) return result;

@ -22,8 +22,8 @@
namespace grpc { namespace grpc {
grpc_error* CensusChannelData::Init(grpc_channel_element* elem, grpc_error* CensusChannelData::Init(grpc_channel_element* /*elem*/,
grpc_channel_element_args* args) { grpc_channel_element_args* /*args*/) {
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }

@ -152,9 +152,9 @@ grpc_error* CensusClientCallData::Init(grpc_call_element* elem,
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
void CensusClientCallData::Destroy(grpc_call_element* elem, void CensusClientCallData::Destroy(grpc_call_element* /*elem*/,
const grpc_call_final_info* final_info, const grpc_call_final_info* final_info,
grpc_closure* then_call_closure) { grpc_closure* /*then_call_closure*/) {
const uint64_t request_size = GetOutgoingDataSize(final_info); const uint64_t request_size = GetOutgoingDataSize(final_info);
const uint64_t response_size = GetIncomingDataSize(final_info); const uint64_t response_size = GetIncomingDataSize(final_info);
double latency_ms = absl::ToDoubleMilliseconds(absl::Now() - start_time_); double latency_ms = absl::ToDoubleMilliseconds(absl::Now() - start_time_);

@ -28,9 +28,8 @@ using ::opencensus::tags::TagMap;
using ::opencensus::trace::Span; using ::opencensus::trace::Span;
using ::opencensus::trace::SpanContext; using ::opencensus::trace::SpanContext;
void GenerateServerContext(absl::string_view tracing, absl::string_view stats, void GenerateServerContext(absl::string_view tracing, absl::string_view method,
absl::string_view primary_role, CensusContext* context) {
absl::string_view method, CensusContext* context) {
// Destruct the current CensusContext to free the Span memory before // Destruct the current CensusContext to free the Span memory before
// overwriting it below. // overwriting it below.
context->~CensusContext(); context->~CensusContext();
@ -77,7 +76,7 @@ size_t TraceContextSerialize(const ::opencensus::trace::SpanContext& context,
tracing_buf_size); tracing_buf_size);
} }
size_t StatsContextSerialize(size_t max_tags_len, grpc_slice* tags) { size_t StatsContextSerialize(size_t /*max_tags_len*/, grpc_slice* /*tags*/) {
// TODO(unknown): Add implementation. Waiting on stats tagging to be added. // TODO(unknown): Add implementation. Waiting on stats tagging to be added.
return 0; return 0;
} }

@ -96,9 +96,8 @@ size_t ServerStatsDeserialize(const char* buf, size_t buf_size,
// Deserialize the incoming SpanContext and generate a new server context based // Deserialize the incoming SpanContext and generate a new server context based
// on that. This new span will never be a root span. This should only be called // on that. This new span will never be a root span. This should only be called
// with a blank CensusContext as it overwrites it. // with a blank CensusContext as it overwrites it.
void GenerateServerContext(absl::string_view tracing, absl::string_view stats, void GenerateServerContext(absl::string_view tracing, absl::string_view method,
absl::string_view primary_role, CensusContext* context);
absl::string_view method, CensusContext* context);
// Creates a new client context that is by default a new root context. // Creates a new client context that is by default a new root context.
// If the current context is the default context then the newly created // If the current context is the default context then the newly created

@ -103,19 +103,8 @@ void CensusServerCallData::OnDoneRecvInitialMetadataCb(void* user_data,
size_t tracing_str_len = GRPC_SLICE_IS_EMPTY(sml.tracing_slice) size_t tracing_str_len = GRPC_SLICE_IS_EMPTY(sml.tracing_slice)
? 0 ? 0
: GRPC_SLICE_LENGTH(sml.tracing_slice); : GRPC_SLICE_LENGTH(sml.tracing_slice);
const char* census_str = GRPC_SLICE_IS_EMPTY(sml.census_proto)
? ""
: reinterpret_cast<const char*>(
GRPC_SLICE_START_PTR(sml.census_proto));
size_t census_str_len = GRPC_SLICE_IS_EMPTY(sml.census_proto)
? 0
: GRPC_SLICE_LENGTH(sml.census_proto);
GenerateServerContext(absl::string_view(tracing_str, tracing_str_len), GenerateServerContext(absl::string_view(tracing_str, tracing_str_len),
absl::string_view(census_str, census_str_len), calld->qualified_method_, &calld->context_);
/*primary_role*/ "", calld->qualified_method_,
&calld->context_);
grpc_slice_unref_internal(sml.tracing_slice); grpc_slice_unref_internal(sml.tracing_slice);
grpc_slice_unref_internal(sml.census_proto); grpc_slice_unref_internal(sml.census_proto);
grpc_slice_unref_internal(sml.path); grpc_slice_unref_internal(sml.path);
@ -179,9 +168,9 @@ grpc_error* CensusServerCallData::Init(grpc_call_element* elem,
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
void CensusServerCallData::Destroy(grpc_call_element* elem, void CensusServerCallData::Destroy(grpc_call_element* /*elem*/,
const grpc_call_final_info* final_info, const grpc_call_final_info* final_info,
grpc_closure* then_call_closure) { grpc_closure* /*then_call_closure*/) {
const uint64_t request_size = GetOutgoingDataSize(final_info); const uint64_t request_size = GetOutgoingDataSize(final_info);
const uint64_t response_size = GetIncomingDataSize(final_info); const uint64_t response_size = GetIncomingDataSize(final_info);
double elapsed_time_ms = absl::ToDoubleMilliseconds(elapsed_time_); double elapsed_time_ms = absl::ToDoubleMilliseconds(elapsed_time_);

@ -362,7 +362,7 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::Shutdown(
void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnFinishDone( void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnFinishDone(
// NOLINTNEXTLINE(performance-unnecessary-value-param) // NOLINTNEXTLINE(performance-unnecessary-value-param)
std::shared_ptr<ReportLoadHandler> self, bool ok) { std::shared_ptr<ReportLoadHandler> /*self*/, bool ok) {
if (ok) { if (ok) {
gpr_log(GPR_INFO, gpr_log(GPR_INFO,
"[LRS %p] Load reporting finished (lb_id_: %s, handler: %p).", "[LRS %p] Load reporting finished (lb_id_: %s, handler: %p).",

@ -51,7 +51,7 @@ void LoadReportingServiceServerBuilderPlugin::InitServer(
} }
void LoadReportingServiceServerBuilderPlugin::Finish( void LoadReportingServiceServerBuilderPlugin::Finish(
grpc::ServerInitializer* si) { grpc::ServerInitializer* /*si*/) {
service_->StartThread(); service_->StartThread();
service_.reset(); service_.reset();
} }

@ -44,8 +44,8 @@ class LoadReportingServiceServerBuilderPlugin : public ServerBuilderPlugin {
// Starts the load reporter service. // Starts the load reporter service.
void Finish(ServerInitializer* si) override; void Finish(ServerInitializer* si) override;
void ChangeArguments(const std::string& name, void* value) override {} void ChangeArguments(const std::string& /*name*/, void* /*value*/) override {}
void UpdateChannelArguments(grpc::ChannelArguments* args) override {} void UpdateChannelArguments(grpc::ChannelArguments* /*args*/) override {}
bool has_sync_methods() const override; bool has_sync_methods() const override;
bool has_async_methods() const override; bool has_async_methods() const override;

@ -17,34 +17,3 @@
*/ */
#include <grpcpp/support/error_details.h> #include <grpcpp/support/error_details.h>
#include "src/proto/grpc/status/status.pb.h"
namespace grpc {
grpc::Status ExtractErrorDetails(const grpc::Status& from,
::google::rpc::Status* to) {
if (to == nullptr) {
return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, "");
}
if (!to->ParseFromString(from.error_details())) {
return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, "");
}
return grpc::Status::OK;
}
grpc::Status SetErrorDetails(const ::google::rpc::Status& from,
grpc::Status* to) {
if (to == nullptr) {
return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, "");
}
grpc::StatusCode code = grpc::StatusCode::UNKNOWN;
if (from.code() >= grpc::StatusCode::OK &&
from.code() <= grpc::StatusCode::UNAUTHENTICATED) {
code = static_cast<grpc::StatusCode>(from.code());
}
*to = grpc::Status(code, from.message(), from.SerializeAsString());
return grpc::Status::OK;
}
} // namespace grpc

@ -573,6 +573,11 @@ static grpc_call_error grpcsharp_call_start_batch_nop(grpc_call* call,
const grpc_op* ops, const grpc_op* ops,
size_t nops, void* tag, size_t nops, void* tag,
void* reserved) { void* reserved) {
(void)call;
(void)ops;
(void)nops;
(void)tag;
(void)reserved;
return GRPC_CALL_OK; return GRPC_CALL_OK;
} }
@ -654,6 +659,9 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_test_call_start_unary_echo(
grpc_call* call, grpcsharp_batch_context* ctx, grpc_call* call, grpcsharp_batch_context* ctx,
grpc_slice_buffer* send_buffer, uint32_t write_flags, grpc_slice_buffer* send_buffer, uint32_t write_flags,
grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) { grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) {
(void)call;
(void)write_flags;
(void)initial_metadata_flags;
// prepare as if we were performing a normal RPC. // prepare as if we were performing a normal RPC.
grpc_byte_buffer* send_message = grpc_byte_buffer* send_message =
grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer);
@ -1136,6 +1144,10 @@ static int grpcsharp_get_metadata_handler(
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX], grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t* num_creds_md, grpc_status_code* status, size_t* num_creds_md, grpc_status_code* status,
const char** error_details) { const char** error_details) {
(void)creds_md;
(void)num_creds_md;
(void)status;
(void)error_details;
// the "context" object and its contents are only guaranteed to live until // the "context" object and its contents are only guaranteed to live until
// this handler returns (which could result in use-after-free for async // this handler returns (which could result in use-after-free for async
// handling of the callback), so the C# counterpart of this handler // handling of the callback), so the C# counterpart of this handler

@ -330,7 +330,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/gpr/log_posix.cc', 'src/core/lib/gpr/log_posix.cc',
'src/core/lib/gpr/log_windows.cc', 'src/core/lib/gpr/log_windows.cc',
'src/core/lib/gpr/murmur_hash.cc', 'src/core/lib/gpr/murmur_hash.cc',
'src/core/lib/gpr/strerror.cc',
'src/core/lib/gpr/string.cc', 'src/core/lib/gpr/string.cc',
'src/core/lib/gpr/string_posix.cc', 'src/core/lib/gpr/string_posix.cc',
'src/core/lib/gpr/string_util_windows.cc', 'src/core/lib/gpr/string_util_windows.cc',

@ -165,7 +165,7 @@
ss.header_mappings_dir = '.' ss.header_mappings_dir = '.'
ss.dependency "#{s.name}/Interface", version ss.dependency "#{s.name}/Interface", version
ss.dependency 'gRPC-Core', version ss.dependency 'gRPC-Core', version
abseil_version = '1.20200923.2' abseil_version = '1.20200923.3'
% for abseil_spec in grpcpp_abseil_specs: % for abseil_spec in grpcpp_abseil_specs:
ss.dependency '${abseil_spec}', abseil_version ss.dependency '${abseil_spec}', abseil_version
% endfor % endfor

@ -123,7 +123,7 @@
s.requires_arc = false s.requires_arc = false
name = 'grpc' name = 'grpc'
abseil_version = '1.20200923.2' abseil_version = '1.20200923.3'
# When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework. # When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework.
# This lets users write their includes like `#include <grpc/grpc.h>` as opposed to `#include # This lets users write their includes like `#include <grpc/grpc.h>` as opposed to `#include

@ -15,7 +15,7 @@
s.description = 'Send RPCs from Ruby using GRPC' s.description = 'Send RPCs from Ruby using GRPC'
s.license = 'Apache-2.0' s.license = 'Apache-2.0'
s.required_ruby_version = '>= 2.3.0' s.required_ruby_version = '>= 2.4.0'
s.files = %w( Makefile .yardopts ) s.files = %w( Makefile .yardopts )
s.files += %w( etc/roots.pem ) s.files += %w( etc/roots.pem )

@ -33,12 +33,12 @@ class FakeCertificateProviderFactory1 : public CertificateProviderFactory {
const char* name() const override { return "fake1"; } const char* name() const override { return "fake1"; }
RefCountedPtr<Config> CreateCertificateProviderConfig( RefCountedPtr<Config> CreateCertificateProviderConfig(
const Json& config_json, grpc_error** error) override { const Json& /*config_json*/, grpc_error** /*error*/) override {
return nullptr; return nullptr;
} }
RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider( RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider(
RefCountedPtr<Config> config) override { RefCountedPtr<Config> /*config*/) override {
return nullptr; return nullptr;
} }
}; };
@ -48,12 +48,12 @@ class FakeCertificateProviderFactory2 : public CertificateProviderFactory {
const char* name() const override { return "fake2"; } const char* name() const override { return "fake2"; }
RefCountedPtr<Config> CreateCertificateProviderConfig( RefCountedPtr<Config> CreateCertificateProviderConfig(
const Json& config_json, grpc_error** error) override { const Json& /*config_json*/, grpc_error** /*error*/) override {
return nullptr; return nullptr;
} }
RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider( RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider(
RefCountedPtr<Config> config) override { RefCountedPtr<Config> /*config*/) override {
return nullptr; return nullptr;
} }
}; };

@ -305,8 +305,8 @@ void cq_verify_empty(cq_verifier* v) { cq_verify_empty_timeout(v, 1); }
void cq_maybe_expect_completion(cq_verifier* v, const char* file, int line, void cq_maybe_expect_completion(cq_verifier* v, const char* file, int line,
void* tag, bool success, bool* seen) { void* tag, bool success, bool* seen) {
v->maybe_expectations.emplace_back(file, line, GRPC_OP_COMPLETE, tag, true, v->maybe_expectations.emplace_back(file, line, GRPC_OP_COMPLETE, tag,
true, seen); true /* check_success */, success, seen);
} }
static void add(cq_verifier* v, const char* file, int line, static void add(cq_verifier* v, const char* file, int line,

@ -41,7 +41,6 @@
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/socket_utils_posix.h" #include "src/core/lib/iomgr/socket_utils_posix.h"
@ -161,8 +160,7 @@ static void session_read_cb(void* arg, /*session */
before notify_on_read is called. */ before notify_on_read is called. */
grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure); grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure);
} else { } else {
gpr_log(GPR_ERROR, "Unhandled read error %s", gpr_log(GPR_ERROR, "Unhandled read error %s", strerror(errno));
grpc_core::StrError(errno).c_str());
abort(); abort();
} }
} }
@ -328,7 +326,7 @@ static void client_session_write(void* arg, /*client */
} }
gpr_mu_unlock(g_mu); gpr_mu_unlock(g_mu);
} else { } else {
gpr_log(GPR_ERROR, "unknown errno %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "unknown errno %s", strerror(errno));
abort(); abort();
} }
} }

@ -40,7 +40,6 @@
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/resolve_address.h"
@ -458,7 +457,7 @@ int main(int argc, char** argv) {
test_no_op_with_port_and_start(); test_no_op_with_port_and_start();
if (getifaddrs(&ifa) != 0 || ifa == nullptr) { if (getifaddrs(&ifa) != 0 || ifa == nullptr) {
gpr_log(GPR_ERROR, "getifaddrs: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "getifaddrs: %s", strerror(errno));
return EXIT_FAILURE; return EXIT_FAILURE;
} }
dst_addrs->naddrs = 0; dst_addrs->naddrs = 0;

@ -38,7 +38,6 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gpr/useful.h" #include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/thd.h" #include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/error.h"
@ -81,8 +80,7 @@ static int read_bytes(int fd, char* buf, size_t read_size, int spin) {
if (errno == EAGAIN && spin == 1) { if (errno == EAGAIN && spin == 1) {
continue; continue;
} }
gpr_log(GPR_ERROR, "Read failed: %s", gpr_log(GPR_ERROR, "Read failed: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
return -1; return -1;
} }
} else { } else {
@ -115,8 +113,7 @@ static int poll_read_bytes(int fd, char* buf, size_t read_size, int spin) {
if (errno == EINTR) { if (errno == EINTR) {
continue; continue;
} else { } else {
gpr_log(GPR_ERROR, "Poll failed: %s", gpr_log(GPR_ERROR, "Poll failed: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
return -1; return -1;
} }
} }
@ -127,7 +124,7 @@ static int poll_read_bytes(int fd, char* buf, size_t read_size, int spin) {
err2 = read(fd, buf + bytes_read, read_size - bytes_read); err2 = read(fd, buf + bytes_read, read_size - bytes_read);
} while (err2 < 0 && errno == EINTR); } while (err2 < 0 && errno == EINTR);
if (err2 < 0 && errno != EAGAIN) { if (err2 < 0 && errno != EAGAIN) {
gpr_log(GPR_ERROR, "Read failed: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "Read failed: %s", strerror(errno));
return -1; return -1;
} }
bytes_read += static_cast<size_t>(err2); bytes_read += static_cast<size_t>(err2);
@ -156,8 +153,7 @@ static int epoll_read_bytes(struct thread_args* args, char* buf, int spin) {
err = epoll_wait(args->epoll_fd, &ev, 1, spin ? 0 : -1); err = epoll_wait(args->epoll_fd, &ev, 1, spin ? 0 : -1);
if (err < 0) { if (err < 0) {
if (errno == EINTR) continue; if (errno == EINTR) continue;
gpr_log(GPR_ERROR, "epoll_wait failed: %s", gpr_log(GPR_ERROR, "epoll_wait failed: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
return -1; return -1;
} }
if (err == 0 && spin) continue; if (err == 0 && spin) continue;
@ -203,8 +199,7 @@ static int blocking_write_bytes(struct thread_args* args, char* buf) {
if (errno == EINTR) { if (errno == EINTR) {
continue; continue;
} else { } else {
gpr_log(GPR_ERROR, "Read failed: %s", gpr_log(GPR_ERROR, "Read failed: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
return -1; return -1;
} }
} else { } else {
@ -232,7 +227,7 @@ static int set_socket_nonblocking(thread_args* args) {
return 0; return 0;
} }
static int do_nothing(thread_args* args) { return 0; } static int do_nothing(thread_args* /*args*/) { return 0; }
#ifdef __linux__ #ifdef __linux__
/* Special case for epoll, where we need to create the fd ahead of time. */ /* Special case for epoll, where we need to create the fd ahead of time. */
@ -242,7 +237,7 @@ static int epoll_setup(thread_args* args) {
set_socket_nonblocking(args); set_socket_nonblocking(args);
epoll_fd = epoll_create(1); epoll_fd = epoll_create(1);
if (epoll_fd < 0) { if (epoll_fd < 0) {
gpr_log(GPR_ERROR, "epoll_create: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "epoll_create: %s", strerror(errno));
return -1; return -1;
} }
@ -251,7 +246,7 @@ static int epoll_setup(thread_args* args) {
ev.events = EPOLLIN | EPOLLET; ev.events = EPOLLIN | EPOLLET;
ev.data.fd = args->fds.read_fd; ev.data.fd = args->fds.read_fd;
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, args->fds.read_fd, &ev) < 0) { if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, args->fds.read_fd, &ev) < 0) {
gpr_log(GPR_ERROR, "epoll_ctl: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "epoll_ctl: %s", strerror(errno));
} }
return 0; return 0;
} }
@ -335,8 +330,7 @@ error:
static int create_listening_socket(struct sockaddr* port, socklen_t len) { static int create_listening_socket(struct sockaddr* port, socklen_t len) {
int fd = socket(port->sa_family, SOCK_STREAM, 0); int fd = socket(port->sa_family, SOCK_STREAM, 0);
if (fd < 0) { if (fd < 0) {
gpr_log(GPR_ERROR, "Unable to create socket: %s", gpr_log(GPR_ERROR, "Unable to create socket: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
goto error; goto error;
} }
@ -354,17 +348,17 @@ static int create_listening_socket(struct sockaddr* port, socklen_t len) {
} }
if (bind(fd, port, len) < 0) { if (bind(fd, port, len) < 0) {
gpr_log(GPR_ERROR, "bind: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "bind: %s", strerror(errno));
goto error; goto error;
} }
if (listen(fd, 1) < 0) { if (listen(fd, 1) < 0) {
gpr_log(GPR_ERROR, "listen: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "listen: %s", strerror(errno));
goto error; goto error;
} }
if (getsockname(fd, port, &len) < 0) { if (getsockname(fd, port, &len) < 0) {
gpr_log(GPR_ERROR, "getsockname: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "getsockname: %s", strerror(errno));
goto error; goto error;
} }
@ -381,8 +375,7 @@ static int connect_client(struct sockaddr* addr, socklen_t len) {
int fd = socket(addr->sa_family, SOCK_STREAM, 0); int fd = socket(addr->sa_family, SOCK_STREAM, 0);
int err; int err;
if (fd < 0) { if (fd < 0) {
gpr_log(GPR_ERROR, "Unable to create socket: %s", gpr_log(GPR_ERROR, "Unable to create socket: %s", strerror(errno));
grpc_core::StrError(errno).c_str());
goto error; goto error;
} }
@ -400,7 +393,7 @@ static int connect_client(struct sockaddr* addr, socklen_t len) {
} while (err < 0 && errno == EINTR); } while (err < 0 && errno == EINTR);
if (err < 0) { if (err < 0) {
gpr_log(GPR_ERROR, "connect error: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "connect error: %s", strerror(errno));
goto error; goto error;
} }
return fd; return fd;
@ -415,7 +408,7 @@ error:
static int accept_server(int listen_fd) { static int accept_server(int listen_fd) {
int fd = accept(listen_fd, nullptr, nullptr); int fd = accept(listen_fd, nullptr, nullptr);
if (fd < 0) { if (fd < 0) {
gpr_log(GPR_ERROR, "Accept failed: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "Accept failed: %s", strerror(errno));
return -1; return -1;
} }
return fd; return fd;
@ -474,7 +467,7 @@ error:
static int create_sockets_socketpair(fd_pair* client_fds, fd_pair* server_fds) { static int create_sockets_socketpair(fd_pair* client_fds, fd_pair* server_fds) {
int fds[2]; int fds[2];
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
gpr_log(GPR_ERROR, "socketpair: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "socketpair: %s", strerror(errno));
return -1; return -1;
} }
@ -489,12 +482,12 @@ static int create_sockets_pipe(fd_pair* client_fds, fd_pair* server_fds) {
int cfds[2]; int cfds[2];
int sfds[2]; int sfds[2];
if (pipe(cfds) < 0) { if (pipe(cfds) < 0) {
gpr_log(GPR_ERROR, "pipe: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "pipe: %s", strerror(errno));
return -1; return -1;
} }
if (pipe(sfds) < 0) { if (pipe(sfds) < 0) {
gpr_log(GPR_ERROR, "pipe: %s", grpc_core::StrError(errno).c_str()); gpr_log(GPR_ERROR, "pipe: %s", strerror(errno));
return -1; return -1;
} }

@ -1670,17 +1670,17 @@ struct fake_call_creds : public grpc_call_credentials {
~fake_call_creds() override { GRPC_MDELEM_UNREF(dummy_md_); } ~fake_call_creds() override { GRPC_MDELEM_UNREF(dummy_md_); }
bool get_request_metadata(grpc_polling_entity* pollent, bool get_request_metadata(grpc_polling_entity* /*pollent*/,
grpc_auth_metadata_context context, grpc_auth_metadata_context /*context*/,
grpc_credentials_mdelem_array* md_array, grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata, grpc_closure* /*on_request_metadata*/,
grpc_error** error) override { grpc_error** /*error*/) override {
grpc_credentials_mdelem_array_add(md_array, dummy_md_); grpc_credentials_mdelem_array_add(md_array, dummy_md_);
return true; return true;
} }
void cancel_get_request_metadata(grpc_credentials_mdelem_array* md_array, void cancel_get_request_metadata(grpc_credentials_mdelem_array* /*md_array*/,
grpc_error* error) override {} grpc_error* /*error*/) override {}
private: private:
grpc_mdelem dummy_md_; grpc_mdelem dummy_md_;
@ -1983,7 +1983,7 @@ static void test_auth_metadata_context(void) {
static void validate_external_account_creds_token_exchage_request( static void validate_external_account_creds_token_exchage_request(
const grpc_httpcli_request* request, const char* body, size_t body_size, const grpc_httpcli_request* request, const char* body, size_t body_size,
bool expect_actor_token) { bool /*expect_actor_token*/) {
// Check that the body is constructed properly. // Check that the body is constructed properly.
GPR_ASSERT(body != nullptr); GPR_ASSERT(body != nullptr);
GPR_ASSERT(body_size != 0); GPR_ASSERT(body_size != 0);
@ -2021,7 +2021,7 @@ static void validate_external_account_creds_token_exchage_request(
static void static void
validate_external_account_creds_token_exchage_request_with_url_encode( validate_external_account_creds_token_exchage_request_with_url_encode(
const grpc_httpcli_request* request, const char* body, size_t body_size, const grpc_httpcli_request* request, const char* body, size_t body_size,
bool expect_actor_token) { bool /*expect_actor_token*/) {
// Check that the body is constructed properly. // Check that the body is constructed properly.
GPR_ASSERT(body != nullptr); GPR_ASSERT(body != nullptr);
GPR_ASSERT(body_size != 0); GPR_ASSERT(body_size != 0);
@ -2051,7 +2051,7 @@ validate_external_account_creds_token_exchage_request_with_url_encode(
static void static void
validate_external_account_creds_service_account_impersonation_request( validate_external_account_creds_service_account_impersonation_request(
const grpc_httpcli_request* request, const char* body, size_t body_size, const grpc_httpcli_request* request, const char* body, size_t body_size,
bool expect_actor_token) { bool /*expect_actor_token*/) {
// Check that the body is constructed properly. // Check that the body is constructed properly.
GPR_ASSERT(body != nullptr); GPR_ASSERT(body != nullptr);
GPR_ASSERT(body_size != 0); GPR_ASSERT(body_size != 0);
@ -2097,8 +2097,8 @@ static int external_account_creds_httpcli_post_success(
static int static int
external_account_creds_httpcli_post_failure_token_exchange_response_missing_access_token( external_account_creds_httpcli_post_failure_token_exchange_response_missing_access_token(
const grpc_httpcli_request* request, const char* body, size_t body_size, const grpc_httpcli_request* request, const char* /*body*/,
grpc_millis /*deadline*/, grpc_closure* on_done, size_t /*body_size*/, grpc_millis /*deadline*/, grpc_closure* on_done,
grpc_httpcli_response* response) { grpc_httpcli_response* response) {
if (strcmp(request->http.path, "/token") == 0) { if (strcmp(request->http.path, "/token") == 0) {
*response = http_response(200, *response = http_response(200,
@ -2139,7 +2139,7 @@ static int url_external_account_creds_httpcli_get_success(
static void validate_aws_external_account_creds_token_exchage_request( static void validate_aws_external_account_creds_token_exchage_request(
const grpc_httpcli_request* request, const char* body, size_t body_size, const grpc_httpcli_request* request, const char* body, size_t body_size,
bool expect_actor_token) { bool /*expect_actor_token*/) {
// Check that the body is constructed properly. // Check that the body is constructed properly.
GPR_ASSERT(body != nullptr); GPR_ASSERT(body != nullptr);
GPR_ASSERT(body_size != 0); GPR_ASSERT(body_size != 0);
@ -2212,7 +2212,7 @@ class TestExternalAccountCredentials final
protected: protected:
void RetrieveSubjectToken( void RetrieveSubjectToken(
HTTPRequestContext* ctx, const Options& options, HTTPRequestContext* /*ctx*/, const Options& /*options*/,
std::function<void(std::string, grpc_error*)> cb) override { std::function<void(std::string, grpc_error*)> cb) override {
cb("test_subject_token", GRPC_ERROR_NONE); cb("test_subject_token", GRPC_ERROR_NONE);
} }

@ -562,8 +562,8 @@ TEST_F(GrpcTlsCertificateDistributorTest, ResetCallbackToNull) {
TEST_F(GrpcTlsCertificateDistributorTest, SetKeyMaterialsInCallback) { TEST_F(GrpcTlsCertificateDistributorTest, SetKeyMaterialsInCallback) {
distributor_.SetWatchStatusCallback([this](std::string cert_name, distributor_.SetWatchStatusCallback([this](std::string cert_name,
bool root_being_watched, bool /*root_being_watched*/,
bool identity_being_watched) { bool /*identity_being_watched*/) {
distributor_.SetKeyMaterials( distributor_.SetKeyMaterials(
cert_name, kRootCert1Contents, cert_name, kRootCert1Contents,
MakeCertKeyPairs(kIdentityCert1PrivateKey, kIdentityCert1Contents)); MakeCertKeyPairs(kIdentityCert1PrivateKey, kIdentityCert1Contents));
@ -913,8 +913,8 @@ TEST_F(GrpcTlsCertificateDistributorTest, WatchErroredCertInfoBySetError) {
TEST_F(GrpcTlsCertificateDistributorTest, SetErrorForCertInCallback) { TEST_F(GrpcTlsCertificateDistributorTest, SetErrorForCertInCallback) {
distributor_.SetWatchStatusCallback([this](std::string cert_name, distributor_.SetWatchStatusCallback([this](std::string cert_name,
bool root_being_watched, bool /*root_being_watched*/,
bool identity_being_watched) { bool /*identity_being_watched*/) {
this->distributor_.SetErrorForCert( this->distributor_.SetErrorForCert(
cert_name, GRPC_ERROR_CREATE_FROM_STATIC_STRING(kRootErrorMessage), cert_name, GRPC_ERROR_CREATE_FROM_STATIC_STRING(kRootErrorMessage),
GRPC_ERROR_CREATE_FROM_STATIC_STRING(kIdentityErrorMessage)); GRPC_ERROR_CREATE_FROM_STATIC_STRING(kIdentityErrorMessage));

@ -59,7 +59,7 @@ class FakeHandshakerService : public HandshakerService::Service {
: expected_max_concurrent_rpcs_(expected_max_concurrent_rpcs) {} : expected_max_concurrent_rpcs_(expected_max_concurrent_rpcs) {}
Status DoHandshake( Status DoHandshake(
ServerContext* server_context, ServerContext* /*server_context*/,
ServerReaderWriter<HandshakerResp, HandshakerReq>* stream) override { ServerReaderWriter<HandshakerResp, HandshakerReq>* stream) override {
ConcurrentRpcsCheck concurrent_rpcs_check(this); ConcurrentRpcsCheck concurrent_rpcs_check(this);
Status status; Status status;

@ -45,7 +45,6 @@
#include <grpcpp/impl/codegen/service_type.h> #include <grpcpp/impl/codegen/service_type.h>
#include <grpcpp/server_builder.h> #include <grpcpp/server_builder.h>
#include "src/core/lib/gpr/strerror.h"
#include "src/core/lib/gpr/useful.h" #include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/gprpp/thd.h" #include "src/core/lib/gprpp/thd.h"
@ -460,8 +459,7 @@ class FakeTcpServer {
gpr_log(GPR_ERROR, gpr_log(GPR_ERROR,
"Fake TCP server encountered unexpected error:%d |%s| " "Fake TCP server encountered unexpected error:%d |%s| "
"sending %d bytes on fd:%d", "sending %d bytes on fd:%d",
errno, grpc_core::StrError(errno).c_str(), bytes_to_send, errno, strerror(errno), bytes_to_send, fd_);
fd_);
GPR_ASSERT(0); GPR_ASSERT(0);
} else if (bytes_sent > 0) { } else if (bytes_sent > 0) {
total_bytes_sent_ += bytes_sent; total_bytes_sent_ += bytes_sent;

@ -440,10 +440,10 @@ static void schedule_request_success_test() {
destroy_config(config); destroy_config(config);
} }
static void tsi_cb_assert_tsi_internal_error(tsi_result status, void* user_data, static void tsi_cb_assert_tsi_internal_error(
const unsigned char* bytes_to_send, tsi_result status, void* /*user_data*/,
size_t bytes_to_send_size, const unsigned char* /*bytes_to_send*/, size_t /*bytes_to_send_size*/,
tsi_handshaker_result* result) { tsi_handshaker_result* /*result*/) {
GPR_ASSERT(status == TSI_INTERNAL_ERROR); GPR_ASSERT(status == TSI_INTERNAL_ERROR);
} }

@ -72,8 +72,8 @@ class SessionTracker {
return tsi::SslSessionPtr(cb(ssl_context_)); return tsi::SslSessionPtr(cb(ssl_context_));
} }
static void DestroyExData(void* parent, void* ptr, CRYPTO_EX_DATA* ad, static void DestroyExData(void* /*parent*/, void* ptr, CRYPTO_EX_DATA* /*ad*/,
int index, long argl, void* argp) { int /*index*/, long /*argl*/, void* /*argp*/) {
SessionExDataId* data = static_cast<SessionExDataId*>(ptr); SessionExDataId* data = static_cast<SessionExDataId*>(ptr);
data->tracker->alive_sessions_.erase(data->id); data->tracker->alive_sessions_.erase(data->id);
delete data; delete data;

@ -36,15 +36,16 @@ class EvalArgsMockEndpoint {
base_.vtable = &vtable_; base_.vtable = &vtable_;
} }
grpc_endpoint* base() const { return const_cast<grpc_endpoint*>(&base_); } grpc_endpoint* base() const { return const_cast<grpc_endpoint*>(&base_); }
static void Read(grpc_endpoint* ep, grpc_slice_buffer* slices, static void Read(grpc_endpoint* /*ep*/, grpc_slice_buffer* /*slices*/,
grpc_closure* cb, bool unused) {} grpc_closure* /*cb*/, bool /*unused*/) {}
static void Write(grpc_endpoint* ep, grpc_slice_buffer* slices, static void Write(grpc_endpoint* /*ep*/, grpc_slice_buffer* /*slices*/,
grpc_closure* cb, void* unused) {} grpc_closure* /*cb*/, void* /*unused*/) {}
static void AddToPollset(grpc_endpoint* ep, grpc_pollset* unused) {} static void AddToPollset(grpc_endpoint* /*ep*/, grpc_pollset* /*unused*/) {}
static void AddToPollsetSet(grpc_endpoint* ep, grpc_pollset_set* unused) {} static void AddToPollsetSet(grpc_endpoint* /*ep*/,
static void DeleteFromPollsetSet(grpc_endpoint* ep, grpc_pollset_set* /*unused*/) {}
grpc_pollset_set* unused) {} static void DeleteFromPollsetSet(grpc_endpoint* /*ep*/,
static void Shutdown(grpc_endpoint* ep, grpc_error* why) {} grpc_pollset_set* /*unused*/) {}
static void Shutdown(grpc_endpoint* /*ep*/, grpc_error* /*why*/) {}
static void Destroy(grpc_endpoint* ep) { static void Destroy(grpc_endpoint* ep) {
EvalArgsMockEndpoint* m = reinterpret_cast<EvalArgsMockEndpoint*>(ep); EvalArgsMockEndpoint* m = reinterpret_cast<EvalArgsMockEndpoint*>(ep);
delete m; delete m;
@ -60,12 +61,12 @@ class EvalArgsMockEndpoint {
return m->local_address_; return m->local_address_;
} }
static grpc_resource_user* GetResourceUser(grpc_endpoint* ep) { static grpc_resource_user* GetResourceUser(grpc_endpoint* /*ep*/) {
return nullptr; return nullptr;
} }
static int GetFd(grpc_endpoint* unused) { return -1; } static int GetFd(grpc_endpoint* /*unused*/) { return -1; }
static bool CanTrackErr(grpc_endpoint* unused) { return false; } static bool CanTrackErr(grpc_endpoint* /*unused*/) { return false; }
private: private:
static constexpr grpc_endpoint_vtable vtable_ = { static constexpr grpc_endpoint_vtable vtable_ = {

@ -34,7 +34,6 @@
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/lib/gpr/strerror.h"
#include "test/core/util/subprocess.h" #include "test/core/util/subprocess.h"
struct gpr_subprocess { struct gpr_subprocess {
@ -59,8 +58,7 @@ gpr_subprocess* gpr_subprocess_create(int argc, const char** argv) {
exec_args[argc] = nullptr; exec_args[argc] = nullptr;
execv(exec_args[0], exec_args); execv(exec_args[0], exec_args);
/* if we reach here, an error has occurred */ /* if we reach here, an error has occurred */
gpr_log(GPR_ERROR, "execv '%s' failed: %s", exec_args[0], gpr_log(GPR_ERROR, "execv '%s' failed: %s", exec_args[0], strerror(errno));
grpc_core::StrError(errno).c_str());
_exit(1); _exit(1);
return nullptr; return nullptr;
} else { } else {
@ -86,7 +84,7 @@ retry:
goto retry; goto retry;
} }
gpr_log(GPR_ERROR, "waitpid failed for pid %d: %s", p->pid, gpr_log(GPR_ERROR, "waitpid failed for pid %d: %s", p->pid,
grpc_core::StrError(errno).c_str()); strerror(errno));
return -1; return -1;
} }
p->joined = true; p->joined = true;

@ -153,7 +153,7 @@ gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms) {
GPR_TIMESPAN)); GPR_TIMESPAN));
} }
void grpc_test_init(int argc, char** argv) { void grpc_test_init(int /*argc*/, char** argv) {
grpc_core::testing::InitializeStackTracer(argv[0]); grpc_core::testing::InitializeStackTracer(argv[0]);
absl::FailureSignalHandlerOptions options; absl::FailureSignalHandlerOptions options;
absl::InstallFailureSignalHandler(options); absl::InstallFailureSignalHandler(options);

@ -57,13 +57,13 @@ class FakeCertificateProviderFactory1 : public CertificateProviderFactory {
const char* name() const override { return "fake1"; } const char* name() const override { return "fake1"; }
RefCountedPtr<CertificateProviderFactory::Config> RefCountedPtr<CertificateProviderFactory::Config>
CreateCertificateProviderConfig(const Json& config_json, CreateCertificateProviderConfig(const Json& /*config_json*/,
grpc_error** error) override { grpc_error** /*error*/) override {
return MakeRefCounted<Config>(); return MakeRefCounted<Config>();
} }
RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider( RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider(
RefCountedPtr<CertificateProviderFactory::Config> config) override { RefCountedPtr<CertificateProviderFactory::Config> /*config*/) override {
return MakeRefCounted<FakeCertificateProvider>(); return MakeRefCounted<FakeCertificateProvider>();
} }
}; };
@ -80,13 +80,13 @@ class FakeCertificateProviderFactory2 : public CertificateProviderFactory {
const char* name() const override { return "fake2"; } const char* name() const override { return "fake2"; }
RefCountedPtr<CertificateProviderFactory::Config> RefCountedPtr<CertificateProviderFactory::Config>
CreateCertificateProviderConfig(const Json& config_json, CreateCertificateProviderConfig(const Json& /*config_json*/,
grpc_error** error) override { grpc_error** /*error*/) override {
return MakeRefCounted<Config>(); return MakeRefCounted<Config>();
} }
RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider( RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider(
RefCountedPtr<CertificateProviderFactory::Config> config) override { RefCountedPtr<CertificateProviderFactory::Config> /*config*/) override {
return MakeRefCounted<FakeCertificateProvider>(); return MakeRefCounted<FakeCertificateProvider>();
} }
}; };

@ -507,7 +507,7 @@ class FakeCertificateProviderFactory : public CertificateProviderFactory {
} }
RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider( RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider(
RefCountedPtr<CertificateProviderFactory::Config> config) override { RefCountedPtr<CertificateProviderFactory::Config> /*config*/) override {
return nullptr; return nullptr;
} }
}; };

@ -223,11 +223,12 @@ class NullContextAllocatorTest : public ContextAllocatorEnd2endTestBase {
} }
void Release( void Release(
grpc::CallbackServerContext* callback_server_context) override { grpc::CallbackServerContext* /*callback_server_context*/) override {
deallocation_count_->fetch_add(1, std::memory_order_relaxed); deallocation_count_->fetch_add(1, std::memory_order_relaxed);
} }
void Release(GenericCallbackServerContext* generic_callback_server_context) void Release(
GenericCallbackServerContext* /*generic_callback_server_context*/)
override { override {
deallocation_count_->fetch_add(1, std::memory_order_relaxed); deallocation_count_->fetch_add(1, std::memory_order_relaxed);
} }

@ -212,6 +212,8 @@ int main(int argc, char** argv) {
gpr_tls_destroy(&g_is_nonblocking_poll); gpr_tls_destroy(&g_is_nonblocking_poll);
return ret; return ret;
#else // GRPC_POSIX_SOCKET #else // GRPC_POSIX_SOCKET
(void)argc;
(void)argv;
return 0; return 0;
#endif // GRPC_POSIX_SOCKET #endif // GRPC_POSIX_SOCKET
} }

@ -895,8 +895,7 @@ class AdsServiceImpl : public std::enable_shared_from_this<AdsServiceImpl> {
&subscription_state, &resource_state, &subscription_state, &resource_state,
update_queue) || update_queue) ||
ClientNeedsResourceUpdate(resource_type_state, resource_state, ClientNeedsResourceUpdate(resource_type_state, resource_state,
client_resource_type_version, client_resource_type_version)) {
&subscription_state)) {
gpr_log(GPR_INFO, "ADS[%p]: Sending update for type=%s name=%s", this, gpr_log(GPR_INFO, "ADS[%p]: Sending update for type=%s name=%s", this,
request.type_url().c_str(), resource_name.c_str()); request.type_url().c_str(), resource_name.c_str());
resources_added_to_response.emplace(resource_name); resources_added_to_response.emplace(resource_name);
@ -942,11 +941,9 @@ class AdsServiceImpl : public std::enable_shared_from_this<AdsServiceImpl> {
auto& resource_name_map = resource_type_state.resource_name_map; auto& resource_name_map = resource_type_state.resource_name_map;
auto it = subscription_name_map.find(resource_name); auto it = subscription_name_map.find(resource_name);
if (it != subscription_name_map.end()) { if (it != subscription_name_map.end()) {
SubscriptionState& subscription_state = it->second;
ResourceState& resource_state = resource_name_map[resource_name]; ResourceState& resource_state = resource_name_map[resource_name];
if (ClientNeedsResourceUpdate(resource_type_state, resource_state, if (ClientNeedsResourceUpdate(resource_type_state, resource_state,
sent_state->resource_type_version, sent_state->resource_type_version)) {
&subscription_state)) {
gpr_log(GPR_INFO, "ADS[%p]: Sending update for type=%s name=%s", this, gpr_log(GPR_INFO, "ADS[%p]: Sending update for type=%s name=%s", this,
resource_type.c_str(), resource_name.c_str()); resource_type.c_str(), resource_name.c_str());
response->emplace(); response->emplace();
@ -1050,7 +1047,7 @@ class AdsServiceImpl : public std::enable_shared_from_this<AdsServiceImpl> {
} }
static void CheckBuildVersion( static void CheckBuildVersion(
const ::envoy::service::discovery::v3::DiscoveryRequest& request) {} const ::envoy::service::discovery::v3::DiscoveryRequest& /*request*/) {}
AdsServiceImpl* parent_; AdsServiceImpl* parent_;
const bool is_v2_; const bool is_v2_;
@ -1060,8 +1057,7 @@ class AdsServiceImpl : public std::enable_shared_from_this<AdsServiceImpl> {
// the resource. // the resource.
static bool ClientNeedsResourceUpdate( static bool ClientNeedsResourceUpdate(
const ResourceTypeState& resource_type_state, const ResourceTypeState& resource_type_state,
const ResourceState& resource_state, int client_resource_type_version, const ResourceState& resource_state, int client_resource_type_version) {
SubscriptionState* subscription_state) {
return client_resource_type_version < return client_resource_type_version <
resource_type_state.resource_type_version && resource_type_state.resource_type_version &&
resource_state.resource_type_version <= resource_state.resource_type_version <=
@ -1449,15 +1445,15 @@ class FakeCertificateProviderFactory
const char* name() const override { return name_; } const char* name() const override { return name_; }
grpc_core::RefCountedPtr<grpc_core::CertificateProviderFactory::Config> grpc_core::RefCountedPtr<grpc_core::CertificateProviderFactory::Config>
CreateCertificateProviderConfig(const grpc_core::Json& config_json, CreateCertificateProviderConfig(const grpc_core::Json& /*config_json*/,
grpc_error** error) override { grpc_error** /*error*/) override {
return grpc_core::MakeRefCounted<Config>(name_); return grpc_core::MakeRefCounted<Config>(name_);
} }
grpc_core::RefCountedPtr<grpc_tls_certificate_provider> grpc_core::RefCountedPtr<grpc_tls_certificate_provider>
CreateCertificateProvider( CreateCertificateProvider(
grpc_core::RefCountedPtr<grpc_core::CertificateProviderFactory::Config> grpc_core::RefCountedPtr<grpc_core::CertificateProviderFactory::Config>
config) override { /*config*/) override {
if (*cert_data_map_ == nullptr) return nullptr; if (*cert_data_map_ == nullptr) return nullptr;
return grpc_core::MakeRefCounted<FakeCertificateProvider>(**cert_data_map_); return grpc_core::MakeRefCounted<FakeCertificateProvider>(**cert_data_map_);
} }
@ -1506,17 +1502,25 @@ class XdsEnd2endTest : public ::testing::TestWithParam<TestType> {
protected: protected:
XdsEnd2endTest(size_t num_backends, size_t num_balancers, XdsEnd2endTest(size_t num_backends, size_t num_balancers,
int client_load_reporting_interval_seconds = 100, int client_load_reporting_interval_seconds = 100,
bool use_xds_enabled_server = false) bool use_xds_enabled_server = false,
bool bootstrap_contents_from_env_var = false)
: num_backends_(num_backends), : num_backends_(num_backends),
num_balancers_(num_balancers), num_balancers_(num_balancers),
client_load_reporting_interval_seconds_( client_load_reporting_interval_seconds_(
client_load_reporting_interval_seconds), client_load_reporting_interval_seconds),
use_xds_enabled_server_(use_xds_enabled_server) {} use_xds_enabled_server_(use_xds_enabled_server),
bootstrap_contents_from_env_var_(bootstrap_contents_from_env_var) {}
void SetUp() override { void SetUp() override {
gpr_setenv("GRPC_XDS_EXPERIMENTAL_V3_SUPPORT", "true"); gpr_setenv("GRPC_XDS_EXPERIMENTAL_V3_SUPPORT", "true");
gpr_setenv("GRPC_XDS_BOOTSTRAP", if (bootstrap_contents_from_env_var_) {
GetParam().use_v2() ? g_bootstrap_file_v2 : g_bootstrap_file_v3); gpr_setenv("GRPC_XDS_BOOTSTRAP_CONFIG",
GetParam().use_v2() ? kBootstrapFileV2 : kBootstrapFileV3);
} else {
gpr_setenv("GRPC_XDS_BOOTSTRAP", GetParam().use_v2()
? g_bootstrap_file_v2
: g_bootstrap_file_v3);
}
g_port_saver->Reset(); g_port_saver->Reset();
bool localhost_resolves_to_ipv4 = false; bool localhost_resolves_to_ipv4 = false;
bool localhost_resolves_to_ipv6 = false; bool localhost_resolves_to_ipv6 = false;
@ -1597,6 +1601,8 @@ class XdsEnd2endTest : public ::testing::TestWithParam<TestType> {
// Clear global xDS channel args, since they will go out of scope // Clear global xDS channel args, since they will go out of scope
// when this test object is destroyed. // when this test object is destroyed.
grpc_core::internal::SetXdsChannelArgsForTest(nullptr); grpc_core::internal::SetXdsChannelArgsForTest(nullptr);
gpr_unsetenv("GRPC_XDS_BOOTSTRAP");
gpr_unsetenv("GRPC_XDS_BOOTSTRAP_CONFIG");
} }
void StartAllBackends() { void StartAllBackends() {
@ -2272,6 +2278,7 @@ class XdsEnd2endTest : public ::testing::TestWithParam<TestType> {
RouteConfiguration default_route_config_; RouteConfiguration default_route_config_;
Cluster default_cluster_; Cluster default_cluster_;
bool use_xds_enabled_server_; bool use_xds_enabled_server_;
bool bootstrap_contents_from_env_var_;
}; };
class BasicTest : public XdsEnd2endTest { class BasicTest : public XdsEnd2endTest {
@ -4905,20 +4912,27 @@ TEST_P(LdsRdsTest, XdsRoutingHeadersMatching) {
header_matcher4->set_present_match(false); header_matcher4->set_present_match(false);
auto* header_matcher5 = route1->mutable_match()->add_headers(); auto* header_matcher5 = route1->mutable_match()->add_headers();
header_matcher5->set_name("header5"); header_matcher5->set_name("header5");
header_matcher5->set_prefix_match("/grpc"); header_matcher5->set_present_match(true);
auto* header_matcher6 = route1->mutable_match()->add_headers(); auto* header_matcher6 = route1->mutable_match()->add_headers();
header_matcher6->set_name("header6"); header_matcher6->set_name("header6");
header_matcher6->set_suffix_match(".cc"); header_matcher6->set_prefix_match("/grpc");
header_matcher6->set_invert_match(true); auto* header_matcher7 = route1->mutable_match()->add_headers();
header_matcher7->set_name("header7");
header_matcher7->set_suffix_match(".cc");
header_matcher7->set_invert_match(true);
route1->mutable_route()->set_cluster(kNewClusterName); route1->mutable_route()->set_cluster(kNewClusterName);
auto* default_route = route_config.mutable_virtual_hosts(0)->add_routes(); auto* default_route = route_config.mutable_virtual_hosts(0)->add_routes();
default_route->mutable_match()->set_prefix(""); default_route->mutable_match()->set_prefix("");
default_route->mutable_route()->set_cluster(kDefaultClusterName); default_route->mutable_route()->set_cluster(kDefaultClusterName);
SetRouteConfiguration(0, route_config); SetRouteConfiguration(0, route_config);
std::vector<std::pair<std::string, std::string>> metadata = { std::vector<std::pair<std::string, std::string>> metadata = {
{"header1", "POST"}, {"header2", "blah"}, {"header1", "POST"},
{"header3", "1"}, {"header5", "/grpc.testing.EchoTest1Service/"}, {"header2", "blah"},
{"header1", "PUT"}, {"header6", "grpc.java"}, {"header3", "1"},
{"header5", "anything"},
{"header6", "/grpc.testing.EchoTest1Service/"},
{"header1", "PUT"},
{"header7", "grpc.java"},
{"header1", "GET"}, {"header1", "GET"},
}; };
const auto header_match_rpc_options = RpcOptions() const auto header_match_rpc_options = RpcOptions()
@ -7833,6 +7847,22 @@ TEST_P(ClientLoadReportingWithDropTest, Vanilla) {
kDropRateForThrottle * (1 + kErrorTolerance)))); kDropRateForThrottle * (1 + kErrorTolerance))));
} }
class BootstrapContentsFromEnvVarTest : public XdsEnd2endTest {
public:
BootstrapContentsFromEnvVarTest() : XdsEnd2endTest(4, 1, 100, false, true) {}
};
TEST_P(BootstrapContentsFromEnvVarTest, Vanilla) {
SetNextResolution({});
SetNextResolutionForLbChannelAllBalancers();
AdsServiceImpl::EdsResourceArgs args({
{"locality0", GetBackendPorts()},
});
balancers_[0]->ads_service()->SetEdsResource(
BuildEdsResource(args, DefaultEdsServiceName()));
WaitForAllBackends();
}
std::string TestTypeName(const ::testing::TestParamInfo<TestType>& info) { std::string TestTypeName(const ::testing::TestParamInfo<TestType>& info) {
return info.param.AsString(); return info.param.AsString();
} }
@ -7967,6 +7997,10 @@ INSTANTIATE_TEST_SUITE_P(XdsTest, ClientLoadReportingWithDropTest,
TestType(true, true)), TestType(true, true)),
&TestTypeName); &TestTypeName);
INSTANTIATE_TEST_SUITE_P(XdsTest, BootstrapContentsFromEnvVarTest,
::testing::Values(TestType(true, false)),
&TestTypeName);
} // namespace } // namespace
} // namespace testing } // namespace testing
} // namespace grpc } // namespace grpc

@ -51,7 +51,7 @@ static const auto TEST_TAG_KEY = TagKey::Register("my_key");
static const auto TEST_TAG_VALUE = "my_value"; static const auto TEST_TAG_VALUE = "my_value";
class EchoServer final : public EchoTestService::Service { class EchoServer final : public EchoTestService::Service {
::grpc::Status Echo(::grpc::ServerContext* context, ::grpc::Status Echo(::grpc::ServerContext* /*context*/,
const EchoRequest* request, const EchoRequest* request,
EchoResponse* response) override { EchoResponse* response) override {
if (request->param().expected_error().code() == 0) { if (request->param().expected_error().code() == 0) {

@ -367,7 +367,7 @@ class LoadBalancerStatsServiceImpl : public LoadBalancerStatsService::Service {
explicit LoadBalancerStatsServiceImpl(StatsWatchers* stats_watchers) explicit LoadBalancerStatsServiceImpl(StatsWatchers* stats_watchers)
: stats_watchers_(stats_watchers) {} : stats_watchers_(stats_watchers) {}
Status GetClientStats(ServerContext* context, Status GetClientStats(ServerContext* /*context*/,
const LoadBalancerStatsRequest* request, const LoadBalancerStatsRequest* request,
LoadBalancerStatsResponse* response) override { LoadBalancerStatsResponse* response) override {
int start_id; int start_id;
@ -390,8 +390,8 @@ class LoadBalancerStatsServiceImpl : public LoadBalancerStatsService::Service {
} }
Status GetClientAccumulatedStats( Status GetClientAccumulatedStats(
ServerContext* context, ServerContext* /*context*/,
const LoadBalancerAccumulatedStatsRequest* request, const LoadBalancerAccumulatedStatsRequest* /*request*/,
LoadBalancerAccumulatedStatsResponse* response) override { LoadBalancerAccumulatedStatsResponse* response) override {
std::lock_guard<std::mutex> lock(stats_watchers_->mu); std::lock_guard<std::mutex> lock(stats_watchers_->mu);
stats_watchers_->global_watcher->GetCurrentRpcStats(response, stats_watchers_->global_watcher->GetCurrentRpcStats(response,
@ -410,9 +410,9 @@ class XdsUpdateClientConfigureServiceImpl
RpcConfigurationsQueue* rpc_configs_queue) RpcConfigurationsQueue* rpc_configs_queue)
: rpc_configs_queue_(rpc_configs_queue) {} : rpc_configs_queue_(rpc_configs_queue) {}
Status Configure(ServerContext* context, Status Configure(ServerContext* /*context*/,
const ClientConfigureRequest* request, const ClientConfigureRequest* request,
ClientConfigureResponse* response) override { ClientConfigureResponse* /*response*/) override {
std::map<int, std::vector<std::pair<std::string, std::string>>> std::map<int, std::vector<std::pair<std::string, std::string>>>
metadata_map; metadata_map;
for (const auto& data : request->metadata()) { for (const auto& data : request->metadata()) {

@ -52,7 +52,7 @@ class TestServiceImpl : public TestService::Service {
public: public:
explicit TestServiceImpl(const std::string& i) : hostname_(i) {} explicit TestServiceImpl(const std::string& i) : hostname_(i) {}
Status UnaryCall(ServerContext* context, const SimpleRequest* request, Status UnaryCall(ServerContext* context, const SimpleRequest* /*request*/,
SimpleResponse* response) override { SimpleResponse* response) override {
response->set_server_id(absl::GetFlag(FLAGS_server_id)); response->set_server_id(absl::GetFlag(FLAGS_server_id));
response->set_hostname(hostname_); response->set_hostname(hostname_);
@ -60,8 +60,8 @@ class TestServiceImpl : public TestService::Service {
return Status::OK; return Status::OK;
} }
Status EmptyCall(ServerContext* context, const Empty* request, Status EmptyCall(ServerContext* context, const Empty* /*request*/,
Empty* response) override { Empty* /*response*/) override {
context->AddInitialMetadata("hostname", hostname_); context->AddInitialMetadata("hostname", hostname_);
return Status::OK; return Status::OK;
} }

@ -34,7 +34,7 @@ absl::once_flag once;
void RegisterOnce() { absl::call_once(once, grpc::RegisterOpenCensusPlugin); } void RegisterOnce() { absl::call_once(once, grpc::RegisterOpenCensusPlugin); }
class EchoServer final : public grpc::testing::EchoTestService::Service { class EchoServer final : public grpc::testing::EchoTestService::Service {
grpc::Status Echo(grpc::ServerContext* context, grpc::Status Echo(grpc::ServerContext* /*context*/,
const grpc::testing::EchoRequest* request, const grpc::testing::EchoRequest* request,
grpc::testing::EchoResponse* response) override { grpc::testing::EchoResponse* response) override {
if (request->param().expected_error().code() == 0) { if (request->param().expected_error().code() == 0) {

@ -290,6 +290,7 @@ grpc_cc_test(
], ],
deps = [ deps = [
"//:grpc++_error_details", "//:grpc++_error_details",
"//src/proto/grpc/status:status_proto",
"//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_messages_proto",
"//test/core/util:grpc_test_util", "//test/core/util:grpc_test_util",
], ],

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

Loading…
Cancel
Save