grpc 1.27.0 → 1.28.0.pre2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (678) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +707 -629
  3. data/include/grpc/impl/codegen/grpc_types.h +5 -0
  4. data/include/grpc/impl/codegen/port_platform.h +7 -0
  5. data/include/grpc/impl/codegen/sync.h +5 -3
  6. data/include/grpc/impl/codegen/sync_abseil.h +36 -0
  7. data/include/grpc/module.modulemap +3 -0
  8. data/include/grpc/support/sync_abseil.h +26 -0
  9. data/src/core/ext/filters/client_channel/client_channel.cc +47 -29
  10. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +31 -47
  11. data/src/core/ext/filters/client_channel/client_channel_channelz.h +1 -3
  12. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
  13. data/src/core/ext/filters/client_channel/http_proxy.cc +4 -1
  14. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +21 -28
  15. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +18 -21
  16. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +9 -13
  17. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +46 -72
  18. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +413 -422
  19. data/src/core/ext/filters/client_channel/lb_policy_factory.h +3 -3
  20. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +43 -75
  21. data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
  22. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +57 -70
  23. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +1 -1
  24. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +1 -1
  25. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +1 -1
  26. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +3 -3
  27. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +2 -2
  28. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +1 -1
  29. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +3 -3
  30. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +4 -2
  31. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +228 -286
  32. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +2 -2
  33. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +13 -14
  34. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +5 -7
  35. data/src/core/ext/filters/client_channel/service_config.cc +91 -160
  36. data/src/core/ext/filters/client_channel/service_config.h +14 -21
  37. data/src/core/ext/filters/client_channel/xds/xds_api.cc +581 -251
  38. data/src/core/ext/filters/client_channel/xds/xds_api.h +189 -151
  39. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +133 -350
  40. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +18 -39
  41. data/src/core/ext/filters/client_channel/xds/xds_channel.h +3 -1
  42. data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +12 -9
  43. data/src/core/ext/filters/client_channel/xds/xds_client.cc +559 -242
  44. data/src/core/ext/filters/client_channel/xds/xds_client.h +54 -34
  45. data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +53 -128
  46. data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +105 -132
  47. data/src/core/ext/filters/message_size/message_size_filter.cc +32 -35
  48. data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
  49. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +3 -6
  50. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +4 -6
  51. data/src/core/ext/transport/chttp2/transport/writing.cc +1 -1
  52. data/src/core/ext/transport/inproc/inproc_transport.cc +22 -42
  53. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +17 -0
  54. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +30 -0
  55. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +27 -0
  56. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +54 -0
  57. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +46 -21
  58. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +116 -29
  59. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +4 -362
  60. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +14 -1337
  61. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +390 -0
  62. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +1411 -0
  63. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +29 -8
  64. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +60 -0
  65. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +1 -0
  66. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +1 -0
  67. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +5 -3
  68. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +6 -2
  69. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +48 -5
  70. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +154 -4
  71. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +19 -15
  72. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +46 -32
  73. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +26 -4
  74. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +70 -0
  75. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +42 -25
  76. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +83 -25
  77. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +1 -0
  78. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +43 -7
  79. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +115 -0
  80. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -0
  81. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +7 -68
  82. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +14 -201
  83. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +91 -0
  84. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +240 -0
  85. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +1 -71
  86. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +3 -228
  87. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +88 -0
  88. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +258 -0
  89. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +1 -0
  90. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +30 -0
  91. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +53 -0
  92. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +104 -0
  93. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +383 -0
  94. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +17 -0
  95. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +33 -0
  96. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +144 -0
  97. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +527 -0
  98. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +42 -0
  99. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +112 -0
  100. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +29 -0
  101. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +53 -0
  102. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +62 -0
  103. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +199 -0
  104. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +17 -0
  105. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +33 -0
  106. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +793 -0
  107. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +2936 -0
  108. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +58 -0
  109. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +134 -0
  110. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +27 -0
  111. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +53 -0
  112. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +227 -0
  113. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +725 -0
  114. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +296 -0
  115. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +1072 -0
  116. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +32 -0
  117. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +65 -0
  118. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +47 -0
  119. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +108 -0
  120. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +52 -0
  121. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +133 -0
  122. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +87 -0
  123. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +258 -0
  124. data/src/core/ext/upb-generated/envoy/type/range.upb.c +11 -0
  125. data/src/core/ext/upb-generated/envoy/type/range.upb.h +27 -0
  126. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +28 -0
  127. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +62 -0
  128. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +88 -0
  129. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +249 -0
  130. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +30 -27
  131. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +64 -52
  132. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +48 -0
  133. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +104 -0
  134. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +17 -0
  135. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +30 -0
  136. data/src/core/ext/upb-generated/validate/validate.upb.c +38 -34
  137. data/src/core/ext/upb-generated/validate/validate.upb.h +129 -99
  138. data/src/core/lib/channel/channel_trace.cc +32 -41
  139. data/src/core/lib/channel/channel_trace.h +3 -3
  140. data/src/core/lib/channel/channelz.cc +158 -248
  141. data/src/core/lib/channel/channelz.h +12 -15
  142. data/src/core/lib/channel/channelz_registry.cc +47 -74
  143. data/src/core/lib/channel/channelz_registry.h +4 -4
  144. data/src/core/lib/gpr/sync_abseil.cc +114 -0
  145. data/src/core/lib/gpr/sync_posix.cc +8 -5
  146. data/src/core/lib/gpr/sync_windows.cc +4 -2
  147. data/src/core/lib/gprpp/host_port.cc +1 -1
  148. data/src/core/lib/gprpp/inlined_vector.h +1 -210
  149. data/src/core/lib/gprpp/memory.h +2 -6
  150. data/src/core/lib/gprpp/optional.h +0 -41
  151. data/src/core/lib/gprpp/string_view.h +5 -114
  152. data/src/core/lib/iomgr/buffer_list.cc +36 -35
  153. data/src/core/lib/iomgr/error.h +4 -4
  154. data/src/core/lib/iomgr/ev_epollex_linux.cc +12 -4
  155. data/src/core/lib/iomgr/load_file.cc +1 -0
  156. data/src/core/lib/iomgr/tcp_client_posix.cc +17 -17
  157. data/src/core/lib/iomgr/tcp_client_posix.h +6 -6
  158. data/src/core/lib/iomgr/tcp_posix.cc +2 -1
  159. data/src/core/lib/iomgr/work_serializer.cc +155 -0
  160. data/src/core/lib/iomgr/work_serializer.h +65 -0
  161. data/src/core/lib/json/json.h +209 -79
  162. data/src/core/lib/json/json_reader.cc +469 -455
  163. data/src/core/lib/json/json_writer.cc +173 -169
  164. data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
  165. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +10 -8
  166. data/src/core/lib/security/credentials/jwt/json_token.cc +26 -56
  167. data/src/core/lib/security/credentials/jwt/json_token.h +2 -1
  168. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +8 -18
  169. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +149 -159
  170. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
  171. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +37 -34
  172. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -1
  173. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +2 -1
  174. data/src/core/lib/security/security_connector/local/local_security_connector.cc +5 -7
  175. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +3 -15
  176. data/src/core/lib/security/security_connector/ssl_utils.cc +3 -1
  177. data/src/core/lib/security/security_connector/ssl_utils.h +0 -1
  178. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +24 -1
  179. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +5 -1
  180. data/src/core/lib/security/transport/security_handshaker.cc +2 -2
  181. data/src/core/lib/security/util/json_util.cc +22 -15
  182. data/src/core/lib/security/util/json_util.h +2 -2
  183. data/src/core/lib/surface/version.cc +1 -1
  184. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  185. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +1 -1
  186. data/src/core/tsi/grpc_shadow_boringssl.h +1333 -1319
  187. data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
  188. data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -1
  189. data/src/core/tsi/ssl_transport_security.cc +2 -1
  190. data/src/ruby/lib/grpc/version.rb +1 -1
  191. data/third_party/abseil-cpp/absl/base/attributes.h +1 -1
  192. data/third_party/abseil-cpp/absl/base/config.h +10 -4
  193. data/third_party/abseil-cpp/absl/base/internal/atomic_hook.h +30 -9
  194. data/third_party/abseil-cpp/absl/base/internal/errno_saver.h +43 -0
  195. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +7 -5
  196. data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +2 -1
  197. data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +2 -2
  198. data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +2 -3
  199. data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +3 -3
  200. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +37 -0
  201. data/third_party/abseil-cpp/absl/base/options.h +2 -10
  202. data/third_party/abseil-cpp/absl/strings/charconv.cc +0 -1
  203. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +388 -0
  204. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +432 -0
  205. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +245 -0
  206. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +209 -0
  207. data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +326 -0
  208. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +51 -0
  209. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +415 -0
  210. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +493 -0
  211. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +23 -0
  212. data/third_party/abseil-cpp/absl/strings/internal/str_format/output.cc +72 -0
  213. data/third_party/abseil-cpp/absl/strings/internal/str_format/output.h +104 -0
  214. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +334 -0
  215. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +333 -0
  216. data/third_party/abseil-cpp/absl/strings/str_format.h +537 -0
  217. data/third_party/abseil-cpp/absl/strings/string_view.h +19 -11
  218. data/{src/boringssl → third_party/boringssl-with-bazel}/err_data.c +0 -0
  219. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_bitstr.c +0 -0
  220. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_bool.c +0 -0
  221. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_d2i_fp.c +0 -0
  222. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_dup.c +0 -0
  223. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_enum.c +0 -0
  224. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_gentm.c +0 -0
  225. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_i2d_fp.c +0 -0
  226. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_int.c +0 -0
  227. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_mbstr.c +0 -0
  228. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_object.c +0 -0
  229. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_octet.c +0 -0
  230. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_print.c +0 -0
  231. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_strnid.c +0 -0
  232. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_time.c +3 -4
  233. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_type.c +0 -0
  234. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utctm.c +0 -0
  235. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utf8.c +0 -0
  236. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_lib.c +0 -0
  237. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_locl.h +0 -0
  238. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_par.c +0 -0
  239. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn_pack.c +0 -0
  240. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_enum.c +0 -0
  241. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_int.c +0 -0
  242. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_string.c +0 -0
  243. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_dec.c +0 -0
  244. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_enc.c +0 -0
  245. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_fre.c +0 -0
  246. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_new.c +0 -0
  247. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_typ.c +0 -0
  248. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_utl.c +0 -0
  249. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/time_support.c +0 -0
  250. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/base64/base64.c +0 -0
  251. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/bio.c +0 -0
  252. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/bio_mem.c +0 -0
  253. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/connect.c +3 -4
  254. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/fd.c +0 -1
  255. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/file.c +5 -6
  256. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/hexdump.c +0 -0
  257. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/internal.h +0 -0
  258. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/pair.c +0 -1
  259. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/printf.c +0 -0
  260. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/socket.c +0 -0
  261. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/socket_helper.c +0 -0
  262. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bn_extra/bn_asn1.c +0 -0
  263. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bn_extra/convert.c +0 -0
  264. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/buf/buf.c +10 -69
  265. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/asn1_compat.c +0 -0
  266. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/ber.c +0 -0
  267. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/cbb.c +41 -2
  268. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/cbs.c +60 -3
  269. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/internal.h +0 -0
  270. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/unicode.c +0 -0
  271. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/chacha/chacha.c +0 -0
  272. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/chacha/internal.h +0 -0
  273. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/cipher_extra.c +0 -0
  274. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/derive_key.c +0 -0
  275. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesccm.c +0 -0
  276. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesctrhmac.c +0 -0
  277. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesgcmsiv.c +8 -0
  278. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_chacha20poly1305.c +0 -0
  279. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_null.c +0 -0
  280. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc2.c +0 -0
  281. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc4.c +0 -0
  282. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_tls.c +0 -0
  283. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/internal.h +0 -0
  284. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/tls_cbc.c +0 -0
  285. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cmac/cmac.c +0 -0
  286. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/conf.c +0 -0
  287. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/conf_def.h +0 -0
  288. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/internal.h +0 -0
  289. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-fuchsia.c +0 -0
  290. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-linux.c +0 -0
  291. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm-linux.c +0 -1
  292. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm-linux.h +0 -0
  293. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm.c +0 -0
  294. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-intel.c +0 -0
  295. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-ppc64le.c +0 -0
  296. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/crypto.c +0 -0
  297. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/curve25519/spake25519.c +0 -0
  298. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/check.c +3 -3
  299. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/dh.c +1 -2
  300. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/dh_asn1.c +0 -0
  301. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/params.c +0 -0
  302. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/digest_extra/digest_extra.c +0 -0
  303. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dsa/dsa.c +0 -0
  304. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dsa/dsa_asn1.c +0 -0
  305. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ec_extra/ec_asn1.c +0 -0
  306. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ec_extra/ec_derive.c +2 -3
  307. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ecdh_extra/ecdh_extra.c +0 -0
  308. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ecdsa_extra/ecdsa_asn1.c +0 -0
  309. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/engine/engine.c +0 -0
  310. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/err/err.c +6 -6
  311. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/err/internal.h +0 -0
  312. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/digestsign.c +0 -0
  313. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp.c +0 -0
  314. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp_asn1.c +0 -0
  315. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp_ctx.c +0 -0
  316. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/internal.h +0 -0
  317. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_dsa_asn1.c +0 -0
  318. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ec.c +0 -1
  319. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ec_asn1.c +0 -0
  320. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ed25519.c +0 -0
  321. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ed25519_asn1.c +0 -0
  322. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_rsa.c +14 -2
  323. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_rsa_asn1.c +0 -0
  324. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_x25519.c +0 -0
  325. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_x25519_asn1.c +1 -2
  326. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/pbkdf.c +0 -0
  327. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/print.c +0 -0
  328. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/scrypt.c +0 -0
  329. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/sign.c +0 -0
  330. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ex_data.c +0 -0
  331. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.c +108 -0
  332. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1282 -0
  333. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/internal.h +5 -7
  334. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/key_wrap.c +0 -0
  335. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/mode_wrappers.c +0 -2
  336. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bcm.c +2 -0
  337. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/add.c +0 -0
  338. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/asm/x86_64-gcc.c +0 -0
  339. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/bn.c +0 -0
  340. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/bytes.c +0 -0
  341. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/cmp.c +0 -0
  342. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/ctx.c +0 -0
  343. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/div.c +0 -0
  344. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/div_extra.c +0 -0
  345. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/exponentiation.c +0 -0
  346. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/gcd.c +0 -0
  347. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/gcd_extra.c +0 -0
  348. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/generic.c +0 -0
  349. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/internal.h +0 -0
  350. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/jacobi.c +0 -0
  351. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/montgomery.c +0 -0
  352. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/montgomery_inv.c +0 -0
  353. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/mul.c +0 -0
  354. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/prime.c +11 -12
  355. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/random.c +0 -0
  356. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/rsaz_exp.c +0 -0
  357. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/rsaz_exp.h +0 -0
  358. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/shift.c +0 -0
  359. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/sqrt.c +0 -0
  360. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/aead.c +0 -0
  361. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/cipher.c +0 -0
  362. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/e_aes.c +3 -5
  363. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/e_des.c +0 -0
  364. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/internal.h +0 -0
  365. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/delocate.h +0 -0
  366. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/des.c +0 -0
  367. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/internal.h +0 -0
  368. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/digest.c +0 -0
  369. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/digests.c +0 -0
  370. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/internal.h +0 -0
  371. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/md32_common.h +0 -0
  372. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec.c +0 -0
  373. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec_key.c +1 -1
  374. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec_montgomery.c +0 -0
  375. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/felem.c +0 -0
  376. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/internal.h +0 -0
  377. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/oct.c +0 -0
  378. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p224-64.c +0 -0
  379. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64-table.h +0 -0
  380. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64.c +0 -0
  381. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64.h +0 -0
  382. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/scalar.c +0 -0
  383. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/simple.c +0 -0
  384. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/simple_mul.c +0 -0
  385. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/util.c +0 -0
  386. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/wnaf.c +0 -0
  387. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ecdh/ecdh.c +0 -0
  388. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ecdsa/ecdsa.c +0 -0
  389. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/fips_shared_support.c +0 -0
  390. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/hmac/hmac.c +0 -0
  391. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/is_fips.c +0 -0
  392. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md4/md4.c +0 -0
  393. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md5/internal.h +0 -0
  394. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md5/md5.c +0 -0
  395. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/cbc.c +0 -0
  396. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/cfb.c +0 -0
  397. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/ctr.c +0 -0
  398. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/gcm.c +45 -193
  399. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +304 -0
  400. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/internal.h +8 -18
  401. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/ofb.c +0 -0
  402. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/polyval.c +0 -0
  403. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/ctrdrbg.c +0 -0
  404. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/internal.h +0 -0
  405. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/rand.c +0 -0
  406. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/urandom.c +0 -0
  407. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/blinding.c +0 -0
  408. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/internal.h +0 -0
  409. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/padding.c +0 -0
  410. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/rsa.c +7 -1
  411. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/rsa_impl.c +60 -51
  412. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/self_check/self_check.c +0 -0
  413. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/internal.h +0 -0
  414. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha1-altivec.c +0 -0
  415. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha1.c +0 -0
  416. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha256.c +0 -0
  417. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha512.c +0 -0
  418. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/internal.h +0 -0
  419. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/kdf.c +0 -0
  420. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hkdf/hkdf.c +0 -0
  421. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hrss/hrss.c +210 -311
  422. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hrss/internal.h +0 -1
  423. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/internal.h +21 -1
  424. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/lhash/lhash.c +0 -0
  425. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/mem.c +70 -0
  426. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj.c +16 -21
  427. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj_dat.h +27 -6
  428. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj_xref.c +0 -0
  429. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_all.c +0 -0
  430. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_info.c +0 -1
  431. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_lib.c +7 -7
  432. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_oth.c +0 -1
  433. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_pk8.c +0 -1
  434. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_pkey.c +0 -1
  435. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_x509.c +0 -0
  436. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_xaux.c +0 -0
  437. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/internal.h +0 -0
  438. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/pkcs7.c +0 -0
  439. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/pkcs7_x509.c +1 -1
  440. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/internal.h +0 -0
  441. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/p5_pbev2.c +0 -0
  442. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/pkcs8.c +0 -0
  443. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/pkcs8_x509.c +0 -0
  444. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/internal.h +0 -0
  445. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305.c +2 -2
  446. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305_arm.c +21 -20
  447. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305_vec.c +34 -17
  448. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pool/internal.h +0 -0
  449. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pool/pool.c +1 -2
  450. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/deterministic.c +0 -0
  451. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/forkunsafe.c +0 -0
  452. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/fuchsia.c +0 -0
  453. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/rand_extra.c +0 -0
  454. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/windows.c +0 -0
  455. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rc4/rc4.c +0 -0
  456. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/refcount_c11.c +0 -0
  457. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/refcount_lock.c +0 -0
  458. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rsa_extra/rsa_asn1.c +0 -0
  459. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rsa_extra/rsa_print.c +0 -0
  460. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/siphash/siphash.c +3 -1
  461. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/stack/stack.c +0 -0
  462. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread.c +0 -0
  463. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_none.c +0 -0
  464. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_pthread.c +0 -0
  465. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_win.c +0 -0
  466. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_digest.c +0 -0
  467. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_sign.c +0 -0
  468. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_strex.c +0 -0
  469. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_verify.c +0 -1
  470. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/algorithm.c +0 -0
  471. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/asn1_gen.c +0 -0
  472. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/by_dir.c +1 -1
  473. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/by_file.c +0 -1
  474. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/charmap.h +0 -0
  475. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/i2d_pr.c +0 -0
  476. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/internal.h +0 -0
  477. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/rsa_pss.c +0 -0
  478. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_crl.c +0 -0
  479. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_req.c +0 -0
  480. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_x509.c +0 -0
  481. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_x509a.c +0 -0
  482. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/vpm_int.h +0 -0
  483. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509.c +0 -0
  484. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_att.c +0 -0
  485. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_cmp.c +0 -1
  486. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_d2.c +0 -0
  487. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_def.c +0 -0
  488. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_ext.c +0 -0
  489. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_lu.c +0 -0
  490. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_obj.c +1 -1
  491. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_r2x.c +0 -1
  492. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_req.c +0 -1
  493. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_set.c +0 -0
  494. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_trs.c +1 -2
  495. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_txt.c +0 -0
  496. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_v3.c +0 -0
  497. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_vfy.c +0 -1
  498. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_vpm.c +3 -4
  499. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509cset.c +0 -0
  500. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509name.c +0 -0
  501. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509rset.c +0 -0
  502. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509spki.c +0 -0
  503. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_algor.c +0 -0
  504. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_all.c +0 -1
  505. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_attrib.c +0 -0
  506. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_crl.c +0 -0
  507. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_exten.c +0 -0
  508. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_info.c +0 -0
  509. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_name.c +0 -0
  510. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pkey.c +0 -0
  511. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pubkey.c +0 -0
  512. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_req.c +0 -0
  513. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_sig.c +0 -0
  514. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_spki.c +0 -0
  515. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_val.c +0 -0
  516. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_x509.c +0 -0
  517. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_x509a.c +0 -0
  518. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/ext_dat.h +0 -0
  519. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/internal.h +0 -0
  520. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_cache.c +0 -0
  521. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_data.c +0 -0
  522. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_int.h +0 -0
  523. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_lib.c +0 -0
  524. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_map.c +0 -0
  525. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_node.c +0 -0
  526. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_tree.c +0 -0
  527. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_akey.c +0 -0
  528. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_akeya.c +0 -0
  529. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_alt.c +3 -3
  530. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bcons.c +0 -0
  531. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bitst.c +0 -0
  532. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_conf.c +0 -0
  533. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_cpols.c +0 -0
  534. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_crld.c +0 -0
  535. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_enum.c +2 -2
  536. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_extku.c +0 -0
  537. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_genn.c +0 -0
  538. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ia5.c +0 -0
  539. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_info.c +4 -5
  540. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_int.c +0 -0
  541. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_lib.c +0 -0
  542. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ncons.c +0 -0
  543. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ocsp.c +0 -0
  544. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pci.c +0 -0
  545. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcia.c +0 -0
  546. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcons.c +0 -0
  547. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pku.c +0 -0
  548. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pmaps.c +0 -0
  549. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_prn.c +0 -0
  550. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_purp.c +2 -3
  551. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_skey.c +0 -0
  552. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_sxnet.c +0 -0
  553. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_utl.c +11 -12
  554. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/aead.h +0 -0
  555. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/aes.h +0 -0
  556. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/arm_arch.h +0 -0
  557. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1.h +0 -0
  558. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1_mac.h +0 -0
  559. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1t.h +0 -0
  560. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/base.h +0 -0
  561. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/base64.h +0 -0
  562. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bio.h +0 -0
  563. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/blowfish.h +0 -0
  564. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bn.h +32 -20
  565. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/buf.h +9 -9
  566. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/buffer.h +0 -0
  567. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bytestring.h +34 -0
  568. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cast.h +0 -0
  569. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/chacha.h +0 -0
  570. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cipher.h +0 -0
  571. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cmac.h +0 -0
  572. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/conf.h +0 -0
  573. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cpu.h +0 -0
  574. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/crypto.h +0 -0
  575. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/curve25519.h +0 -0
  576. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/des.h +0 -0
  577. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dh.h +0 -0
  578. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/digest.h +0 -0
  579. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dsa.h +0 -0
  580. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dtls1.h +0 -0
  581. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/e_os2.h +0 -0
  582. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ec.h +11 -4
  583. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ec_key.h +4 -2
  584. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ecdh.h +0 -0
  585. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ecdsa.h +0 -0
  586. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/engine.h +0 -0
  587. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/err.h +11 -9
  588. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/evp.h +20 -0
  589. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ex_data.h +0 -0
  590. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hkdf.h +0 -0
  591. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hmac.h +0 -0
  592. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hrss.h +0 -0
  593. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/is_boringssl.h +0 -0
  594. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/lhash.h +0 -0
  595. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/md4.h +0 -0
  596. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/md5.h +0 -0
  597. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/mem.h +17 -2
  598. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/nid.h +9 -0
  599. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/obj.h +0 -0
  600. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/obj_mac.h +0 -0
  601. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/objects.h +0 -0
  602. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslconf.h +0 -0
  603. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslv.h +0 -0
  604. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ossl_typ.h +0 -0
  605. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pem.h +0 -0
  606. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs12.h +0 -0
  607. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs7.h +0 -0
  608. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs8.h +0 -0
  609. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/poly1305.h +5 -7
  610. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pool.h +0 -0
  611. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rand.h +0 -0
  612. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rc4.h +0 -0
  613. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ripemd.h +0 -0
  614. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rsa.h +0 -0
  615. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/safestack.h +0 -0
  616. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/sha.h +0 -0
  617. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/siphash.h +0 -0
  618. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/span.h +0 -0
  619. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/srtp.h +0 -0
  620. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ssl.h +10 -20
  621. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ssl3.h +0 -0
  622. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/stack.h +0 -0
  623. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/thread.h +0 -0
  624. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/tls1.h +0 -3
  625. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/type_check.h +0 -0
  626. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509.h +0 -0
  627. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509_vfy.h +0 -0
  628. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509v3.h +0 -0
  629. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/bio_ssl.cc +0 -0
  630. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_both.cc +0 -1
  631. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_lib.cc +0 -0
  632. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_pkt.cc +0 -1
  633. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_srtp.cc +0 -0
  634. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/dtls_method.cc +0 -1
  635. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/dtls_record.cc +0 -0
  636. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handoff.cc +126 -29
  637. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake.cc +5 -4
  638. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake_client.cc +24 -13
  639. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake_server.cc +1 -5
  640. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/internal.h +32 -26
  641. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_both.cc +0 -0
  642. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_lib.cc +2 -3
  643. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_pkt.cc +0 -1
  644. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_aead_ctx.cc +0 -0
  645. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_asn1.cc +1 -2
  646. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_buffer.cc +34 -15
  647. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_cert.cc +0 -1
  648. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_cipher.cc +0 -1
  649. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_file.cc +0 -0
  650. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_key_share.cc +0 -0
  651. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_lib.cc +13 -14
  652. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_privkey.cc +0 -0
  653. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_session.cc +2 -1
  654. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_stat.cc +0 -0
  655. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_transcript.cc +0 -0
  656. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_versions.cc +1 -1
  657. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_x509.cc +0 -0
  658. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/t1_enc.cc +0 -0
  659. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/t1_lib.cc +11 -171
  660. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_both.cc +0 -0
  661. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_client.cc +3 -4
  662. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_enc.cc +5 -1
  663. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_server.cc +78 -101
  664. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls_method.cc +1 -1
  665. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls_record.cc +7 -2
  666. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519.c +0 -0
  667. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519_32.h +0 -0
  668. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519_64.h +0 -0
  669. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519_tables.h +0 -0
  670. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/internal.h +0 -0
  671. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/p256.c +0 -0
  672. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/p256_32.h +0 -0
  673. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/p256_64.h +0 -0
  674. metadata +562 -491
  675. data/src/core/lib/iomgr/logical_thread.cc +0 -103
  676. data/src/core/lib/iomgr/logical_thread.h +0 -52
  677. data/src/core/lib/json/json.cc +0 -94
  678. data/third_party/boringssl/crypto/fipsmodule/aes/aes.c +0 -860
@@ -19,6 +19,8 @@
19
19
 
20
20
  #include <grpc/support/port_platform.h>
21
21
 
22
+ #include <memory>
23
+ #include <string>
22
24
  #include <vector>
23
25
 
24
26
  #include <grpc/impl/codegen/slice.h>
@@ -33,33 +35,22 @@ namespace grpc_core {
33
35
 
34
36
  class XdsBootstrap {
35
37
  public:
36
- struct MetadataValue {
37
- enum class Type { MD_NULL, DOUBLE, STRING, BOOL, STRUCT, LIST };
38
- Type type = Type::MD_NULL;
39
- // TODO(roth): Once we can use C++17, these can be in a std::variant.
40
- double double_value;
41
- const char* string_value;
42
- bool bool_value;
43
- std::map<const char*, MetadataValue, StringLess> struct_value;
44
- std::vector<MetadataValue> list_value;
45
- };
46
-
47
38
  struct Node {
48
- const char* id = nullptr;
49
- const char* cluster = nullptr;
50
- const char* locality_region = nullptr;
51
- const char* locality_zone = nullptr;
52
- const char* locality_subzone = nullptr;
53
- std::map<const char*, MetadataValue, StringLess> metadata;
39
+ std::string id;
40
+ std::string cluster;
41
+ std::string locality_region;
42
+ std::string locality_zone;
43
+ std::string locality_subzone;
44
+ Json metadata;
54
45
  };
55
46
 
56
47
  struct ChannelCreds {
57
- const char* type = nullptr;
58
- grpc_json* config = nullptr;
48
+ std::string type;
49
+ Json config;
59
50
  };
60
51
 
61
52
  struct XdsServer {
62
- const char* server_uri = nullptr;
53
+ std::string server_uri;
63
54
  InlinedVector<ChannelCreds, 1> channel_creds;
64
55
  };
65
56
 
@@ -68,8 +59,7 @@ class XdsBootstrap {
68
59
  static std::unique_ptr<XdsBootstrap> ReadFromFile(grpc_error** error);
69
60
 
70
61
  // Do not instantiate directly -- use ReadFromFile() above instead.
71
- XdsBootstrap(grpc_slice contents, grpc_error** error);
72
- ~XdsBootstrap();
62
+ XdsBootstrap(Json json, grpc_error** error);
73
63
 
74
64
  // TODO(roth): We currently support only one server. Fix this when we
75
65
  // add support for fallback for the xds channel.
@@ -77,23 +67,12 @@ class XdsBootstrap {
77
67
  const Node* node() const { return node_.get(); }
78
68
 
79
69
  private:
80
- grpc_error* ParseXdsServerList(grpc_json* json);
81
- grpc_error* ParseXdsServer(grpc_json* json, size_t idx);
82
- grpc_error* ParseChannelCredsArray(grpc_json* json, XdsServer* server);
83
- grpc_error* ParseChannelCreds(grpc_json* json, size_t idx, XdsServer* server);
84
- grpc_error* ParseNode(grpc_json* json);
85
- grpc_error* ParseLocality(grpc_json* json);
86
-
87
- InlinedVector<grpc_error*, 1> ParseMetadataStruct(
88
- grpc_json* json,
89
- std::map<const char*, MetadataValue, StringLess>* result);
90
- InlinedVector<grpc_error*, 1> ParseMetadataList(
91
- grpc_json* json, std::vector<MetadataValue>* result);
92
- grpc_error* ParseMetadataValue(grpc_json* json, size_t idx,
93
- MetadataValue* result);
94
-
95
- grpc_slice contents_;
96
- grpc_json* tree_ = nullptr;
70
+ grpc_error* ParseXdsServerList(Json* json);
71
+ grpc_error* ParseXdsServer(Json* json, size_t idx);
72
+ grpc_error* ParseChannelCredsArray(Json* json, XdsServer* server);
73
+ grpc_error* ParseChannelCreds(Json* json, size_t idx, XdsServer* server);
74
+ grpc_error* ParseNode(Json* json);
75
+ grpc_error* ParseLocality(Json* json);
97
76
 
98
77
  InlinedVector<XdsServer, 1> servers_;
99
78
  std::unique_ptr<Node> node_;
@@ -24,6 +24,7 @@
24
24
  #include <grpc/impl/codegen/grpc_types.h>
25
25
 
26
26
  #include "src/core/ext/filters/client_channel/xds/xds_bootstrap.h"
27
+ #include "src/core/lib/iomgr/error.h"
27
28
 
28
29
  namespace grpc_core {
29
30
 
@@ -36,7 +37,8 @@ namespace grpc_core {
36
37
  grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args);
37
38
 
38
39
  grpc_channel* CreateXdsChannel(const XdsBootstrap& bootstrap,
39
- const grpc_channel_args& args);
40
+ const grpc_channel_args& args,
41
+ grpc_error** error);
40
42
 
41
43
  } // namespace grpc_core
42
44
 
@@ -64,36 +64,39 @@ grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) {
64
64
  }
65
65
 
66
66
  grpc_channel* CreateXdsChannel(const XdsBootstrap& bootstrap,
67
- const grpc_channel_args& args) {
67
+ const grpc_channel_args& args,
68
+ grpc_error** error) {
68
69
  grpc_channel_credentials* creds = nullptr;
69
70
  RefCountedPtr<grpc_channel_credentials> creds_to_unref;
70
71
  if (!bootstrap.server().channel_creds.empty()) {
71
72
  for (size_t i = 0; i < bootstrap.server().channel_creds.size(); ++i) {
72
- if (strcmp(bootstrap.server().channel_creds[i].type, "google_default") ==
73
- 0) {
73
+ if (bootstrap.server().channel_creds[i].type == "google_default") {
74
74
  creds = grpc_google_default_credentials_create();
75
75
  break;
76
- } else if (strcmp(bootstrap.server().channel_creds[i].type, "fake") ==
77
- 0) {
76
+ } else if (bootstrap.server().channel_creds[i].type == "fake") {
78
77
  creds = grpc_fake_transport_security_credentials_create();
79
78
  break;
80
79
  }
81
80
  }
82
- if (creds == nullptr) return nullptr;
81
+ if (creds == nullptr) {
82
+ *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
83
+ "no supported credential types found");
84
+ return nullptr;
85
+ }
83
86
  creds_to_unref.reset(creds);
84
87
  } else {
85
88
  creds = grpc_channel_credentials_find_in_args(&args);
86
89
  if (creds == nullptr) {
87
90
  // Built with security but parent channel is insecure.
88
- return grpc_insecure_channel_create(bootstrap.server().server_uri, &args,
89
- nullptr);
91
+ return grpc_insecure_channel_create(bootstrap.server().server_uri.c_str(),
92
+ &args, nullptr);
90
93
  }
91
94
  }
92
95
  const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS;
93
96
  grpc_channel_args* new_args =
94
97
  grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1);
95
98
  grpc_channel* channel = grpc_secure_channel_create(
96
- creds, bootstrap.server().server_uri, new_args, nullptr);
99
+ creds, bootstrap.server().server_uri.c_str(), new_args, nullptr);
97
100
  grpc_channel_args_destroy(new_args);
98
101
  return channel;
99
102
  }
@@ -125,29 +125,123 @@ class XdsClient::ChannelState::AdsCallState
125
125
  XdsClient* xds_client() const { return chand()->xds_client(); }
126
126
  bool seen_response() const { return seen_response_; }
127
127
 
128
- // If \a type_url is an unsupported type, \a nonce_for_unsupported_type and
129
- // \a error_for_unsupported_type will be used in the request; otherwise, the
130
- // nonce and error stored in each ADS call state will be used. Takes ownership
131
- // of \a error_for_unsupported_type.
132
- void SendMessageLocked(const std::string& type_url,
133
- const std::string& nonce_for_unsupported_type,
134
- grpc_error* error_for_unsupported_type,
135
- bool is_first_message);
128
+ void Subscribe(const std::string& type_url, const std::string& name);
129
+ void Unsubscribe(const std::string& type_url, const std::string& name);
130
+
131
+ bool HasSubscribedResources() const;
136
132
 
137
133
  private:
138
- struct BufferedRequest {
139
- std::string nonce;
140
- grpc_error* error;
134
+ class ResourceState : public InternallyRefCounted<ResourceState> {
135
+ public:
136
+ ResourceState(const std::string& type_url, const std::string& name)
137
+ : type_url_(type_url), name_(name) {
138
+ GRPC_CLOSURE_INIT(&timer_callback_, OnTimer, this,
139
+ grpc_schedule_on_exec_ctx);
140
+ }
141
+
142
+ void Orphan() override {
143
+ Finish();
144
+ Unref();
145
+ }
146
+
147
+ void Start(RefCountedPtr<AdsCallState> ads_calld) {
148
+ if (sent_) return;
149
+ sent_ = true;
150
+ ads_calld_ = std::move(ads_calld);
151
+ Ref().release();
152
+ timer_pending_ = true;
153
+ grpc_timer_init(
154
+ &timer_,
155
+ ExecCtx::Get()->Now() + ads_calld_->xds_client()->request_timeout_,
156
+ &timer_callback_);
157
+ }
158
+
159
+ void Finish() {
160
+ if (timer_pending_) {
161
+ grpc_timer_cancel(&timer_);
162
+ timer_pending_ = false;
163
+ }
164
+ }
165
+
166
+ private:
167
+ static void OnTimer(void* arg, grpc_error* error) {
168
+ ResourceState* self = static_cast<ResourceState*>(arg);
169
+ self->ads_calld_->xds_client()->combiner_->Run(
170
+ GRPC_CLOSURE_INIT(&self->timer_callback_, OnTimerLocked, self,
171
+ nullptr),
172
+ GRPC_ERROR_REF(error));
173
+ }
174
+
175
+ static void OnTimerLocked(void* arg, grpc_error* error) {
176
+ ResourceState* self = static_cast<ResourceState*>(arg);
177
+ if (error == GRPC_ERROR_NONE && self->timer_pending_) {
178
+ self->timer_pending_ = false;
179
+ char* msg;
180
+ gpr_asprintf(
181
+ &msg,
182
+ "timeout obtaining resource {type=%s name=%s} from xds server",
183
+ self->type_url_.c_str(), self->name_.c_str());
184
+ grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
185
+ gpr_free(msg);
186
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
187
+ gpr_log(GPR_INFO, "[xds_client %p] %s",
188
+ self->ads_calld_->xds_client(), grpc_error_string(error));
189
+ }
190
+ if (self->type_url_ == XdsApi::kLdsTypeUrl ||
191
+ self->type_url_ == XdsApi::kRdsTypeUrl) {
192
+ self->ads_calld_->xds_client()->service_config_watcher_->OnError(
193
+ error);
194
+ } else if (self->type_url_ == XdsApi::kCdsTypeUrl) {
195
+ ClusterState& state =
196
+ self->ads_calld_->xds_client()->cluster_map_[self->name_];
197
+ for (const auto& p : state.watchers) {
198
+ p.first->OnError(GRPC_ERROR_REF(error));
199
+ }
200
+ GRPC_ERROR_UNREF(error);
201
+ } else if (self->type_url_ == XdsApi::kEdsTypeUrl) {
202
+ EndpointState& state =
203
+ self->ads_calld_->xds_client()->endpoint_map_[self->name_];
204
+ for (const auto& p : state.watchers) {
205
+ p.first->OnError(GRPC_ERROR_REF(error));
206
+ }
207
+ GRPC_ERROR_UNREF(error);
208
+ } else {
209
+ GPR_UNREACHABLE_CODE(return );
210
+ }
211
+ }
212
+ self->ads_calld_.reset();
213
+ self->Unref();
214
+ }
141
215
 
142
- // Takes ownership of \a error.
143
- BufferedRequest(std::string nonce, grpc_error* error)
144
- : nonce(std::move(nonce)), error(error) {}
216
+ const std::string type_url_;
217
+ const std::string name_;
145
218
 
146
- ~BufferedRequest() { GRPC_ERROR_UNREF(error); }
219
+ RefCountedPtr<AdsCallState> ads_calld_;
220
+ bool sent_ = false;
221
+ bool timer_pending_ = false;
222
+ grpc_timer timer_;
223
+ grpc_closure timer_callback_;
147
224
  };
148
225
 
149
- void AcceptCdsUpdate(CdsUpdateMap cds_update_map, std::string new_version);
150
- void AcceptEdsUpdate(EdsUpdateMap eds_update_map, std::string new_version);
226
+ struct ResourceTypeState {
227
+ ~ResourceTypeState() { GRPC_ERROR_UNREF(error); }
228
+
229
+ // Version, nonce, and error for this resource type.
230
+ std::string version;
231
+ std::string nonce;
232
+ grpc_error* error = GRPC_ERROR_NONE;
233
+
234
+ // Subscribed resources of this type.
235
+ std::map<std::string /* name */, OrphanablePtr<ResourceState>>
236
+ subscribed_resources;
237
+ };
238
+
239
+ void SendMessageLocked(const std::string& type_url);
240
+
241
+ void AcceptLdsUpdate(XdsApi::LdsUpdate lds_update);
242
+ void AcceptRdsUpdate(XdsApi::RdsUpdate rds_update);
243
+ void AcceptCdsUpdate(XdsApi::CdsUpdateMap cds_update_map);
244
+ void AcceptEdsUpdate(XdsApi::EdsUpdateMap eds_update_map);
151
245
 
152
246
  static void OnRequestSent(void* arg, grpc_error* error);
153
247
  static void OnRequestSentLocked(void* arg, grpc_error* error);
@@ -158,8 +252,13 @@ class XdsClient::ChannelState::AdsCallState
158
252
 
159
253
  bool IsCurrentCallOnChannel() const;
160
254
 
255
+ std::set<StringView> ClusterNamesForRequest();
256
+ std::set<StringView> EdsServiceNamesForRequest();
257
+
161
258
  // The owning RetryableCall<>.
162
259
  RefCountedPtr<RetryableCall<AdsCallState>> parent_;
260
+
261
+ bool sent_initial_message_ = false;
163
262
  bool seen_response_ = false;
164
263
 
165
264
  // Always non-NULL.
@@ -182,13 +281,11 @@ class XdsClient::ChannelState::AdsCallState
182
281
  grpc_slice status_details_;
183
282
  grpc_closure on_status_received_;
184
283
 
185
- // Version state.
186
- VersionState cds_version_;
187
- VersionState eds_version_;
284
+ // Resource types for which requests need to be sent.
285
+ std::set<std::string /*type_url*/> buffered_requests_;
188
286
 
189
- // Buffered requests.
190
- std::map<std::string /*type_url*/, std::unique_ptr<BufferedRequest>>
191
- buffered_request_map_;
287
+ // State for each resource type.
288
+ std::map<std::string /*type_url*/, ResourceTypeState> state_map_;
192
289
  };
193
290
 
194
291
  // Contains an LRS call to the xds server.
@@ -341,9 +438,14 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) {
341
438
  // Don't want to pass down channelz node from parent; the balancer
342
439
  // channel will get its own.
343
440
  GRPC_ARG_CHANNELZ_CHANNEL_NODE,
441
+ // Keepalive interval. We are explicitly setting our own value below.
442
+ GRPC_ARG_KEEPALIVE_TIME_MS,
344
443
  };
345
444
  // Channel args to add.
346
- InlinedVector<grpc_arg, 2> args_to_add;
445
+ InlinedVector<grpc_arg, 3> args_to_add;
446
+ // Keepalive interval.
447
+ args_to_add.emplace_back(grpc_channel_arg_integer_create(
448
+ const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), 5000));
347
449
  // A channel arg indicating that the target is an xds server.
348
450
  // TODO(roth): Once we figure out our fallback and credentials story, decide
349
451
  // whether this is actually needed. Note that it's currently used by the
@@ -371,12 +473,10 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) {
371
473
  } // namespace
372
474
 
373
475
  XdsClient::ChannelState::ChannelState(RefCountedPtr<XdsClient> xds_client,
374
- const grpc_channel_args& args)
476
+ grpc_channel* channel)
375
477
  : InternallyRefCounted<ChannelState>(&grpc_xds_client_trace),
376
- xds_client_(std::move(xds_client)) {
377
- grpc_channel_args* new_args = BuildXdsChannelArgs(args);
378
- channel_ = CreateXdsChannel(*xds_client_->bootstrap_, *new_args);
379
- grpc_channel_args_destroy(new_args);
478
+ xds_client_(std::move(xds_client)),
479
+ channel_(channel) {
380
480
  GPR_ASSERT(channel_ != nullptr);
381
481
  StartConnectivityWatchLocked();
382
482
  }
@@ -436,31 +536,30 @@ void XdsClient::ChannelState::CancelConnectivityWatchLocked() {
436
536
  grpc_client_channel_stop_connectivity_watch(client_channel_elem, watcher_);
437
537
  }
438
538
 
439
- void XdsClient::ChannelState::OnResourceNamesChanged(
440
- const std::string& type_url) {
539
+ void XdsClient::ChannelState::Subscribe(const std::string& type_url,
540
+ const std::string& name) {
441
541
  if (ads_calld_ == nullptr) {
442
542
  // Start the ADS call if this is the first request.
443
543
  ads_calld_.reset(new RetryableCall<AdsCallState>(
444
544
  Ref(DEBUG_LOCATION, "ChannelState+ads")));
445
- // Note: AdsCallState's ctor will automatically send necessary messages, so
446
- // we can return here.
545
+ // Note: AdsCallState's ctor will automatically subscribe to all
546
+ // resources that the XdsClient already has watchers for, so we can
547
+ // return here.
447
548
  return;
448
549
  }
449
550
  // If the ADS call is in backoff state, we don't need to do anything now
450
551
  // because when the call is restarted it will resend all necessary requests.
451
552
  if (ads_calld() == nullptr) return;
452
- // Send the message if the ADS call is active.
453
- ads_calld()->SendMessageLocked(type_url, "", nullptr, false);
553
+ // Subscribe to this resource if the ADS call is active.
554
+ ads_calld()->Subscribe(type_url, name);
454
555
  }
455
556
 
456
- void XdsClient::ChannelState::OnWatcherRemoved() {
457
- // Keep the ADS call if there are watcher(s).
458
- for (const auto& p : xds_client()->cluster_map_) {
459
- const ClusterState& cluster_state = p.second;
460
- if (!cluster_state.watchers.empty()) return;
557
+ void XdsClient::ChannelState::Unsubscribe(const std::string& type_url,
558
+ const std::string& name) {
559
+ if (ads_calld_ != nullptr) {
560
+ ads_calld_->calld()->Unsubscribe(type_url, name);
561
+ if (!ads_calld_->calld()->HasSubscribedResources()) ads_calld_.reset();
461
562
  }
462
- if (!xds_client()->endpoint_map_.empty()) return;
463
- ads_calld_.reset();
464
563
  }
465
564
 
466
565
  //
@@ -611,13 +710,14 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
611
710
  // Op: send request message.
612
711
  GRPC_CLOSURE_INIT(&on_request_sent_, OnRequestSent, this,
613
712
  grpc_schedule_on_exec_ctx);
614
- bool initial_message = true;
615
- if (!xds_client()->cluster_map_.empty()) {
616
- SendMessageLocked(kCdsTypeUrl, "", nullptr, initial_message);
617
- initial_message = false;
713
+ if (xds_client()->service_config_watcher_ != nullptr) {
714
+ Subscribe(XdsApi::kLdsTypeUrl, xds_client()->server_name_);
715
+ }
716
+ for (const auto& p : xds_client()->cluster_map_) {
717
+ Subscribe(XdsApi::kCdsTypeUrl, std::string(p.first));
618
718
  }
619
- if (!xds_client()->endpoint_map_.empty()) {
620
- SendMessageLocked(kEdsTypeUrl, "", nullptr, initial_message);
719
+ for (const auto& p : xds_client()->endpoint_map_) {
720
+ Subscribe(XdsApi::kEdsTypeUrl, std::string(p.first));
621
721
  }
622
722
  // Op: recv initial metadata.
623
723
  op = ops;
@@ -675,40 +775,46 @@ void XdsClient::ChannelState::AdsCallState::Orphan() {
675
775
  // we are here because xds_client has to orphan a failed call, then the
676
776
  // following cancellation will be a no-op.
677
777
  grpc_call_cancel(call_, nullptr);
778
+ state_map_.clear();
678
779
  // Note that the initial ref is hold by on_status_received_. So the
679
780
  // corresponding unref happens in on_status_received_ instead of here.
680
781
  }
681
782
 
682
783
  void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
683
- const std::string& type_url, const std::string& nonce_for_unsupported_type,
684
- grpc_error* error_for_unsupported_type, bool is_first_message) {
784
+ const std::string& type_url) {
685
785
  // Buffer message sending if an existing message is in flight.
686
786
  if (send_message_payload_ != nullptr) {
687
- buffered_request_map_[type_url].reset(new BufferedRequest(
688
- nonce_for_unsupported_type, error_for_unsupported_type));
787
+ buffered_requests_.insert(type_url);
689
788
  return;
690
789
  }
790
+ auto& state = state_map_[type_url];
791
+ grpc_error* error = state.error;
792
+ state.error = GRPC_ERROR_NONE;
691
793
  grpc_slice request_payload_slice;
692
- const XdsBootstrap::Node* node =
693
- is_first_message ? xds_client()->bootstrap_->node() : nullptr;
694
- const char* build_version =
695
- is_first_message ? xds_client()->build_version_.get() : nullptr;
696
- if (type_url == kCdsTypeUrl) {
697
- request_payload_slice = XdsCdsRequestCreateAndEncode(
698
- xds_client()->WatchedClusterNames(), node, build_version,
699
- cds_version_.version_info, cds_version_.nonce, cds_version_.error);
700
- cds_version_.error = GRPC_ERROR_NONE;
701
- GRPC_ERROR_UNREF(error_for_unsupported_type);
702
- } else if (type_url == kEdsTypeUrl) {
703
- request_payload_slice = XdsEdsRequestCreateAndEncode(
704
- xds_client()->EdsServiceNames(), node, build_version,
705
- eds_version_.version_info, eds_version_.nonce, eds_version_.error);
706
- eds_version_.error = GRPC_ERROR_NONE;
707
- GRPC_ERROR_UNREF(error_for_unsupported_type);
794
+ if (type_url == XdsApi::kLdsTypeUrl) {
795
+ request_payload_slice = xds_client()->api_.CreateLdsRequest(
796
+ xds_client()->server_name_, state.version, state.nonce, error,
797
+ !sent_initial_message_);
798
+ state.subscribed_resources[xds_client()->server_name_]->Start(Ref());
799
+ } else if (type_url == XdsApi::kRdsTypeUrl) {
800
+ request_payload_slice = xds_client()->api_.CreateRdsRequest(
801
+ xds_client()->route_config_name_, state.version, state.nonce, error,
802
+ !sent_initial_message_);
803
+ state.subscribed_resources[xds_client()->route_config_name_]->Start(Ref());
804
+ } else if (type_url == XdsApi::kCdsTypeUrl) {
805
+ request_payload_slice = xds_client()->api_.CreateCdsRequest(
806
+ ClusterNamesForRequest(), state.version, state.nonce, error,
807
+ !sent_initial_message_);
808
+ } else if (type_url == XdsApi::kEdsTypeUrl) {
809
+ request_payload_slice = xds_client()->api_.CreateEdsRequest(
810
+ EdsServiceNamesForRequest(), state.version, state.nonce, error,
811
+ !sent_initial_message_);
708
812
  } else {
709
- request_payload_slice = XdsUnsupportedTypeNackRequestCreateAndEncode(
710
- type_url, nonce_for_unsupported_type, error_for_unsupported_type);
813
+ request_payload_slice = xds_client()->api_.CreateUnsupportedTypeNackRequest(
814
+ type_url, state.nonce, state.error);
815
+ state_map_.erase(type_url);
711
816
  }
817
+ sent_initial_message_ = true;
712
818
  // Create message payload.
713
819
  send_message_payload_ =
714
820
  grpc_raw_byte_buffer_create(&request_payload_slice, 1);
@@ -731,11 +837,118 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
731
837
  }
732
838
  }
733
839
 
840
+ void XdsClient::ChannelState::AdsCallState::Subscribe(
841
+ const std::string& type_url, const std::string& name) {
842
+ auto& state = state_map_[type_url].subscribed_resources[name];
843
+ if (state == nullptr) {
844
+ state = MakeOrphanable<ResourceState>(type_url, name);
845
+ SendMessageLocked(type_url);
846
+ }
847
+ }
848
+
849
+ void XdsClient::ChannelState::AdsCallState::Unsubscribe(
850
+ const std::string& type_url, const std::string& name) {
851
+ state_map_[type_url].subscribed_resources.erase(name);
852
+ SendMessageLocked(type_url);
853
+ }
854
+
855
+ bool XdsClient::ChannelState::AdsCallState::HasSubscribedResources() const {
856
+ for (const auto& p : state_map_) {
857
+ if (!p.second.subscribed_resources.empty()) return true;
858
+ }
859
+ return false;
860
+ }
861
+
862
+ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
863
+ XdsApi::LdsUpdate lds_update) {
864
+ const std::string& cluster_name =
865
+ lds_update.rds_update.has_value()
866
+ ? lds_update.rds_update.value().cluster_name
867
+ : "";
868
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
869
+ gpr_log(GPR_INFO,
870
+ "[xds_client %p] LDS update received: "
871
+ "route_config_name=%s, "
872
+ "cluster_name=%s (empty if RDS is needed to obtain it)",
873
+ xds_client(), lds_update.route_config_name.c_str(),
874
+ cluster_name.c_str());
875
+ }
876
+ auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
877
+ auto& state = lds_state.subscribed_resources[xds_client()->server_name_];
878
+ if (state != nullptr) state->Finish();
879
+ // Ignore identical update.
880
+ if (xds_client()->route_config_name_ == lds_update.route_config_name &&
881
+ xds_client()->cluster_name_ == cluster_name) {
882
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
883
+ gpr_log(GPR_INFO,
884
+ "[xds_client %p] LDS update identical to current, ignoring.",
885
+ xds_client());
886
+ }
887
+ return;
888
+ }
889
+ xds_client()->route_config_name_ = std::move(lds_update.route_config_name);
890
+ if (lds_update.rds_update.has_value()) {
891
+ // If cluster_name was found inlined in LDS response, notify the watcher
892
+ // immediately.
893
+ xds_client()->cluster_name_ =
894
+ std::move(lds_update.rds_update.value().cluster_name);
895
+ RefCountedPtr<ServiceConfig> service_config;
896
+ grpc_error* error = xds_client()->CreateServiceConfig(
897
+ xds_client()->cluster_name_, &service_config);
898
+ if (error == GRPC_ERROR_NONE) {
899
+ xds_client()->service_config_watcher_->OnServiceConfigChanged(
900
+ std::move(service_config));
901
+ } else {
902
+ xds_client()->service_config_watcher_->OnError(error);
903
+ }
904
+ } else {
905
+ // Send RDS request for dynamic resolution.
906
+ Subscribe(XdsApi::kRdsTypeUrl, xds_client()->route_config_name_);
907
+ }
908
+ }
909
+
910
+ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
911
+ XdsApi::RdsUpdate rds_update) {
912
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
913
+ gpr_log(GPR_INFO,
914
+ "[xds_client %p] RDS update received: "
915
+ "cluster_name=%s",
916
+ xds_client(), rds_update.cluster_name.c_str());
917
+ }
918
+ auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
919
+ auto& state =
920
+ rds_state.subscribed_resources[xds_client()->route_config_name_];
921
+ if (state != nullptr) state->Finish();
922
+ // Ignore identical update.
923
+ if (xds_client()->cluster_name_ == rds_update.cluster_name) {
924
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
925
+ gpr_log(GPR_INFO,
926
+ "[xds_client %p] RDS update identical to current, ignoring.",
927
+ xds_client());
928
+ }
929
+ return;
930
+ }
931
+ xds_client()->cluster_name_ = std::move(rds_update.cluster_name);
932
+ // Notify the watcher.
933
+ RefCountedPtr<ServiceConfig> service_config;
934
+ grpc_error* error = xds_client()->CreateServiceConfig(
935
+ xds_client()->cluster_name_, &service_config);
936
+ if (error == GRPC_ERROR_NONE) {
937
+ xds_client()->service_config_watcher_->OnServiceConfigChanged(
938
+ std::move(service_config));
939
+ } else {
940
+ xds_client()->service_config_watcher_->OnError(error);
941
+ }
942
+ }
943
+
734
944
  void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
735
- CdsUpdateMap cds_update_map, std::string new_version) {
945
+ XdsApi::CdsUpdateMap cds_update_map) {
946
+ auto& cds_state = state_map_[XdsApi::kCdsTypeUrl];
736
947
  for (auto& p : cds_update_map) {
737
948
  const char* cluster_name = p.first.c_str();
738
- CdsUpdate& cds_update = p.second;
949
+ XdsApi::CdsUpdate& cds_update = p.second;
950
+ auto& state = cds_state.subscribed_resources[cluster_name];
951
+ if (state != nullptr) state->Finish();
739
952
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
740
953
  gpr_log(GPR_INFO,
741
954
  "[xds_client %p] CDS update (cluster=%s) received: "
@@ -762,20 +975,22 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
762
975
  continue;
763
976
  }
764
977
  // Update the cluster state.
765
- cluster_state.update.set(std::move(cds_update));
978
+ cluster_state.update.emplace(std::move(cds_update));
766
979
  // Notify all watchers.
767
980
  for (const auto& p : cluster_state.watchers) {
768
981
  p.first->OnClusterChanged(cluster_state.update.value());
769
982
  }
770
983
  }
771
- cds_version_.version_info = std::move(new_version);
772
984
  }
773
985
 
774
986
  void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
775
- EdsUpdateMap eds_update_map, std::string new_version) {
987
+ XdsApi::EdsUpdateMap eds_update_map) {
988
+ auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
776
989
  for (auto& p : eds_update_map) {
777
990
  const char* eds_service_name = p.first.c_str();
778
- EdsUpdate& eds_update = p.second;
991
+ XdsApi::EdsUpdate& eds_update = p.second;
992
+ auto& state = eds_state.subscribed_resources[eds_service_name];
993
+ if (state != nullptr) state->Finish();
779
994
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
780
995
  gpr_log(GPR_INFO,
781
996
  "[xds_client %p] EDS response with %" PRIuPTR
@@ -797,9 +1012,9 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
797
1012
  const auto& locality = p.second;
798
1013
  gpr_log(GPR_INFO,
799
1014
  "[xds_client %p] Priority %" PRIuPTR ", locality %" PRIuPTR
800
- " %s contains %" PRIuPTR " server addresses",
1015
+ " %s has weight %d, contains %" PRIuPTR " server addresses",
801
1016
  xds_client(), priority, locality_count,
802
- locality.name->AsHumanReadableString(),
1017
+ locality.name->AsHumanReadableString(), locality.lb_weight,
803
1018
  locality.serverlist.size());
804
1019
  for (size_t i = 0; i < locality.serverlist.size(); ++i) {
805
1020
  char* ipport;
@@ -817,7 +1032,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
817
1032
  }
818
1033
  for (size_t i = 0;
819
1034
  i < eds_update.drop_config->drop_category_list().size(); ++i) {
820
- const XdsDropConfig::DropCategory& drop_category =
1035
+ const XdsApi::DropConfig::DropCategory& drop_category =
821
1036
  eds_update.drop_config->drop_category_list()[i];
822
1037
  gpr_log(GPR_INFO,
823
1038
  "[xds_client %p] Drop category %s has drop rate %d per million",
@@ -828,7 +1043,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
828
1043
  EndpointState& endpoint_state =
829
1044
  xds_client()->endpoint_map_[eds_service_name];
830
1045
  // Ignore identical update.
831
- const EdsUpdate& prev_update = endpoint_state.update;
1046
+ const XdsApi::EdsUpdate& prev_update = endpoint_state.update;
832
1047
  const bool priority_list_changed =
833
1048
  prev_update.priority_list_update != eds_update.priority_list_update;
834
1049
  const bool drop_config_changed =
@@ -849,7 +1064,6 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
849
1064
  p.first->OnEndpointChanged(endpoint_state.update);
850
1065
  }
851
1066
  }
852
- eds_version_.version_info = std::move(new_version);
853
1067
  }
854
1068
 
855
1069
  void XdsClient::ChannelState::AdsCallState::OnRequestSent(void* arg,
@@ -870,22 +1084,17 @@ void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
870
1084
  self->send_message_payload_ = nullptr;
871
1085
  // Continue to send another pending message if any.
872
1086
  // TODO(roth): The current code to handle buffered messages has the
873
- // advantage of sending only the most recent list of resource names for each
874
- // resource type (no matter how many times that resource type has been
875
- // requested to send while the current message sending is still pending).
876
- // But its disadvantage is that we send the requests in fixed order of
877
- // resource types. We need to fix this if we are seeing some resource
878
- // type(s) starved due to frequent requests of other resource type(s).
879
- for (auto& p : self->buffered_request_map_) {
880
- const std::string& type_url = p.first;
881
- std::unique_ptr<BufferedRequest>& buffered_request = p.second;
882
- if (buffered_request != nullptr) {
883
- self->SendMessageLocked(type_url, buffered_request->nonce,
884
- buffered_request->error, false);
885
- buffered_request->error = GRPC_ERROR_NONE;
886
- buffered_request.reset();
887
- break;
888
- }
1087
+ // advantage of sending only the most recent list of resource names for
1088
+ // each resource type (no matter how many times that resource type has
1089
+ // been requested to send while the current message sending is still
1090
+ // pending). But its disadvantage is that we send the requests in fixed
1091
+ // order of resource types. We need to fix this if we are seeing some
1092
+ // resource type(s) starved due to frequent requests of other resource
1093
+ // type(s).
1094
+ auto it = self->buffered_requests_.begin();
1095
+ if (it != self->buffered_requests_.end()) {
1096
+ self->SendMessageLocked(*it);
1097
+ self->buffered_requests_.erase(it);
889
1098
  }
890
1099
  }
891
1100
  self->Unref(DEBUG_LOCATION, "ADS+OnRequestSentLocked");
@@ -926,15 +1135,18 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
926
1135
  // mode. We will also need to cancel the timer when we receive a serverlist
927
1136
  // from the balancer.
928
1137
  // Parse the response.
929
- CdsUpdateMap cds_update_map;
930
- EdsUpdateMap eds_update_map;
1138
+ XdsApi::LdsUpdate lds_update;
1139
+ XdsApi::RdsUpdate rds_update;
1140
+ XdsApi::CdsUpdateMap cds_update_map;
1141
+ XdsApi::EdsUpdateMap eds_update_map;
931
1142
  std::string version;
932
1143
  std::string nonce;
933
1144
  std::string type_url;
934
- // Note that XdsAdsResponseDecodeAndParse() also validate the response.
935
- grpc_error* parse_error = XdsAdsResponseDecodeAndParse(
936
- response_slice, xds_client->EdsServiceNames(), &cds_update_map,
937
- &eds_update_map, &version, &nonce, &type_url);
1145
+ // Note that ParseAdsResponse() also validates the response.
1146
+ grpc_error* parse_error = xds_client->api_.ParseAdsResponse(
1147
+ response_slice, xds_client->server_name_, xds_client->route_config_name_,
1148
+ ads_calld->EdsServiceNamesForRequest(), &lds_update, &rds_update,
1149
+ &cds_update_map, &eds_update_map, &version, &nonce, &type_url);
938
1150
  grpc_slice_unref_internal(response_slice);
939
1151
  if (type_url.empty()) {
940
1152
  // Ignore unparsable response.
@@ -942,36 +1154,34 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
942
1154
  xds_client, grpc_error_string(parse_error));
943
1155
  GRPC_ERROR_UNREF(parse_error);
944
1156
  } else {
945
- // Update nonce and error.
946
- if (type_url == kCdsTypeUrl) {
947
- ads_calld->cds_version_.nonce = nonce;
948
- GRPC_ERROR_UNREF(ads_calld->cds_version_.error);
949
- ads_calld->cds_version_.error = GRPC_ERROR_REF(parse_error);
950
- } else if (type_url == kEdsTypeUrl) {
951
- ads_calld->eds_version_.nonce = nonce;
952
- GRPC_ERROR_UNREF(ads_calld->eds_version_.error);
953
- ads_calld->eds_version_.error = GRPC_ERROR_REF(parse_error);
954
- }
1157
+ // Update nonce.
1158
+ auto& state = ads_calld->state_map_[type_url];
1159
+ state.nonce = std::move(nonce);
955
1160
  // NACK or ACK the response.
956
1161
  if (parse_error != GRPC_ERROR_NONE) {
1162
+ GRPC_ERROR_UNREF(state.error);
1163
+ state.error = parse_error;
957
1164
  // NACK unacceptable update.
958
1165
  gpr_log(
959
1166
  GPR_ERROR,
960
1167
  "[xds_client %p] ADS response can't be accepted, NACKing. error=%s",
961
1168
  xds_client, grpc_error_string(parse_error));
962
- ads_calld->SendMessageLocked(type_url, nonce, parse_error, false);
1169
+ ads_calld->SendMessageLocked(type_url);
963
1170
  } else {
964
1171
  ads_calld->seen_response_ = true;
965
- // Accept the (CDS or EDS) response.
966
- if (type_url == kCdsTypeUrl) {
967
- ads_calld->AcceptCdsUpdate(std::move(cds_update_map),
968
- std::move(version));
969
- } else if (type_url == kEdsTypeUrl) {
970
- ads_calld->AcceptEdsUpdate(std::move(eds_update_map),
971
- std::move(version));
1172
+ // Accept the ADS response according to the type_url.
1173
+ if (type_url == XdsApi::kLdsTypeUrl) {
1174
+ ads_calld->AcceptLdsUpdate(std::move(lds_update));
1175
+ } else if (type_url == XdsApi::kRdsTypeUrl) {
1176
+ ads_calld->AcceptRdsUpdate(std::move(rds_update));
1177
+ } else if (type_url == XdsApi::kCdsTypeUrl) {
1178
+ ads_calld->AcceptCdsUpdate(std::move(cds_update_map));
1179
+ } else if (type_url == XdsApi::kEdsTypeUrl) {
1180
+ ads_calld->AcceptEdsUpdate(std::move(eds_update_map));
972
1181
  }
1182
+ state.version = std::move(version);
973
1183
  // ACK the update.
974
- ads_calld->SendMessageLocked(type_url, "", nullptr, false);
1184
+ ads_calld->SendMessageLocked(type_url);
975
1185
  // Start load reporting if needed.
976
1186
  auto& lrs_call = ads_calld->chand()->lrs_calld_;
977
1187
  if (lrs_call != nullptr) {
@@ -1042,6 +1252,28 @@ bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
1042
1252
  return this == chand()->ads_calld_->calld();
1043
1253
  }
1044
1254
 
1255
+ std::set<StringView>
1256
+ XdsClient::ChannelState::AdsCallState::ClusterNamesForRequest() {
1257
+ std::set<StringView> cluster_names;
1258
+ for (auto& p : state_map_[XdsApi::kCdsTypeUrl].subscribed_resources) {
1259
+ cluster_names.insert(p.first);
1260
+ OrphanablePtr<ResourceState>& state = p.second;
1261
+ state->Start(Ref());
1262
+ }
1263
+ return cluster_names;
1264
+ }
1265
+
1266
+ std::set<StringView>
1267
+ XdsClient::ChannelState::AdsCallState::EdsServiceNamesForRequest() {
1268
+ std::set<StringView> eds_names;
1269
+ for (auto& p : state_map_[XdsApi::kEdsTypeUrl].subscribed_resources) {
1270
+ eds_names.insert(p.first);
1271
+ OrphanablePtr<ResourceState>& state = p.second;
1272
+ state->Start(Ref());
1273
+ }
1274
+ return eds_names;
1275
+ }
1276
+
1045
1277
  //
1046
1278
  // XdsClient::ChannelState::LrsCallState::Reporter
1047
1279
  //
@@ -1082,19 +1314,39 @@ void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimerLocked(
1082
1314
  self->SendReportLocked();
1083
1315
  }
1084
1316
 
1317
+ namespace {
1318
+
1319
+ bool LoadReportCountersAreZero(const XdsApi::ClusterLoadReportMap& snapshot) {
1320
+ for (const auto& p : snapshot) {
1321
+ const XdsApi::ClusterLoadReport& cluster_snapshot = p.second;
1322
+ for (const auto& q : cluster_snapshot.dropped_requests) {
1323
+ if (q.second > 0) return false;
1324
+ }
1325
+ for (const auto& q : cluster_snapshot.locality_stats) {
1326
+ const XdsClusterLocalityStats::Snapshot& locality_snapshot = q.second;
1327
+ if (!locality_snapshot.IsZero()) return false;
1328
+ }
1329
+ }
1330
+ return true;
1331
+ }
1332
+
1333
+ } // namespace
1334
+
1085
1335
  void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
1086
- // Create a request that contains the load report.
1087
- grpc_slice request_payload_slice =
1088
- XdsLrsRequestCreateAndEncode(xds_client()->ClientStatsMap());
1336
+ // Construct snapshot from all reported stats.
1337
+ XdsApi::ClusterLoadReportMap snapshot =
1338
+ xds_client()->BuildLoadReportSnapshot();
1089
1339
  // Skip client load report if the counters were all zero in the last
1090
1340
  // report and they are still zero in this one.
1091
1341
  const bool old_val = last_report_counters_were_zero_;
1092
- last_report_counters_were_zero_ = static_cast<bool>(
1093
- grpc_slice_eq(request_payload_slice, grpc_empty_slice()));
1342
+ last_report_counters_were_zero_ = LoadReportCountersAreZero(snapshot);
1094
1343
  if (old_val && last_report_counters_were_zero_) {
1095
1344
  ScheduleNextReportLocked();
1096
1345
  return;
1097
1346
  }
1347
+ // Create a request that contains the snapshot.
1348
+ grpc_slice request_payload_slice =
1349
+ xds_client()->api_.CreateLrsRequest(std::move(snapshot));
1098
1350
  parent_->send_message_payload_ =
1099
1351
  grpc_raw_byte_buffer_create(&request_payload_slice, 1);
1100
1352
  grpc_slice_unref_internal(request_payload_slice);
@@ -1161,9 +1413,8 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
1161
1413
  nullptr, GRPC_MILLIS_INF_FUTURE, nullptr);
1162
1414
  GPR_ASSERT(call_ != nullptr);
1163
1415
  // Init the request payload.
1164
- grpc_slice request_payload_slice = XdsLrsRequestCreateAndEncode(
1165
- xds_client()->server_name_, xds_client()->bootstrap_->node(),
1166
- xds_client()->build_version_.get());
1416
+ grpc_slice request_payload_slice =
1417
+ xds_client()->api_.CreateLrsInitialRequest(xds_client()->server_name_);
1167
1418
  send_message_payload_ =
1168
1419
  grpc_raw_byte_buffer_create(&request_payload_slice, 1);
1169
1420
  grpc_slice_unref_internal(request_payload_slice);
@@ -1276,11 +1527,6 @@ void XdsClient::ChannelState::LrsCallState::MaybeStartReportingLocked() {
1276
1527
  AdsCallState* ads_calld = chand()->ads_calld_->calld();
1277
1528
  if (ads_calld == nullptr || !ads_calld->seen_response()) return;
1278
1529
  // Start reporting.
1279
- for (auto& p : chand()->xds_client_->endpoint_map_) {
1280
- for (auto* client_stats : p.second.client_stats) {
1281
- client_stats->MaybeInitLastReportTime();
1282
- }
1283
- }
1284
1530
  reporter_ = MakeOrphanable<Reporter>(
1285
1531
  Ref(DEBUG_LOCATION, "LRS+load_report+start"), load_reporting_interval_);
1286
1532
  }
@@ -1342,7 +1588,7 @@ void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked(
1342
1588
  // Parse the response.
1343
1589
  std::set<std::string> new_cluster_names;
1344
1590
  grpc_millis new_load_reporting_interval;
1345
- grpc_error* parse_error = XdsLrsResponseDecodeAndParse(
1591
+ grpc_error* parse_error = xds_client->api_.ParseLrsResponse(
1346
1592
  response_slice, &new_cluster_names, &new_load_reporting_interval);
1347
1593
  if (parse_error != GRPC_ERROR_NONE) {
1348
1594
  gpr_log(GPR_ERROR,
@@ -1462,11 +1708,10 @@ bool XdsClient::ChannelState::LrsCallState::IsCurrentCallOnChannel() const {
1462
1708
 
1463
1709
  namespace {
1464
1710
 
1465
- grpc_core::UniquePtr<char> GenerateBuildVersionString() {
1466
- char* build_version_str;
1467
- gpr_asprintf(&build_version_str, "gRPC C-core %s %s", grpc_version_string(),
1468
- GPR_PLATFORM_STRING);
1469
- return grpc_core::UniquePtr<char>(build_version_str);
1711
+ grpc_millis GetRequestTimeout(const grpc_channel_args& args) {
1712
+ return grpc_channel_args_find_integer(
1713
+ &args, GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS,
1714
+ {15000, 0, INT_MAX});
1470
1715
  }
1471
1716
 
1472
1717
  } // namespace
@@ -1476,31 +1721,34 @@ XdsClient::XdsClient(Combiner* combiner, grpc_pollset_set* interested_parties,
1476
1721
  std::unique_ptr<ServiceConfigWatcherInterface> watcher,
1477
1722
  const grpc_channel_args& channel_args, grpc_error** error)
1478
1723
  : InternallyRefCounted<XdsClient>(&grpc_xds_client_trace),
1479
- build_version_(GenerateBuildVersionString()),
1724
+ request_timeout_(GetRequestTimeout(channel_args)),
1480
1725
  combiner_(GRPC_COMBINER_REF(combiner, "xds_client")),
1481
1726
  interested_parties_(interested_parties),
1482
1727
  bootstrap_(XdsBootstrap::ReadFromFile(error)),
1728
+ api_(bootstrap_ == nullptr ? nullptr : bootstrap_->node()),
1483
1729
  server_name_(server_name),
1484
1730
  service_config_watcher_(std::move(watcher)) {
1485
1731
  if (*error != GRPC_ERROR_NONE) {
1486
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1487
- gpr_log(GPR_INFO, "[xds_client %p: failed to read bootstrap file: %s",
1488
- this, grpc_error_string(*error));
1489
- }
1732
+ gpr_log(GPR_ERROR, "[xds_client %p] failed to read bootstrap file: %s",
1733
+ this, grpc_error_string(*error));
1490
1734
  return;
1491
1735
  }
1492
1736
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1493
- gpr_log(GPR_INFO, "[xds_client %p: creating channel to %s", this,
1494
- bootstrap_->server().server_uri);
1737
+ gpr_log(GPR_INFO, "[xds_client %p] creating channel to %s", this,
1738
+ bootstrap_->server().server_uri.c_str());
1739
+ }
1740
+ grpc_channel_args* new_args = BuildXdsChannelArgs(channel_args);
1741
+ grpc_channel* channel = CreateXdsChannel(*bootstrap_, *new_args, error);
1742
+ grpc_channel_args_destroy(new_args);
1743
+ if (*error != GRPC_ERROR_NONE) {
1744
+ gpr_log(GPR_ERROR, "[xds_client %p] failed to create xds channel: %s", this,
1745
+ grpc_error_string(*error));
1746
+ return;
1495
1747
  }
1496
1748
  chand_ = MakeOrphanable<ChannelState>(
1497
- Ref(DEBUG_LOCATION, "XdsClient+ChannelState"), channel_args);
1749
+ Ref(DEBUG_LOCATION, "XdsClient+ChannelState"), channel);
1498
1750
  if (service_config_watcher_ != nullptr) {
1499
- // TODO(juanlishen): Start LDS call and do not return service config
1500
- // until we get the first LDS response.
1501
- GRPC_CLOSURE_INIT(&service_config_notify_, NotifyOnServiceConfig,
1502
- Ref().release(), nullptr);
1503
- combiner_->Run(&service_config_notify_, GRPC_ERROR_NONE);
1751
+ chand_->Subscribe(XdsApi::kLdsTypeUrl, std::string(server_name));
1504
1752
  }
1505
1753
  }
1506
1754
 
@@ -1509,15 +1757,23 @@ XdsClient::~XdsClient() { GRPC_COMBINER_UNREF(combiner_, "xds_client"); }
1509
1757
  void XdsClient::Orphan() {
1510
1758
  shutting_down_ = true;
1511
1759
  chand_.reset();
1512
- cluster_map_.clear();
1513
- endpoint_map_.clear();
1760
+ // We do not clear cluster_map_ and endpoint_map_ if the xds client was
1761
+ // created by the XdsResolver because the maps contain refs for watchers which
1762
+ // in turn hold refs to the loadbalancing policies. At this point, it is
1763
+ // possible for ADS calls to be in progress. Unreffing the loadbalancing
1764
+ // policies before those calls are done would lead to issues such as
1765
+ // https://github.com/grpc/grpc/issues/20928.
1766
+ if (service_config_watcher_ != nullptr) {
1767
+ cluster_map_.clear();
1768
+ endpoint_map_.clear();
1769
+ }
1514
1770
  Unref(DEBUG_LOCATION, "XdsClient::Orphan()");
1515
1771
  }
1516
1772
 
1517
1773
  void XdsClient::WatchClusterData(
1518
1774
  StringView cluster_name, std::unique_ptr<ClusterWatcherInterface> watcher) {
1519
- const bool new_name = cluster_map_.find(cluster_name) == cluster_map_.end();
1520
- ClusterState& cluster_state = cluster_map_[cluster_name];
1775
+ std::string cluster_name_str = std::string(cluster_name);
1776
+ ClusterState& cluster_state = cluster_map_[cluster_name_str];
1521
1777
  ClusterWatcherInterface* w = watcher.get();
1522
1778
  cluster_state.watchers[w] = std::move(watcher);
1523
1779
  // If we've already received an CDS update, notify the new watcher
@@ -1525,30 +1781,29 @@ void XdsClient::WatchClusterData(
1525
1781
  if (cluster_state.update.has_value()) {
1526
1782
  w->OnClusterChanged(cluster_state.update.value());
1527
1783
  }
1528
- if (new_name) chand_->OnResourceNamesChanged(kCdsTypeUrl);
1784
+ chand_->Subscribe(XdsApi::kCdsTypeUrl, cluster_name_str);
1529
1785
  }
1530
1786
 
1531
1787
  void XdsClient::CancelClusterDataWatch(StringView cluster_name,
1532
1788
  ClusterWatcherInterface* watcher) {
1533
1789
  if (shutting_down_) return;
1534
- ClusterState& cluster_state = cluster_map_[cluster_name];
1790
+ std::string cluster_name_str = std::string(cluster_name);
1791
+ ClusterState& cluster_state = cluster_map_[cluster_name_str];
1535
1792
  auto it = cluster_state.watchers.find(watcher);
1536
1793
  if (it != cluster_state.watchers.end()) {
1537
1794
  cluster_state.watchers.erase(it);
1538
1795
  if (cluster_state.watchers.empty()) {
1539
- cluster_map_.erase(cluster_name);
1540
- chand_->OnResourceNamesChanged(kCdsTypeUrl);
1796
+ cluster_map_.erase(cluster_name_str);
1797
+ chand_->Unsubscribe(XdsApi::kCdsTypeUrl, cluster_name_str);
1541
1798
  }
1542
1799
  }
1543
- chand_->OnWatcherRemoved();
1544
1800
  }
1545
1801
 
1546
1802
  void XdsClient::WatchEndpointData(
1547
1803
  StringView eds_service_name,
1548
1804
  std::unique_ptr<EndpointWatcherInterface> watcher) {
1549
- const bool new_name =
1550
- endpoint_map_.find(eds_service_name) == endpoint_map_.end();
1551
- EndpointState& endpoint_state = endpoint_map_[eds_service_name];
1805
+ std::string eds_service_name_str = std::string(eds_service_name);
1806
+ EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
1552
1807
  EndpointWatcherInterface* w = watcher.get();
1553
1808
  endpoint_state.watchers[w] = std::move(watcher);
1554
1809
  // If we've already received an EDS update, notify the new watcher
@@ -1556,90 +1811,178 @@ void XdsClient::WatchEndpointData(
1556
1811
  if (!endpoint_state.update.priority_list_update.empty()) {
1557
1812
  w->OnEndpointChanged(endpoint_state.update);
1558
1813
  }
1559
- if (new_name) chand_->OnResourceNamesChanged(kEdsTypeUrl);
1814
+ chand_->Subscribe(XdsApi::kEdsTypeUrl, eds_service_name_str);
1560
1815
  }
1561
1816
 
1562
1817
  void XdsClient::CancelEndpointDataWatch(StringView eds_service_name,
1563
1818
  EndpointWatcherInterface* watcher) {
1564
1819
  if (shutting_down_) return;
1565
- EndpointState& endpoint_state = endpoint_map_[eds_service_name];
1820
+ std::string eds_service_name_str = std::string(eds_service_name);
1821
+ EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
1566
1822
  auto it = endpoint_state.watchers.find(watcher);
1567
1823
  if (it != endpoint_state.watchers.end()) {
1568
1824
  endpoint_state.watchers.erase(it);
1569
1825
  if (endpoint_state.watchers.empty()) {
1570
- endpoint_map_.erase(eds_service_name);
1571
- chand_->OnResourceNamesChanged(kEdsTypeUrl);
1826
+ endpoint_map_.erase(eds_service_name_str);
1827
+ chand_->Unsubscribe(XdsApi::kEdsTypeUrl, eds_service_name_str);
1572
1828
  }
1573
1829
  }
1574
- chand_->OnWatcherRemoved();
1575
1830
  }
1576
1831
 
1577
- void XdsClient::AddClientStats(StringView /*lrs_server*/,
1578
- StringView cluster_name,
1579
- XdsClientStats* client_stats) {
1580
- EndpointState& endpoint_state = endpoint_map_[cluster_name];
1832
+ RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
1833
+ StringView lrs_server, StringView cluster_name,
1834
+ StringView eds_service_name) {
1581
1835
  // TODO(roth): When we add support for direct federation, use the
1582
1836
  // server name specified in lrs_server.
1583
- endpoint_state.client_stats.insert(client_stats);
1837
+ auto key =
1838
+ std::make_pair(std::string(cluster_name), std::string(eds_service_name));
1839
+ // We jump through some hoops here to make sure that the StringViews
1840
+ // stored in the XdsClusterDropStats object point to the strings
1841
+ // in the load_report_map_ key, so that they have the same lifetime.
1842
+ auto it = load_report_map_
1843
+ .emplace(std::make_pair(std::move(key), LoadReportState()))
1844
+ .first;
1845
+ auto cluster_drop_stats = MakeRefCounted<XdsClusterDropStats>(
1846
+ Ref(DEBUG_LOCATION, "DropStats"), lrs_server,
1847
+ it->first.first /*cluster_name*/, it->first.second /*eds_service_name*/);
1848
+ it->second.drop_stats.insert(cluster_drop_stats.get());
1584
1849
  chand_->MaybeStartLrsCall();
1850
+ return cluster_drop_stats;
1585
1851
  }
1586
1852
 
1587
- void XdsClient::RemoveClientStats(StringView /*lrs_server*/,
1588
- StringView cluster_name,
1589
- XdsClientStats* client_stats) {
1590
- EndpointState& endpoint_state = endpoint_map_[cluster_name];
1853
+ void XdsClient::RemoveClusterDropStats(
1854
+ StringView /*lrs_server*/, StringView cluster_name,
1855
+ StringView eds_service_name, XdsClusterDropStats* cluster_drop_stats) {
1856
+ auto load_report_it = load_report_map_.find(
1857
+ std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
1858
+ if (load_report_it == load_report_map_.end()) return;
1859
+ LoadReportState& load_report_state = load_report_it->second;
1591
1860
  // TODO(roth): When we add support for direct federation, use the
1592
1861
  // server name specified in lrs_server.
1593
1862
  // TODO(roth): In principle, we should try to send a final load report
1594
1863
  // containing whatever final stats have been accumulated since the
1595
1864
  // last load report.
1596
- auto it = endpoint_state.client_stats.find(client_stats);
1597
- if (it != endpoint_state.client_stats.end()) {
1598
- endpoint_state.client_stats.erase(it);
1599
- }
1600
- if (chand_ != nullptr && endpoint_state.client_stats.empty()) {
1601
- chand_->StopLrsCall();
1865
+ auto it = load_report_state.drop_stats.find(cluster_drop_stats);
1866
+ if (it != load_report_state.drop_stats.end()) {
1867
+ load_report_state.drop_stats.erase(it);
1868
+ if (load_report_state.drop_stats.empty() &&
1869
+ load_report_state.locality_stats.empty()) {
1870
+ load_report_map_.erase(load_report_it);
1871
+ if (chand_ != nullptr && load_report_map_.empty()) {
1872
+ chand_->StopLrsCall();
1873
+ }
1874
+ }
1602
1875
  }
1603
1876
  }
1604
1877
 
1605
- void XdsClient::ResetBackoff() {
1606
- if (chand_ != nullptr) {
1607
- grpc_channel_reset_connect_backoff(chand_->channel());
1608
- }
1878
+ RefCountedPtr<XdsClusterLocalityStats> XdsClient::AddClusterLocalityStats(
1879
+ StringView lrs_server, StringView cluster_name, StringView eds_service_name,
1880
+ RefCountedPtr<XdsLocalityName> locality) {
1881
+ // TODO(roth): When we add support for direct federation, use the
1882
+ // server name specified in lrs_server.
1883
+ auto key =
1884
+ std::make_pair(std::string(cluster_name), std::string(eds_service_name));
1885
+ // We jump through some hoops here to make sure that the StringViews
1886
+ // stored in the XdsClusterLocalityStats object point to the strings
1887
+ // in the load_report_map_ key, so that they have the same lifetime.
1888
+ auto it = load_report_map_
1889
+ .emplace(std::make_pair(std::move(key), LoadReportState()))
1890
+ .first;
1891
+ auto cluster_locality_stats = MakeRefCounted<XdsClusterLocalityStats>(
1892
+ Ref(DEBUG_LOCATION, "LocalityStats"), lrs_server,
1893
+ it->first.first /*cluster_name*/, it->first.second /*eds_service_name*/,
1894
+ locality);
1895
+ it->second.locality_stats[std::move(locality)].insert(
1896
+ cluster_locality_stats.get());
1897
+ chand_->MaybeStartLrsCall();
1898
+ return cluster_locality_stats;
1609
1899
  }
1610
1900
 
1611
- std::set<StringView> XdsClient::WatchedClusterNames() const {
1612
- std::set<StringView> cluster_names;
1613
- for (const auto& p : cluster_map_) {
1614
- const StringView& cluster_name = p.first;
1615
- const ClusterState& cluster_state = p.second;
1616
- // Don't request for the clusters that are cached before watched.
1617
- if (cluster_state.watchers.empty()) continue;
1618
- cluster_names.emplace(cluster_name);
1901
+ void XdsClient::RemoveClusterLocalityStats(
1902
+ StringView /*lrs_server*/, StringView cluster_name,
1903
+ StringView eds_service_name, const RefCountedPtr<XdsLocalityName>& locality,
1904
+ XdsClusterLocalityStats* cluster_locality_stats) {
1905
+ auto load_report_it = load_report_map_.find(
1906
+ std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
1907
+ if (load_report_it == load_report_map_.end()) return;
1908
+ LoadReportState& load_report_state = load_report_it->second;
1909
+ // TODO(roth): When we add support for direct federation, use the
1910
+ // server name specified in lrs_server.
1911
+ // TODO(roth): In principle, we should try to send a final load report
1912
+ // containing whatever final stats have been accumulated since the
1913
+ // last load report.
1914
+ auto locality_it = load_report_state.locality_stats.find(locality);
1915
+ if (locality_it == load_report_state.locality_stats.end()) return;
1916
+ auto& locality_set = locality_it->second;
1917
+ auto it = locality_set.find(cluster_locality_stats);
1918
+ if (it != locality_set.end()) {
1919
+ locality_set.erase(it);
1920
+ if (locality_set.empty()) {
1921
+ load_report_state.locality_stats.erase(locality_it);
1922
+ if (load_report_state.locality_stats.empty() &&
1923
+ load_report_state.drop_stats.empty()) {
1924
+ load_report_map_.erase(load_report_it);
1925
+ if (chand_ != nullptr && load_report_map_.empty()) {
1926
+ chand_->StopLrsCall();
1927
+ }
1928
+ }
1929
+ }
1619
1930
  }
1620
- return cluster_names;
1621
1931
  }
1622
1932
 
1623
- std::set<StringView> XdsClient::EdsServiceNames() const {
1624
- std::set<StringView> eds_service_names;
1625
- for (const auto& p : endpoint_map_) {
1626
- const StringView& eds_service_name = p.first;
1627
- eds_service_names.emplace(eds_service_name);
1933
+ void XdsClient::ResetBackoff() {
1934
+ if (chand_ != nullptr) {
1935
+ grpc_channel_reset_connect_backoff(chand_->channel());
1628
1936
  }
1629
- return eds_service_names;
1630
1937
  }
1631
1938
 
1632
- std::map<StringView, std::set<XdsClientStats*>> XdsClient::ClientStatsMap()
1633
- const {
1634
- std::map<StringView, std::set<XdsClientStats*>> client_stats_map;
1635
- for (const auto& p : endpoint_map_) {
1636
- const StringView& cluster_name = p.first;
1637
- const auto& client_stats = p.second.client_stats;
1638
- if (chand_->lrs_calld()->ShouldSendLoadReports(cluster_name)) {
1639
- client_stats_map.emplace(cluster_name, client_stats);
1939
+ grpc_error* XdsClient::CreateServiceConfig(
1940
+ const std::string& cluster_name,
1941
+ RefCountedPtr<ServiceConfig>* service_config) const {
1942
+ char* json;
1943
+ gpr_asprintf(&json,
1944
+ "{\n"
1945
+ " \"loadBalancingConfig\":[\n"
1946
+ " { \"cds_experimental\":{\n"
1947
+ " \"cluster\": \"%s\"\n"
1948
+ " } }\n"
1949
+ " ]\n"
1950
+ "}",
1951
+ cluster_name.c_str());
1952
+ grpc_error* error = GRPC_ERROR_NONE;
1953
+ *service_config = ServiceConfig::Create(json, &error);
1954
+ gpr_free(json);
1955
+ return error;
1956
+ }
1957
+
1958
+ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot() {
1959
+ XdsApi::ClusterLoadReportMap snapshot_map;
1960
+ for (auto& p : load_report_map_) {
1961
+ const auto& cluster_key = p.first; // cluster and EDS service name
1962
+ LoadReportState& load_report = p.second;
1963
+ XdsApi::ClusterLoadReport& snapshot = snapshot_map[cluster_key];
1964
+ // Aggregate drop stats.
1965
+ for (auto& drop_stats : load_report.drop_stats) {
1966
+ for (const auto& p : drop_stats->GetSnapshotAndReset()) {
1967
+ snapshot.dropped_requests[p.first] += p.second;
1968
+ }
1969
+ }
1970
+ // Aggregate locality stats.
1971
+ for (auto& p : load_report.locality_stats) {
1972
+ XdsLocalityName* locality_name = p.first.get();
1973
+ auto& locality_stats_set = p.second;
1974
+ XdsClusterLocalityStats::Snapshot& locality_snapshot =
1975
+ snapshot.locality_stats[locality_name];
1976
+ for (auto& locality_stats : locality_stats_set) {
1977
+ locality_snapshot += locality_stats->GetSnapshotAndReset();
1978
+ }
1640
1979
  }
1980
+ // Compute load report interval.
1981
+ const grpc_millis now = ExecCtx::Get()->Now();
1982
+ snapshot.load_report_interval = now - load_report.last_report_time;
1983
+ load_report.last_report_time = now;
1641
1984
  }
1642
- return client_stats_map;
1985
+ return snapshot_map;
1643
1986
  }
1644
1987
 
1645
1988
  void XdsClient::NotifyOnError(grpc_error* error) {
@@ -1661,41 +2004,15 @@ void XdsClient::NotifyOnError(grpc_error* error) {
1661
2004
  GRPC_ERROR_UNREF(error);
1662
2005
  }
1663
2006
 
1664
- void XdsClient::NotifyOnServiceConfig(void* arg, grpc_error* error) {
1665
- XdsClient* self = static_cast<XdsClient*>(arg);
1666
- // TODO(roth): When we add support for WeightedClusters, select the
1667
- // LB policy based on that functionality.
1668
- char* json;
1669
- gpr_asprintf(&json,
1670
- "{\n"
1671
- " \"loadBalancingConfig\":[\n"
1672
- " { \"cds_experimental\":{\n"
1673
- " \"cluster\": \"%s\"\n"
1674
- " } }\n"
1675
- " ]\n"
1676
- "}",
1677
- self->server_name_.c_str());
1678
- RefCountedPtr<ServiceConfig> service_config =
1679
- ServiceConfig::Create(json, &error);
1680
- gpr_free(json);
1681
- if (error != GRPC_ERROR_NONE) {
1682
- self->service_config_watcher_->OnError(error);
1683
- } else {
1684
- self->service_config_watcher_->OnServiceConfigChanged(
1685
- std::move(service_config));
1686
- }
1687
- self->Unref();
1688
- }
1689
-
1690
2007
  void* XdsClient::ChannelArgCopy(void* p) {
1691
2008
  XdsClient* xds_client = static_cast<XdsClient*>(p);
1692
- xds_client->Ref().release();
2009
+ xds_client->Ref(DEBUG_LOCATION, "channel arg").release();
1693
2010
  return p;
1694
2011
  }
1695
2012
 
1696
2013
  void XdsClient::ChannelArgDestroy(void* p) {
1697
2014
  XdsClient* xds_client = static_cast<XdsClient*>(p);
1698
- xds_client->Unref();
2015
+ xds_client->Unref(DEBUG_LOCATION, "channel arg");
1699
2016
  }
1700
2017
 
1701
2018
  int XdsClient::ChannelArgCmp(void* p, void* q) { return GPR_ICMP(p, q); }