grpc 1.31.1 → 1.32.0.pre1

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 (431) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +595 -15723
  3. data/include/grpc/grpc_security.h +31 -14
  4. data/include/grpc/impl/codegen/README.md +22 -0
  5. data/include/grpc/impl/codegen/port_platform.h +6 -1
  6. data/src/core/ext/filters/client_channel/backup_poller.cc +3 -2
  7. data/src/core/ext/filters/client_channel/client_channel.cc +64 -20
  8. data/src/core/ext/filters/client_channel/client_channel.h +1 -1
  9. data/src/core/ext/filters/client_channel/client_channel_channelz.h +0 -3
  10. data/src/core/ext/filters/client_channel/health/health_check_client.cc +6 -1
  11. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +2 -3
  12. data/src/core/ext/filters/client_channel/lb_policy.h +2 -0
  13. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
  14. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +20 -13
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -13
  16. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +0 -3
  17. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -37
  18. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +19 -13
  19. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +29 -10
  20. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +5 -4
  21. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +20 -9
  22. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +18 -12
  23. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +22 -14
  24. data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +18 -9
  25. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +54 -56
  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/c_ares/grpc_ares_wrapper_libuv.cc +1 -1
  28. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
  29. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +1 -1
  30. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -1
  31. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +363 -14
  32. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +0 -1
  33. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +5 -4
  34. data/src/core/ext/filters/client_channel/server_address.cc +40 -7
  35. data/src/core/ext/filters/client_channel/server_address.h +42 -4
  36. data/src/core/ext/filters/client_channel/subchannel.cc +64 -23
  37. data/src/core/ext/filters/client_channel/subchannel.h +16 -4
  38. data/src/core/ext/filters/max_age/max_age_filter.cc +2 -1
  39. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +87 -31
  40. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +18 -1
  41. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +10 -35
  42. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +19 -25
  43. data/src/core/ext/transport/chttp2/server/chttp2_server.h +2 -1
  44. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +2 -2
  45. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +6 -6
  46. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +3 -2
  47. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +239 -277
  48. data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -1
  49. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -2
  50. data/src/core/ext/transport/chttp2/transport/internal.h +5 -1
  51. data/src/core/ext/transport/chttp2/transport/parsing.cc +1 -28
  52. data/src/core/ext/transport/chttp2/transport/writing.cc +6 -5
  53. data/src/core/ext/transport/inproc/inproc_transport.cc +12 -12
  54. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +224 -0
  55. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +700 -0
  56. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +74 -0
  57. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +226 -0
  58. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +380 -0
  59. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +1378 -0
  60. data/src/core/ext/upb-generated/envoy/{api/v2/cluster → config/cluster/v3}/filter.upb.c +8 -8
  61. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +69 -0
  62. data/src/core/ext/upb-generated/envoy/{api/v2/cluster → config/cluster/v3}/outlier_detection.upb.c +8 -8
  63. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +323 -0
  64. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +112 -0
  65. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +334 -0
  66. data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/backoff.upb.c +8 -8
  67. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +79 -0
  68. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +309 -0
  69. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +869 -0
  70. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +96 -0
  71. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +328 -0
  72. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +34 -0
  73. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +71 -0
  74. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +195 -0
  75. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +634 -0
  76. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +170 -0
  77. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +684 -0
  78. data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/http_uri.upb.c +8 -8
  79. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +80 -0
  80. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +152 -0
  81. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +536 -0
  82. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +28 -0
  83. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +58 -0
  84. data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/socket_option.upb.c +6 -6
  85. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +88 -0
  86. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +91 -0
  87. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +220 -0
  88. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +91 -0
  89. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +273 -0
  90. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +112 -0
  91. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +332 -0
  92. data/src/core/ext/upb-generated/envoy/config/listener/{v2 → v3}/api_listener.upb.c +8 -8
  93. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +65 -0
  94. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +108 -0
  95. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +401 -0
  96. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +138 -0
  97. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +490 -0
  98. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +41 -0
  99. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +94 -0
  100. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +174 -0
  101. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +599 -0
  102. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +63 -0
  103. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +204 -0
  104. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +773 -0
  105. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +2855 -0
  106. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +59 -0
  107. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +135 -0
  108. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +50 -0
  109. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +108 -0
  110. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +312 -0
  111. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1125 -0
  112. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +20 -0
  113. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +34 -0
  114. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +111 -0
  115. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +401 -0
  116. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +72 -0
  117. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +198 -0
  118. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +105 -0
  119. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +388 -0
  120. data/src/core/ext/upb-generated/envoy/{api/v2 → service/cluster/v3}/cds.upb.c +5 -6
  121. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +49 -0
  122. data/src/core/ext/upb-generated/envoy/service/discovery/{v2 → v3}/ads.upb.c +5 -4
  123. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +49 -0
  124. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +129 -0
  125. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +386 -0
  126. data/src/core/ext/upb-generated/envoy/{api/v2 → service/endpoint/v3}/eds.upb.c +5 -6
  127. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +49 -0
  128. data/src/core/ext/upb-generated/envoy/{api/v2 → service/listener/v3}/lds.upb.c +5 -6
  129. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +49 -0
  130. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +55 -0
  131. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +136 -0
  132. data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/rds.upb.c +5 -6
  133. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +49 -0
  134. data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/srds.upb.c +5 -6
  135. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +49 -0
  136. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +47 -0
  137. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +114 -0
  138. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +35 -0
  139. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +77 -0
  140. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +34 -0
  141. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +71 -0
  142. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +64 -0
  143. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +145 -0
  144. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +53 -0
  145. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +127 -0
  146. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +63 -0
  147. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +188 -0
  148. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +88 -0
  149. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +258 -0
  150. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +90 -0
  151. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +250 -0
  152. data/src/core/ext/upb-generated/envoy/type/{http.upb.c → v3/http.upb.c} +2 -2
  153. data/src/core/ext/upb-generated/envoy/type/{http.upb.h → v3/http.upb.h} +8 -8
  154. data/src/core/ext/upb-generated/envoy/type/{percent.upb.c → v3/percent.upb.c} +9 -8
  155. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +86 -0
  156. data/src/core/ext/upb-generated/envoy/type/{range.upb.c → v3/range.upb.c} +12 -11
  157. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +111 -0
  158. data/src/core/ext/upb-generated/envoy/type/{semantic_version.upb.c → v3/semantic_version.upb.c} +6 -5
  159. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +61 -0
  160. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +234 -0
  161. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +759 -0
  162. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +36 -36
  163. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +1 -1
  164. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +27 -0
  165. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +53 -0
  166. data/src/core/ext/upb-generated/validate/validate.upb.c +11 -11
  167. data/src/core/ext/upb-generated/validate/validate.upb.h +1 -1
  168. data/src/core/ext/{filters/client_channel/xds → xds}/xds_api.cc +1045 -767
  169. data/src/core/ext/{filters/client_channel/xds → xds}/xds_api.h +114 -99
  170. data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.cc +44 -2
  171. data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.h +8 -3
  172. data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel.h +4 -4
  173. data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel_args.h +3 -3
  174. data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel_secure.cc +2 -5
  175. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.cc +85 -417
  176. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.h +12 -45
  177. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.cc +2 -2
  178. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.h +3 -3
  179. data/src/core/lib/channel/channelz.cc +14 -15
  180. data/src/core/lib/channel/channelz.h +1 -1
  181. data/src/core/lib/channel/channelz_registry.cc +3 -1
  182. data/src/core/lib/gpr/sync_posix.cc +2 -8
  183. data/src/core/lib/iomgr/endpoint.cc +5 -1
  184. data/src/core/lib/iomgr/endpoint.h +7 -3
  185. data/src/core/lib/iomgr/endpoint_cfstream.cc +32 -11
  186. data/src/core/lib/iomgr/ev_posix.cc +0 -2
  187. data/src/core/lib/iomgr/iomgr.cc +0 -10
  188. data/src/core/lib/iomgr/iomgr.h +0 -10
  189. data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.cc +1 -1
  190. data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.h +3 -3
  191. data/src/core/lib/iomgr/sockaddr_utils.cc +2 -1
  192. data/src/core/lib/iomgr/sockaddr_utils.h +2 -1
  193. data/src/core/lib/iomgr/tcp_custom.cc +32 -16
  194. data/src/core/lib/iomgr/tcp_posix.cc +31 -13
  195. data/src/core/lib/iomgr/tcp_windows.cc +26 -10
  196. data/src/core/lib/security/authorization/authorization_engine.cc +177 -0
  197. data/src/core/lib/security/authorization/authorization_engine.h +84 -0
  198. data/src/core/lib/security/authorization/evaluate_args.cc +153 -0
  199. data/src/core/lib/security/authorization/evaluate_args.h +59 -0
  200. data/src/core/lib/security/authorization/mock_cel/activation.h +57 -0
  201. data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +42 -0
  202. data/src/core/lib/security/authorization/mock_cel/cel_expression.h +68 -0
  203. data/src/core/lib/security/authorization/mock_cel/cel_value.h +93 -0
  204. data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +67 -0
  205. data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +56 -0
  206. data/src/core/lib/security/authorization/mock_cel/statusor.h +50 -0
  207. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +56 -38
  208. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -2
  209. data/src/core/lib/security/transport/secure_endpoint.cc +7 -1
  210. data/src/core/lib/surface/call.cc +12 -12
  211. data/src/core/lib/surface/call.h +2 -1
  212. data/src/core/lib/surface/channel.cc +28 -20
  213. data/src/core/lib/surface/channel.h +12 -2
  214. data/src/core/lib/surface/completion_queue.cc +10 -272
  215. data/src/core/lib/surface/completion_queue.h +0 -8
  216. data/src/core/lib/surface/init.cc +1 -3
  217. data/src/core/lib/surface/server.cc +1066 -1244
  218. data/src/core/lib/surface/server.h +363 -87
  219. data/src/core/lib/surface/version.cc +2 -2
  220. data/src/core/lib/transport/authority_override.cc +38 -0
  221. data/src/core/lib/transport/authority_override.h +32 -0
  222. data/src/core/lib/transport/connectivity_state.cc +18 -13
  223. data/src/core/lib/transport/connectivity_state.h +18 -6
  224. data/src/core/lib/transport/error_utils.cc +13 -0
  225. data/src/core/lib/transport/error_utils.h +6 -0
  226. data/src/core/lib/transport/static_metadata.cc +295 -276
  227. data/src/core/lib/transport/static_metadata.h +80 -73
  228. data/src/core/lib/transport/transport.h +7 -0
  229. data/src/core/lib/uri/uri_parser.cc +23 -21
  230. data/src/core/lib/uri/uri_parser.h +3 -1
  231. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +22 -0
  232. data/src/core/tsi/ssl_transport_security.cc +3 -9
  233. data/src/ruby/ext/grpc/rb_channel_credentials.c +9 -0
  234. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -2
  235. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -4
  236. data/src/ruby/lib/grpc/version.rb +1 -1
  237. data/src/ruby/spec/channel_credentials_spec.rb +10 -0
  238. data/src/ruby/spec/generic/active_call_spec.rb +19 -8
  239. data/third_party/abseil-cpp/absl/algorithm/container.h +1727 -0
  240. data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +161 -0
  241. data/third_party/abseil-cpp/absl/base/internal/exponential_biased.cc +93 -0
  242. data/third_party/abseil-cpp/absl/base/internal/exponential_biased.h +130 -0
  243. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +620 -0
  244. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +126 -0
  245. data/third_party/abseil-cpp/absl/container/fixed_array.h +515 -0
  246. data/third_party/abseil-cpp/absl/container/flat_hash_set.h +503 -0
  247. data/third_party/abseil-cpp/absl/container/internal/common.h +202 -0
  248. data/third_party/abseil-cpp/absl/container/internal/container_memory.h +440 -0
  249. data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +146 -0
  250. data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +191 -0
  251. data/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h +85 -0
  252. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +269 -0
  253. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +297 -0
  254. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +30 -0
  255. data/third_party/abseil-cpp/absl/container/internal/have_sse.h +49 -0
  256. data/third_party/abseil-cpp/absl/container/internal/layout.h +741 -0
  257. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +48 -0
  258. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1882 -0
  259. data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +138 -0
  260. data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h +32 -0
  261. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +1895 -0
  262. data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +71 -0
  263. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +382 -0
  264. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +134 -0
  265. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +192 -0
  266. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +125 -0
  267. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +70 -0
  268. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +99 -0
  269. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +248 -0
  270. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc +24 -0
  271. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +85 -0
  272. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +346 -0
  273. data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +128 -0
  274. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +194 -0
  275. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.h +158 -0
  276. data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +140 -0
  277. data/third_party/abseil-cpp/absl/debugging/stacktrace.h +231 -0
  278. data/third_party/abseil-cpp/absl/debugging/symbolize.cc +25 -0
  279. data/third_party/abseil-cpp/absl/debugging/symbolize.h +99 -0
  280. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +1480 -0
  281. data/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc +40 -0
  282. data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +81 -0
  283. data/third_party/abseil-cpp/absl/functional/function_ref.h +139 -0
  284. data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +106 -0
  285. data/third_party/abseil-cpp/absl/hash/hash.h +324 -0
  286. data/third_party/abseil-cpp/absl/hash/internal/city.cc +346 -0
  287. data/third_party/abseil-cpp/absl/hash/internal/city.h +96 -0
  288. data/third_party/abseil-cpp/absl/hash/internal/hash.cc +55 -0
  289. data/third_party/abseil-cpp/absl/hash/internal/hash.h +988 -0
  290. data/third_party/abseil-cpp/absl/status/status.cc +447 -0
  291. data/third_party/abseil-cpp/absl/status/status.h +428 -0
  292. data/third_party/abseil-cpp/absl/status/status_payload_printer.cc +43 -0
  293. data/third_party/abseil-cpp/absl/status/status_payload_printer.h +51 -0
  294. data/third_party/abseil-cpp/absl/strings/cord.cc +2019 -0
  295. data/third_party/abseil-cpp/absl/strings/cord.h +1121 -0
  296. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +151 -0
  297. data/third_party/abseil-cpp/absl/synchronization/barrier.cc +52 -0
  298. data/third_party/abseil-cpp/absl/synchronization/barrier.h +79 -0
  299. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +57 -0
  300. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +99 -0
  301. data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +140 -0
  302. data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h +60 -0
  303. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +697 -0
  304. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.h +141 -0
  305. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +155 -0
  306. data/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc +261 -0
  307. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +106 -0
  308. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +115 -0
  309. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +484 -0
  310. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +159 -0
  311. data/third_party/abseil-cpp/absl/synchronization/mutex.cc +2728 -0
  312. data/third_party/abseil-cpp/absl/synchronization/mutex.h +1056 -0
  313. data/third_party/abseil-cpp/absl/synchronization/notification.cc +78 -0
  314. data/third_party/abseil-cpp/absl/synchronization/notification.h +123 -0
  315. data/third_party/abseil-cpp/absl/types/bad_variant_access.cc +64 -0
  316. data/third_party/abseil-cpp/absl/types/bad_variant_access.h +82 -0
  317. data/third_party/abseil-cpp/absl/types/internal/variant.h +1646 -0
  318. data/third_party/abseil-cpp/absl/types/variant.h +861 -0
  319. data/third_party/boringssl-with-bazel/err_data.c +263 -257
  320. data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +16 -0
  321. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +456 -0
  322. data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +192 -0
  323. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +20 -0
  324. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +52 -0
  325. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +1 -1
  326. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +39 -7
  327. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +2 -3
  328. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +11 -0
  329. data/third_party/boringssl-with-bazel/src/ssl/internal.h +4 -0
  330. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +3 -6
  331. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +10 -0
  332. data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +34 -9
  333. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +5 -0
  334. data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +5 -3
  335. data/third_party/upb/upb/decode.c +64 -15
  336. data/third_party/upb/upb/encode.c +2 -2
  337. data/third_party/upb/upb/msg.h +2 -2
  338. data/third_party/upb/upb/port_def.inc +1 -1
  339. data/third_party/upb/upb/table.c +0 -11
  340. data/third_party/upb/upb/table.int.h +0 -9
  341. data/third_party/upb/upb/upb.c +16 -14
  342. data/third_party/upb/upb/upb.h +26 -0
  343. data/third_party/upb/upb/upb.hpp +2 -0
  344. metadata +257 -155
  345. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -21
  346. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -34
  347. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +0 -114
  348. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +0 -429
  349. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +0 -72
  350. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +0 -198
  351. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +0 -105
  352. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +0 -388
  353. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +0 -52
  354. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +0 -403
  355. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +0 -1453
  356. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -74
  357. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +0 -226
  358. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +0 -69
  359. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +0 -323
  360. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -112
  361. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +0 -334
  362. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +0 -79
  363. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +0 -313
  364. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +0 -891
  365. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +0 -96
  366. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +0 -328
  367. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +0 -34
  368. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +0 -71
  369. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +0 -197
  370. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +0 -649
  371. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +0 -172
  372. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +0 -693
  373. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +0 -80
  374. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +0 -152
  375. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +0 -536
  376. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +0 -88
  377. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -129
  378. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +0 -386
  379. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +0 -52
  380. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +0 -92
  381. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +0 -224
  382. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -18
  383. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -32
  384. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +0 -91
  385. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +0 -273
  386. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -112
  387. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +0 -332
  388. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +0 -52
  389. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +0 -109
  390. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +0 -415
  391. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +0 -18
  392. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -32
  393. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +0 -145
  394. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +0 -538
  395. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +0 -43
  396. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +0 -111
  397. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +0 -52
  398. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +0 -63
  399. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +0 -204
  400. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +0 -18
  401. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -32
  402. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +0 -815
  403. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +0 -2984
  404. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +0 -59
  405. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +0 -135
  406. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +0 -52
  407. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +0 -228
  408. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +0 -732
  409. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +0 -316
  410. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +0 -1167
  411. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +0 -65
  412. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +0 -51
  413. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +0 -125
  414. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +0 -49
  415. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +0 -54
  416. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +0 -136
  417. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +0 -63
  418. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +0 -145
  419. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +0 -53
  420. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +0 -133
  421. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +0 -88
  422. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +0 -258
  423. data/src/core/ext/upb-generated/envoy/type/percent.upb.h +0 -86
  424. data/src/core/ext/upb-generated/envoy/type/range.upb.h +0 -111
  425. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +0 -61
  426. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +0 -89
  427. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +0 -250
  428. data/src/core/lib/security/transport/target_authority_table.cc +0 -75
  429. data/src/core/lib/security/transport/target_authority_table.h +0 -40
  430. data/src/core/lib/slice/slice_hash_table.h +0 -199
  431. data/src/core/lib/slice/slice_weak_hash_table.h +0 -102
@@ -68,10 +68,11 @@ int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
68
68
  args_to_add[0] = grpc_server_credentials_to_arg(creds);
69
69
  args_to_add[1] = grpc_security_connector_to_arg(sc.get());
70
70
  args =
71
- grpc_channel_args_copy_and_add(grpc_server_get_channel_args(server),
71
+ grpc_channel_args_copy_and_add(server->core_server->channel_args(),
72
72
  args_to_add, GPR_ARRAY_SIZE(args_to_add));
73
73
  // Add server port.
74
- err = grpc_core::Chttp2ServerAddPort(server, addr, args, &port_num);
74
+ err = grpc_core::Chttp2ServerAddPort(server->core_server.get(), addr, args,
75
+ &port_num);
75
76
  done:
76
77
  sc.reset(DEBUG_LOCATION, "server");
77
78
 
@@ -1,25 +1,25 @@
1
- /*
2
- *
3
- * Copyright 2018 gRPC authors.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- *
17
- */
1
+ //
2
+ // Copyright 2018 gRPC authors.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
18
16
 
19
17
  #include <grpc/support/port_platform.h>
20
18
 
21
19
  #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
22
20
 
21
+ #include "absl/strings/str_format.h"
22
+
23
23
  #include <grpc/slice_buffer.h>
24
24
  #include <grpc/support/alloc.h>
25
25
  #include <grpc/support/log.h>
@@ -31,7 +31,6 @@
31
31
  #include <stdio.h>
32
32
  #include <string.h>
33
33
 
34
- #include "absl/strings/str_format.h"
35
34
  #include "src/core/ext/transport/chttp2/transport/context_list.h"
36
35
  #include "src/core/ext/transport/chttp2/transport/frame_data.h"
37
36
  #include "src/core/ext/transport/chttp2/transport/internal.h"
@@ -103,7 +102,7 @@ grpc_core::TraceFlag grpc_keepalive_trace(false, "http_keepalive");
103
102
  grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount(false,
104
103
  "chttp2_refcount");
105
104
 
106
- /* forward declarations of various callbacks that we'll build closures around */
105
+ // forward declarations of various callbacks that we'll build closures around
107
106
  static void write_action_begin_locked(void* t, grpc_error* error);
108
107
  static void write_action(void* t, grpc_error* error);
109
108
  static void write_action_end(void* t, grpc_error* error);
@@ -115,18 +114,19 @@ static void continue_read_action_locked(grpc_chttp2_transport* t);
115
114
 
116
115
  static void complete_fetch(void* gs, grpc_error* error);
117
116
  static void complete_fetch_locked(void* gs, grpc_error* error);
118
- /** Set a transport level setting, and push it to our peer */
117
+ // Set a transport level setting, and push it to our peer
119
118
  static void queue_setting_update(grpc_chttp2_transport* t,
120
119
  grpc_chttp2_setting_id id, uint32_t value);
121
120
 
122
121
  static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
123
122
  grpc_error* error);
124
123
 
125
- /** Start new streams that have been created if we can */
124
+ // Start new streams that have been created if we can
126
125
  static void maybe_start_some_streams(grpc_chttp2_transport* t);
127
126
 
128
127
  static void connectivity_state_set(grpc_chttp2_transport* t,
129
128
  grpc_connectivity_state state,
129
+ const absl::Status& status,
130
130
  const char* reason);
131
131
 
132
132
  static void benign_reclaimer(void* t, grpc_error* error);
@@ -154,7 +154,7 @@ static void send_ping_locked(grpc_chttp2_transport* t,
154
154
  grpc_closure* on_complete);
155
155
  static void retry_initiate_ping_locked(void* tp, grpc_error* error);
156
156
 
157
- /** keepalive-relevant functions */
157
+ // keepalive-relevant functions
158
158
  static void init_keepalive_ping(void* arg, grpc_error* error);
159
159
  static void init_keepalive_ping_locked(void* arg, grpc_error* error);
160
160
  static void start_keepalive_ping(void* arg, grpc_error* error);
@@ -170,9 +170,9 @@ static void reset_byte_stream(void* arg, grpc_error* error);
170
170
  // GRPC_EXPERIMENTAL_DISABLE_FLOW_CONTROL
171
171
  bool g_flow_control_enabled = true;
172
172
 
173
- /*******************************************************************************
174
- * CONSTRUCTION/DESTRUCTION/REFCOUNTING
175
- */
173
+ //
174
+ // CONSTRUCTION/DESTRUCTION/REFCOUNTING
175
+ //
176
176
 
177
177
  grpc_chttp2_transport::~grpc_chttp2_transport() {
178
178
  size_t i;
@@ -226,12 +226,11 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
226
226
 
227
227
  GRPC_ERROR_UNREF(closed_with_error);
228
228
  gpr_free(ping_acks);
229
- gpr_free(peer_string);
230
229
  }
231
230
 
232
231
  static const grpc_transport_vtable* get_vtable(void);
233
232
 
234
- /* Returns whether bdp is enabled */
233
+ // Returns whether bdp is enabled
235
234
  static bool read_channel_args(grpc_chttp2_transport* t,
236
235
  const grpc_channel_args* channel_args,
237
236
  bool is_client) {
@@ -378,11 +377,9 @@ static bool read_channel_args(grpc_chttp2_transport* t,
378
377
  }
379
378
  }
380
379
  if (channelz_enabled) {
381
- // TODO(ncteisen): add an API to endpoint to query for local addr, and pass
382
- // it in here, so SocketNode knows its own address.
383
380
  t->channelz_socket =
384
381
  grpc_core::MakeRefCounted<grpc_core::channelz::SocketNode>(
385
- "", t->peer_string,
382
+ std::string(grpc_endpoint_get_local_address(t->ep)), t->peer_string,
386
383
  absl::StrFormat("%s %s", get_vtable()->name, t->peer_string));
387
384
  }
388
385
  return enable_bdp;
@@ -429,8 +426,8 @@ static void init_keepalive_pings_if_enabled(grpc_chttp2_transport* t) {
429
426
  grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
430
427
  &t->init_keepalive_ping_locked);
431
428
  } else {
432
- /* Use GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED to indicate there are no
433
- inflight keeaplive timers */
429
+ // Use GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED to indicate there are no
430
+ // inflight keeaplive timers
434
431
  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED;
435
432
  }
436
433
  }
@@ -451,11 +448,11 @@ grpc_chttp2_transport::grpc_chttp2_transport(
451
448
  GPR_ASSERT(strlen(GRPC_CHTTP2_CLIENT_CONNECT_STRING) ==
452
449
  GRPC_CHTTP2_CLIENT_CONNECT_STRLEN);
453
450
  base.vtable = get_vtable();
454
- /* 8 is a random stab in the dark as to a good initial size: it's small enough
455
- that it shouldn't waste memory for infrequently used connections, yet
456
- large enough that the exponential growth should happen nicely when it's
457
- needed.
458
- TODO(ctiller): tune this */
451
+ // 8 is a random stab in the dark as to a good initial size: it's small enough
452
+ // that it shouldn't waste memory for infrequently used connections, yet
453
+ // large enough that the exponential growth should happen nicely when it's
454
+ // needed.
455
+ // TODO(ctiller): tune this
459
456
  grpc_chttp2_stream_map_init(&stream_map, 8);
460
457
 
461
458
  grpc_slice_buffer_init(&read_buffer);
@@ -466,7 +463,7 @@ grpc_chttp2_transport::grpc_chttp2_transport(
466
463
  }
467
464
  grpc_chttp2_hpack_compressor_init(&hpack_compressor);
468
465
  grpc_slice_buffer_init(&qbuf);
469
- /* copy in initial settings to all setting sets */
466
+ // copy in initial settings to all setting sets
470
467
  size_t i;
471
468
  int j;
472
469
  for (i = 0; i < GRPC_CHTTP2_NUM_SETTINGS; i++) {
@@ -477,7 +474,7 @@ grpc_chttp2_transport::grpc_chttp2_transport(
477
474
  grpc_chttp2_hpack_parser_init(&hpack_parser);
478
475
  grpc_chttp2_goaway_parser_init(&goaway_parser);
479
476
 
480
- /* configure http2 the way we like it */
477
+ // configure http2 the way we like it
481
478
  if (is_client) {
482
479
  queue_setting_update(this, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0);
483
480
  queue_setting_update(this, GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0);
@@ -503,7 +500,7 @@ grpc_chttp2_transport::grpc_chttp2_transport(
503
500
  enable_bdp = false;
504
501
  }
505
502
 
506
- /* No pings allowed before receiving a header or data frame. */
503
+ // No pings allowed before receiving a header or data frame.
507
504
  ping_state.pings_before_data_required = 0;
508
505
  ping_state.is_delayed_ping_timer_set = false;
509
506
  ping_state.last_ping_sent_time = GRPC_MILLIS_INF_PAST;
@@ -562,7 +559,8 @@ static void close_transport_locked(grpc_chttp2_transport* t,
562
559
  }
563
560
  GPR_ASSERT(error != GRPC_ERROR_NONE);
564
561
  t->closed_with_error = GRPC_ERROR_REF(error);
565
- connectivity_state_set(t, GRPC_CHANNEL_SHUTDOWN, "close_transport");
562
+ connectivity_state_set(t, GRPC_CHANNEL_SHUTDOWN, absl::Status(),
563
+ "close_transport");
566
564
  if (t->ping_state.is_delayed_ping_timer_set) {
567
565
  grpc_timer_cancel(&t->ping_state.delayed_ping_timer);
568
566
  }
@@ -579,11 +577,11 @@ static void close_transport_locked(grpc_chttp2_transport* t,
579
577
  break;
580
578
  case GRPC_CHTTP2_KEEPALIVE_STATE_DYING:
581
579
  case GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED:
582
- /* keepalive timers are not set in these two states */
580
+ // keepalive timers are not set in these two states
583
581
  break;
584
582
  }
585
583
 
586
- /* flush writable stream list to avoid dangling references */
584
+ // flush writable stream list to avoid dangling references
587
585
  grpc_chttp2_stream* s;
588
586
  while (grpc_chttp2_list_pop_writable_stream(t, &s)) {
589
587
  GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:close");
@@ -593,7 +591,7 @@ static void close_transport_locked(grpc_chttp2_transport* t,
593
591
  }
594
592
  if (t->notify_on_receive_settings != nullptr) {
595
593
  grpc_core::ExecCtx::Run(DEBUG_LOCATION, t->notify_on_receive_settings,
596
- GRPC_ERROR_CANCELLED);
594
+ GRPC_ERROR_REF(error));
597
595
  t->notify_on_receive_settings = nullptr;
598
596
  }
599
597
  GRPC_ERROR_UNREF(error);
@@ -616,9 +614,9 @@ void grpc_chttp2_stream_unref(grpc_chttp2_stream* s) {
616
614
  #endif
617
615
 
618
616
  grpc_chttp2_stream::Reffer::Reffer(grpc_chttp2_stream* s) {
619
- /* We reserve one 'active stream' that's dropped when the stream is
620
- read-closed. The others are for Chttp2IncomingByteStreams that are
621
- actively reading */
617
+ // We reserve one 'active stream' that's dropped when the stream is
618
+ // read-closed. The others are for Chttp2IncomingByteStreams that are
619
+ // actively reading
622
620
  GRPC_CHTTP2_STREAM_REF(s, "chttp2");
623
621
  GRPC_CHTTP2_REF_TRANSPORT(s->t, "stream");
624
622
  }
@@ -677,9 +675,6 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
677
675
  grpc_slice_buffer_destroy_internal(&decompressed_data_buffer);
678
676
  }
679
677
 
680
- grpc_chttp2_list_remove_stalled_by_transport(t, this);
681
- grpc_chttp2_list_remove_stalled_by_stream(t, this);
682
-
683
678
  for (int i = 0; i < STREAM_LIST_COUNT; i++) {
684
679
  if (GPR_UNLIKELY(included[i])) {
685
680
  gpr_log(GPR_ERROR, "%s stream %d still included in list %d",
@@ -774,9 +769,9 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
774
769
  return accepting;
775
770
  }
776
771
 
777
- /*******************************************************************************
778
- * OUTPUT PROCESSING
779
- */
772
+ //
773
+ // OUTPUT PROCESSING
774
+ //
780
775
 
781
776
  static const char* write_state_name(grpc_chttp2_write_state st) {
782
777
  switch (st) {
@@ -794,15 +789,15 @@ static void set_write_state(grpc_chttp2_transport* t,
794
789
  grpc_chttp2_write_state st, const char* reason) {
795
790
  GRPC_CHTTP2_IF_TRACING(
796
791
  gpr_log(GPR_INFO, "W:%p %s [%s] state %s -> %s [%s]", t,
797
- t->is_client ? "CLIENT" : "SERVER", t->peer_string,
792
+ t->is_client ? "CLIENT" : "SERVER", t->peer_string.c_str(),
798
793
  write_state_name(t->write_state), write_state_name(st), reason));
799
794
  t->write_state = st;
800
- /* If the state is being reset back to idle, it means a write was just
801
- * finished. Make sure all the run_after_write closures are scheduled.
802
- *
803
- * This is also our chance to close the transport if the transport was marked
804
- * to be closed after all writes finish (for example, if we received a go-away
805
- * from peer while we had some pending writes) */
795
+ // If the state is being reset back to idle, it means a write was just
796
+ // finished. Make sure all the run_after_write closures are scheduled.
797
+ //
798
+ // This is also our chance to close the transport if the transport was marked
799
+ // to be closed after all writes finish (for example, if we received a go-away
800
+ // from peer while we had some pending writes)
806
801
  if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
807
802
  grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &t->run_after_write);
808
803
  if (t->close_transport_on_writes_finished != nullptr) {
@@ -889,22 +884,22 @@ void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
889
884
  set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING,
890
885
  grpc_chttp2_initiate_write_reason_string(reason));
891
886
  GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
892
- /* Note that the 'write_action_begin_locked' closure is being scheduled
893
- * on the 'finally_scheduler' of t->combiner. This means that
894
- * 'write_action_begin_locked' is called only *after* all the other
895
- * closures (some of which are potentially initiating more writes on the
896
- * transport) are executed on the t->combiner.
897
- *
898
- * The reason for scheduling on finally_scheduler is to make sure we batch
899
- * as many writes as possible. 'write_action_begin_locked' is the function
900
- * that gathers all the relevant bytes (which are at various places in the
901
- * grpc_chttp2_transport structure) and append them to 'outbuf' field in
902
- * grpc_chttp2_transport thereby batching what would have been potentially
903
- * multiple write operations.
904
- *
905
- * Also, 'write_action_begin_locked' only gathers the bytes into outbuf.
906
- * It does not call the endpoint to write the bytes. That is done by the
907
- * 'write_action' (which is scheduled by 'write_action_begin_locked') */
887
+ // Note that the 'write_action_begin_locked' closure is being scheduled
888
+ // on the 'finally_scheduler' of t->combiner. This means that
889
+ // 'write_action_begin_locked' is called only *after* all the other
890
+ // closures (some of which are potentially initiating more writes on the
891
+ // transport) are executed on the t->combiner.
892
+ //
893
+ // The reason for scheduling on finally_scheduler is to make sure we batch
894
+ // as many writes as possible. 'write_action_begin_locked' is the function
895
+ // that gathers all the relevant bytes (which are at various places in the
896
+ // grpc_chttp2_transport structure) and append them to 'outbuf' field in
897
+ // grpc_chttp2_transport thereby batching what would have been potentially
898
+ // multiple write operations.
899
+ //
900
+ // Also, 'write_action_begin_locked' only gathers the bytes into outbuf.
901
+ // It does not call the endpoint to write the bytes. That is done by the
902
+ // 'write_action' (which is scheduled by 'write_action_begin_locked')
908
903
  t->combiner->FinallyRun(
909
904
  GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
910
905
  write_action_begin_locked, t, nullptr),
@@ -956,9 +951,9 @@ static void write_action_begin_locked(void* gt, grpc_error* /*error_ignored*/) {
956
951
  write_action(t, GRPC_ERROR_NONE);
957
952
  if (t->reading_paused_on_pending_induced_frames) {
958
953
  GPR_ASSERT(t->num_pending_induced_frames == 0);
959
- /* We had paused reading, because we had many induced frames (SETTINGS
960
- * ACK, PINGS ACK and RST_STREAMS) pending in t->qbuf. Now that we have
961
- * been able to flush qbuf, we can resume reading. */
954
+ // We had paused reading, because we had many induced frames (SETTINGS
955
+ // ACK, PINGS ACK and RST_STREAMS) pending in t->qbuf. Now that we have
956
+ // been able to flush qbuf, we can resume reading.
962
957
  GRPC_CHTTP2_IF_TRACING(gpr_log(
963
958
  GPR_INFO,
964
959
  "transport %p : Resuming reading after being paused due to too "
@@ -993,8 +988,8 @@ static void write_action_end(void* tp, grpc_error* error) {
993
988
  GRPC_ERROR_REF(error));
994
989
  }
995
990
 
996
- /* Callback from the grpc_endpoint after bytes have been written by calling
997
- * sendmsg */
991
+ // Callback from the grpc_endpoint after bytes have been written by calling
992
+ // sendmsg
998
993
  static void write_action_end_locked(void* tp, grpc_error* error) {
999
994
  GPR_TIMER_SCOPE("terminate_writing_with_lock", 0);
1000
995
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
@@ -1080,16 +1075,17 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
1080
1075
  GRPC_CHTTP2_IF_TRACING(
1081
1076
  gpr_log(GPR_INFO, "transport %p got goaway with last stream id %d", t,
1082
1077
  last_stream_id));
1083
- /* We want to log this irrespective of whether http tracing is enabled if we
1084
- * received a GOAWAY with a non NO_ERROR code. */
1078
+ // We want to log this irrespective of whether http tracing is enabled if we
1079
+ // received a GOAWAY with a non NO_ERROR code.
1085
1080
  if (goaway_error != GRPC_HTTP2_NO_ERROR) {
1086
- gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string,
1081
+ gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string.c_str(),
1087
1082
  goaway_error, grpc_error_string(t->goaway_error));
1088
1083
  }
1089
- /* When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug
1090
- * data equal to "too_many_pings", it should log the occurrence at a log level
1091
- * that is enabled by default and double the configured KEEPALIVE_TIME used
1092
- * for new connections on that channel. */
1084
+ absl::Status status = grpc_error_to_absl_status(t->goaway_error);
1085
+ // When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug
1086
+ // data equal to "too_many_pings", it should log the occurrence at a log level
1087
+ // that is enabled by default and double the configured KEEPALIVE_TIME used
1088
+ // for new connections on that channel.
1093
1089
  if (GPR_UNLIKELY(t->is_client &&
1094
1090
  goaway_error == GRPC_HTTP2_ENHANCE_YOUR_CALM &&
1095
1091
  grpc_slice_str_cmp(goaway_text, "too_many_pings") == 0)) {
@@ -1104,15 +1100,18 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
1104
1100
  ? GRPC_MILLIS_INF_FUTURE
1105
1101
  : static_cast<grpc_millis>(current_keepalive_time_ms *
1106
1102
  KEEPALIVE_TIME_BACKOFF_MULTIPLIER);
1103
+ status.SetPayload(grpc_core::kKeepaliveThrottlingKey,
1104
+ absl::Cord(std::to_string(t->keepalive_time)));
1107
1105
  }
1108
- /* lie: use transient failure from the transport to indicate goaway has been
1109
- * received */
1110
- connectivity_state_set(t, GRPC_CHANNEL_TRANSIENT_FAILURE, "got_goaway");
1106
+ // lie: use transient failure from the transport to indicate goaway has been
1107
+ // received.
1108
+ connectivity_state_set(t, GRPC_CHANNEL_TRANSIENT_FAILURE, status,
1109
+ "got_goaway");
1111
1110
  }
1112
1111
 
1113
1112
  static void maybe_start_some_streams(grpc_chttp2_transport* t) {
1114
1113
  grpc_chttp2_stream* s;
1115
- /* cancel out streams that haven't yet started if we have received a GOAWAY */
1114
+ // cancel out streams that haven't yet started if we have received a GOAWAY
1116
1115
  if (t->goaway_error != GRPC_ERROR_NONE) {
1117
1116
  while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
1118
1117
  grpc_chttp2_cancel_stream(
@@ -1123,14 +1122,14 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
1123
1122
  }
1124
1123
  return;
1125
1124
  }
1126
- /* start streams where we have free grpc_chttp2_stream ids and free
1127
- * concurrency */
1125
+ // start streams where we have free grpc_chttp2_stream ids and free
1126
+ // * concurrency
1128
1127
  while (t->next_stream_id <= MAX_CLIENT_STREAM_ID &&
1129
1128
  grpc_chttp2_stream_map_size(&t->stream_map) <
1130
1129
  t->settings[GRPC_PEER_SETTINGS]
1131
1130
  [GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS] &&
1132
1131
  grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
1133
- /* safe since we can't (legally) be parsing this stream yet */
1132
+ // safe since we can't (legally) be parsing this stream yet
1134
1133
  GRPC_CHTTP2_IF_TRACING(gpr_log(
1135
1134
  GPR_INFO,
1136
1135
  "HTTP:%s: Transport %p allocating new grpc_chttp2_stream %p to id %d",
@@ -1142,6 +1141,8 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
1142
1141
 
1143
1142
  if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) {
1144
1143
  connectivity_state_set(t, GRPC_CHANNEL_TRANSIENT_FAILURE,
1144
+ absl::Status(absl::StatusCode::kUnavailable,
1145
+ "Transport Stream IDs exhausted"),
1145
1146
  "no_more_stream_ids");
1146
1147
  }
1147
1148
 
@@ -1150,7 +1151,7 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
1150
1151
  grpc_chttp2_mark_stream_writable(t, s);
1151
1152
  grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM);
1152
1153
  }
1153
- /* cancel out streams that will never be started */
1154
+ // cancel out streams that will never be started
1154
1155
  if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) {
1155
1156
  while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
1156
1157
  grpc_chttp2_cancel_stream(
@@ -1162,12 +1163,12 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
1162
1163
  }
1163
1164
  }
1164
1165
 
1165
- /* Flag that this closure barrier may be covering a write in a pollset, and so
1166
- we should not complete this closure until we can prove that the write got
1167
- scheduled */
1166
+ // Flag that this closure barrier may be covering a write in a pollset, and so
1167
+ // we should not complete this closure until we can prove that the write got
1168
+ // scheduled
1168
1169
  #define CLOSURE_BARRIER_MAY_COVER_WRITE (1 << 0)
1169
- /* First bit of the reference count, stored in the high order bits (with the low
1170
- bits being used for flags defined above) */
1170
+ // First bit of the reference count, stored in the high order bits (with the low
1171
+ // bits being used for flags defined above)
1171
1172
  #define CLOSURE_BARRIER_FIRST_REF_BIT (1 << 16)
1172
1173
 
1173
1174
  static grpc_closure* add_closure_barrier(grpc_closure* closure) {
@@ -1211,7 +1212,7 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
1211
1212
  "Error in HTTP transport completing operation");
1212
1213
  closure->error_data.error = grpc_error_set_str(
1213
1214
  closure->error_data.error, GRPC_ERROR_STR_TARGET_ADDRESS,
1214
- grpc_slice_from_copied_string(t->peer_string));
1215
+ grpc_slice_from_copied_string(t->peer_string.c_str()));
1215
1216
  }
1216
1217
  closure->error_data.error =
1217
1218
  grpc_error_add_child(closure->error_data.error, error);
@@ -1259,7 +1260,7 @@ static void continue_fetching_send_locked(grpc_chttp2_transport* t,
1259
1260
  grpc_chttp2_stream* s) {
1260
1261
  for (;;) {
1261
1262
  if (s->fetching_send_message == nullptr) {
1262
- /* Stream was cancelled before message fetch completed */
1263
+ // Stream was cancelled before message fetch completed
1263
1264
  abort(); /* TODO(ctiller): what cleanup here? */
1264
1265
  return; /* early out */
1265
1266
  }
@@ -1389,7 +1390,7 @@ static void perform_stream_op_locked(void* stream_op,
1389
1390
  GPR_ASSERT(s->send_initial_metadata_finished == nullptr);
1390
1391
  on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
1391
1392
 
1392
- /* Identify stream compression */
1393
+ // Identify stream compression
1393
1394
  if (op_payload->send_initial_metadata.send_initial_metadata->idx.named
1394
1395
  .content_encoding == nullptr ||
1395
1396
  grpc_stream_compression_method_parse(
@@ -1408,68 +1409,48 @@ static void perform_stream_op_locked(void* stream_op,
1408
1409
  s->send_initial_metadata_finished = add_closure_barrier(on_complete);
1409
1410
  s->send_initial_metadata =
1410
1411
  op_payload->send_initial_metadata.send_initial_metadata;
1411
- const size_t metadata_size =
1412
- grpc_metadata_batch_size(s->send_initial_metadata);
1413
- const size_t metadata_peer_limit =
1414
- t->settings[GRPC_PEER_SETTINGS]
1415
- [GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE];
1416
1412
  if (t->is_client) {
1417
1413
  s->deadline = GPR_MIN(s->deadline, s->send_initial_metadata->deadline);
1418
1414
  }
1419
- if (metadata_size > metadata_peer_limit) {
1420
- grpc_chttp2_cancel_stream(
1421
- t, s,
1422
- grpc_error_set_int(
1423
- grpc_error_set_int(
1424
- grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1425
- "to-be-sent initial metadata size "
1426
- "exceeds peer limit"),
1427
- GRPC_ERROR_INT_SIZE,
1428
- static_cast<intptr_t>(metadata_size)),
1429
- GRPC_ERROR_INT_LIMIT,
1430
- static_cast<intptr_t>(metadata_peer_limit)),
1431
- GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
1432
- } else {
1433
- if (contains_non_ok_status(s->send_initial_metadata)) {
1434
- s->seen_error = true;
1435
- }
1436
- if (!s->write_closed) {
1437
- if (t->is_client) {
1438
- if (t->closed_with_error == GRPC_ERROR_NONE) {
1439
- GPR_ASSERT(s->id == 0);
1440
- grpc_chttp2_list_add_waiting_for_concurrency(t, s);
1441
- maybe_start_some_streams(t);
1442
- } else {
1443
- grpc_chttp2_cancel_stream(
1444
- t, s,
1445
- grpc_error_set_int(
1446
- GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
1447
- "Transport closed", &t->closed_with_error, 1),
1448
- GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
1449
- }
1415
+ if (contains_non_ok_status(s->send_initial_metadata)) {
1416
+ s->seen_error = true;
1417
+ }
1418
+ if (!s->write_closed) {
1419
+ if (t->is_client) {
1420
+ if (t->closed_with_error == GRPC_ERROR_NONE) {
1421
+ GPR_ASSERT(s->id == 0);
1422
+ grpc_chttp2_list_add_waiting_for_concurrency(t, s);
1423
+ maybe_start_some_streams(t);
1450
1424
  } else {
1451
- GPR_ASSERT(s->id != 0);
1452
- grpc_chttp2_mark_stream_writable(t, s);
1453
- if (!(op->send_message &&
1454
- (op->payload->send_message.send_message->flags() &
1455
- GRPC_WRITE_BUFFER_HINT))) {
1456
- grpc_chttp2_initiate_write(
1457
- t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA);
1458
- }
1425
+ grpc_chttp2_cancel_stream(
1426
+ t, s,
1427
+ grpc_error_set_int(
1428
+ GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
1429
+ "Transport closed", &t->closed_with_error, 1),
1430
+ GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
1459
1431
  }
1460
1432
  } else {
1461
- s->send_initial_metadata = nullptr;
1462
- grpc_chttp2_complete_closure_step(
1463
- t, s, &s->send_initial_metadata_finished,
1464
- GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
1465
- "Attempt to send initial metadata after stream was closed",
1466
- &s->write_closed_error, 1),
1467
- "send_initial_metadata_finished");
1433
+ GPR_ASSERT(s->id != 0);
1434
+ grpc_chttp2_mark_stream_writable(t, s);
1435
+ if (!(op->send_message &&
1436
+ (op->payload->send_message.send_message->flags() &
1437
+ GRPC_WRITE_BUFFER_HINT))) {
1438
+ grpc_chttp2_initiate_write(
1439
+ t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA);
1440
+ }
1468
1441
  }
1442
+ } else {
1443
+ s->send_initial_metadata = nullptr;
1444
+ grpc_chttp2_complete_closure_step(
1445
+ t, s, &s->send_initial_metadata_finished,
1446
+ GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
1447
+ "Attempt to send initial metadata after stream was closed",
1448
+ &s->write_closed_error, 1),
1449
+ "send_initial_metadata_finished");
1469
1450
  }
1470
1451
  if (op_payload->send_initial_metadata.peer_string != nullptr) {
1471
1452
  gpr_atm_rel_store(op_payload->send_initial_metadata.peer_string,
1472
- (gpr_atm)t->peer_string);
1453
+ (gpr_atm)t->peer_string.c_str());
1473
1454
  }
1474
1455
  }
1475
1456
 
@@ -1527,47 +1508,27 @@ static void perform_stream_op_locked(void* stream_op,
1527
1508
  op_payload->send_trailing_metadata.send_trailing_metadata;
1528
1509
  s->sent_trailing_metadata_op = op_payload->send_trailing_metadata.sent;
1529
1510
  s->write_buffering = false;
1530
- const size_t metadata_size =
1531
- grpc_metadata_batch_size(s->send_trailing_metadata);
1532
- const size_t metadata_peer_limit =
1533
- t->settings[GRPC_PEER_SETTINGS]
1534
- [GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE];
1535
- if (metadata_size > metadata_peer_limit) {
1536
- grpc_chttp2_cancel_stream(
1537
- t, s,
1538
- grpc_error_set_int(
1539
- grpc_error_set_int(
1540
- grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1541
- "to-be-sent trailing metadata size "
1542
- "exceeds peer limit"),
1543
- GRPC_ERROR_INT_SIZE,
1544
- static_cast<intptr_t>(metadata_size)),
1545
- GRPC_ERROR_INT_LIMIT,
1546
- static_cast<intptr_t>(metadata_peer_limit)),
1547
- GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
1548
- } else {
1549
- if (contains_non_ok_status(s->send_trailing_metadata)) {
1550
- s->seen_error = true;
1551
- }
1552
- if (s->write_closed) {
1553
- s->send_trailing_metadata = nullptr;
1554
- s->sent_trailing_metadata_op = nullptr;
1555
- grpc_chttp2_complete_closure_step(
1556
- t, s, &s->send_trailing_metadata_finished,
1557
- grpc_metadata_batch_is_empty(
1558
- op->payload->send_trailing_metadata.send_trailing_metadata)
1559
- ? GRPC_ERROR_NONE
1560
- : GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1561
- "Attempt to send trailing metadata after "
1562
- "stream was closed"),
1563
- "send_trailing_metadata_finished");
1564
- } else if (s->id != 0) {
1565
- /* TODO(ctiller): check if there's flow control for any outstanding
1566
- bytes before going writable */
1567
- grpc_chttp2_mark_stream_writable(t, s);
1568
- grpc_chttp2_initiate_write(
1569
- t, GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA);
1570
- }
1511
+ if (contains_non_ok_status(s->send_trailing_metadata)) {
1512
+ s->seen_error = true;
1513
+ }
1514
+ if (s->write_closed) {
1515
+ s->send_trailing_metadata = nullptr;
1516
+ s->sent_trailing_metadata_op = nullptr;
1517
+ grpc_chttp2_complete_closure_step(
1518
+ t, s, &s->send_trailing_metadata_finished,
1519
+ grpc_metadata_batch_is_empty(
1520
+ op->payload->send_trailing_metadata.send_trailing_metadata)
1521
+ ? GRPC_ERROR_NONE
1522
+ : GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1523
+ "Attempt to send trailing metadata after "
1524
+ "stream was closed"),
1525
+ "send_trailing_metadata_finished");
1526
+ } else if (s->id != 0) {
1527
+ // TODO(ctiller): check if there's flow control for any outstanding
1528
+ // bytes before going writable
1529
+ grpc_chttp2_mark_stream_writable(t, s);
1530
+ grpc_chttp2_initiate_write(
1531
+ t, GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA);
1571
1532
  }
1572
1533
  }
1573
1534
 
@@ -1582,7 +1543,7 @@ static void perform_stream_op_locked(void* stream_op,
1582
1543
  op_payload->recv_initial_metadata.trailing_metadata_available;
1583
1544
  if (op_payload->recv_initial_metadata.peer_string != nullptr) {
1584
1545
  gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string,
1585
- (gpr_atm)t->peer_string);
1546
+ (gpr_atm)t->peer_string.c_str());
1586
1547
  }
1587
1548
  grpc_chttp2_maybe_complete_recv_initial_metadata(t, s);
1588
1549
  }
@@ -1665,8 +1626,8 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
1665
1626
  }
1666
1627
 
1667
1628
  static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error) {
1668
- /* callback remaining pings: they're not allowed to call into the transport,
1669
- and maybe they hold resources that need to be freed */
1629
+ // callback remaining pings: they're not allowed to call into the transport,
1630
+ // and maybe they hold resources that need to be freed
1670
1631
  grpc_chttp2_ping_queue* pq = &t->ping_queue;
1671
1632
  GPR_ASSERT(error != GRPC_ERROR_NONE);
1672
1633
  for (size_t j = 0; j < GRPC_CHTTP2_PCL_COUNT; j++) {
@@ -1692,11 +1653,9 @@ static void send_ping_locked(grpc_chttp2_transport* t,
1692
1653
  GRPC_ERROR_NONE);
1693
1654
  }
1694
1655
 
1695
- /*
1696
- * Specialized form of send_ping_locked for keepalive ping. If there is already
1697
- * a ping in progress, the keepalive ping would piggyback onto that ping,
1698
- * instead of waiting for that ping to complete and then starting a new ping.
1699
- */
1656
+ // Specialized form of send_ping_locked for keepalive ping. If there is already
1657
+ // a ping in progress, the keepalive ping would piggyback onto that ping,
1658
+ // instead of waiting for that ping to complete and then starting a new ping.
1700
1659
  static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
1701
1660
  if (t->closed_with_error != GRPC_ERROR_NONE) {
1702
1661
  t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
@@ -1710,7 +1669,7 @@ static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
1710
1669
  }
1711
1670
  grpc_chttp2_ping_queue* pq = &t->ping_queue;
1712
1671
  if (!grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_INFLIGHT])) {
1713
- /* There is a ping in flight. Add yourself to the inflight closure list. */
1672
+ // There is a ping in flight. Add yourself to the inflight closure list.
1714
1673
  t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
1715
1674
  start_keepalive_ping_locked, t, nullptr),
1716
1675
  GRPC_ERROR_REF(t->closed_with_error));
@@ -1752,9 +1711,8 @@ static void retry_initiate_ping_locked(void* tp, grpc_error* error) {
1752
1711
  void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
1753
1712
  grpc_chttp2_ping_queue* pq = &t->ping_queue;
1754
1713
  if (pq->inflight_id != id) {
1755
- char* from = grpc_endpoint_get_peer(t->ep);
1756
- gpr_log(GPR_DEBUG, "Unknown ping response from %s: %" PRIx64, from, id);
1757
- gpr_free(from);
1714
+ gpr_log(GPR_DEBUG, "Unknown ping response from %s: %" PRIx64,
1715
+ t->peer_string.c_str(), id);
1758
1716
  return;
1759
1717
  }
1760
1718
  grpc_core::ExecCtx::RunList(DEBUG_LOCATION,
@@ -1765,8 +1723,8 @@ void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
1765
1723
  }
1766
1724
 
1767
1725
  static void send_goaway(grpc_chttp2_transport* t, grpc_error* error) {
1768
- /* We want to log this irrespective of whether http tracing is enabled */
1769
- gpr_log(GPR_INFO, "%s: Sending goaway err=%s", t->peer_string,
1726
+ // We want to log this irrespective of whether http tracing is enabled
1727
+ gpr_log(GPR_INFO, "%s: Sending goaway err=%s", t->peer_string.c_str(),
1770
1728
  grpc_error_string(error));
1771
1729
  t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED;
1772
1730
  grpc_http2_error_code http_error;
@@ -1787,7 +1745,7 @@ void grpc_chttp2_add_ping_strike(grpc_chttp2_transport* t) {
1787
1745
  grpc_error_set_int(
1788
1746
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("too_many_pings"),
1789
1747
  GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM));
1790
- /*The transport will be closed after the write is done */
1748
+ // The transport will be closed after the write is done
1791
1749
  close_transport_locked(
1792
1750
  t, grpc_error_set_int(
1793
1751
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many pings"),
@@ -1862,9 +1820,9 @@ static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
1862
1820
  GRPC_ERROR_NONE);
1863
1821
  }
1864
1822
 
1865
- /*******************************************************************************
1866
- * INPUT PROCESSING - GENERAL
1867
- */
1823
+ //
1824
+ // INPUT PROCESSING - GENERAL
1825
+ //
1868
1826
 
1869
1827
  void grpc_chttp2_maybe_complete_recv_initial_metadata(
1870
1828
  grpc_chttp2_transport* /*t*/, grpc_chttp2_stream* s) {
@@ -1984,8 +1942,8 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
1984
1942
  s->unprocessed_incoming_frames_buffer.length > 0;
1985
1943
  if (s->read_closed && s->frame_storage.length > 0 && !pending_data &&
1986
1944
  !s->seen_error && s->recv_trailing_metadata_finished != nullptr) {
1987
- /* Maybe some SYNC_FLUSH data is left in frame_storage. Consume them and
1988
- * maybe decompress the next 5 bytes in the stream. */
1945
+ // Maybe some SYNC_FLUSH data is left in frame_storage. Consume them and
1946
+ // maybe decompress the next 5 bytes in the stream.
1989
1947
  if (s->stream_decompression_method ==
1990
1948
  GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS) {
1991
1949
  grpc_slice_buffer_move_first(
@@ -2069,6 +2027,8 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
2069
2027
  if (grpc_chttp2_list_remove_writable_stream(t, s)) {
2070
2028
  GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:remove_stream");
2071
2029
  }
2030
+ grpc_chttp2_list_remove_stalled_by_stream(t, s);
2031
+ grpc_chttp2_list_remove_stalled_by_transport(t, s);
2072
2032
 
2073
2033
  GRPC_ERROR_UNREF(error);
2074
2034
 
@@ -2107,12 +2067,12 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
2107
2067
  if (status != GRPC_STATUS_OK) {
2108
2068
  s->seen_error = true;
2109
2069
  }
2110
- /* stream_global->recv_trailing_metadata_finished gives us a
2111
- last chance replacement: we've received trailing metadata,
2112
- but something more important has become available to signal
2113
- to the upper layers - drop what we've got, and then publish
2114
- what we want - which is safe because we haven't told anyone
2115
- about the metadata yet */
2070
+ // stream_global->recv_trailing_metadata_finished gives us a
2071
+ // last chance replacement: we've received trailing metadata,
2072
+ // but something more important has become available to signal
2073
+ // to the upper layers - drop what we've got, and then publish
2074
+ // what we want - which is safe because we haven't told anyone
2075
+ // about the metadata yet
2116
2076
  if (s->published_metadata[1] == GRPC_METADATA_NOT_PUBLISHED ||
2117
2077
  s->recv_trailing_metadata_finished != nullptr) {
2118
2078
  char status_string[GPR_LTOA_MIN_BUFSIZE];
@@ -2204,7 +2164,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
2204
2164
  grpc_chttp2_stream* s, int close_reads,
2205
2165
  int close_writes, grpc_error* error) {
2206
2166
  if (s->read_closed && s->write_closed) {
2207
- /* already closed, but we should still fake the status if needed. */
2167
+ // already closed, but we should still fake the status if needed.
2208
2168
  grpc_error* overall_error = removal_error(error, s, "Stream removed");
2209
2169
  if (overall_error != GRPC_ERROR_NONE) {
2210
2170
  grpc_chttp2_fake_status(t, s, overall_error);
@@ -2231,7 +2191,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
2231
2191
  if (s->id != 0) {
2232
2192
  remove_stream(t, s->id, GRPC_ERROR_REF(overall_error));
2233
2193
  } else {
2234
- /* Purge streams waiting on concurrency still waiting for id assignment */
2194
+ // Purge streams waiting on concurrency still waiting for id assignment
2235
2195
  grpc_chttp2_list_remove_waiting_for_concurrency(t, s);
2236
2196
  }
2237
2197
  if (overall_error != GRPC_ERROR_NONE) {
@@ -2270,12 +2230,12 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
2270
2230
 
2271
2231
  GPR_ASSERT(grpc_status >= 0 && (int)grpc_status < 100);
2272
2232
 
2273
- /* Hand roll a header block.
2274
- This is unnecessarily ugly - at some point we should find a more
2275
- elegant solution.
2276
- It's complicated by the fact that our send machinery would be dead by
2277
- the time we got around to sending this, so instead we ignore HPACK
2278
- compression and just write the uncompressed bytes onto the wire. */
2233
+ // Hand roll a header block.
2234
+ // This is unnecessarily ugly - at some point we should find a more
2235
+ // elegant solution.
2236
+ // It's complicated by the fact that our send machinery would be dead by
2237
+ // the time we got around to sending this, so instead we ignore HPACK
2238
+ // compression and just write the uncompressed bytes onto the wire.
2279
2239
  if (!s->sent_initial_metadata) {
2280
2240
  http_status_hdr = GRPC_SLICE_MALLOC(13);
2281
2241
  p = GRPC_SLICE_START_PTR(http_status_hdr);
@@ -2436,9 +2396,9 @@ static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error) {
2436
2396
  GRPC_ERROR_UNREF(error);
2437
2397
  }
2438
2398
 
2439
- /*******************************************************************************
2440
- * INPUT PROCESSING - PARSING
2441
- */
2399
+ //
2400
+ // INPUT PROCESSING - PARSING
2401
+ //
2442
2402
 
2443
2403
  template <class F>
2444
2404
  static void WithUrgency(grpc_chttp2_transport* t,
@@ -2573,8 +2533,8 @@ static void read_action_locked(void* tp, grpc_error* error) {
2573
2533
  "Transport closed", &t->closed_with_error, 1);
2574
2534
  }
2575
2535
  if (error != GRPC_ERROR_NONE) {
2576
- /* If a goaway frame was received, this might be the reason why the read
2577
- * failed. Add this info to the error */
2536
+ // If a goaway frame was received, this might be the reason why the read
2537
+ // failed. Add this info to the error
2578
2538
  if (t->goaway_error != GRPC_ERROR_NONE) {
2579
2539
  error = grpc_error_add_child(error, GRPC_ERROR_REF(t->goaway_error));
2580
2540
  }
@@ -2583,7 +2543,7 @@ static void read_action_locked(void* tp, grpc_error* error) {
2583
2543
  t->endpoint_reading = 0;
2584
2544
  } else if (t->closed_with_error == GRPC_ERROR_NONE) {
2585
2545
  keep_reading = true;
2586
- /* Since we have read a byte, reset the keepalive timer */
2546
+ // Since we have read a byte, reset the keepalive timer
2587
2547
  if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
2588
2548
  grpc_timer_cancel(&t->keepalive_ping_timer);
2589
2549
  }
@@ -2638,13 +2598,13 @@ static void start_bdp_ping(void* tp, grpc_error* error) {
2638
2598
  static void start_bdp_ping_locked(void* tp, grpc_error* error) {
2639
2599
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2640
2600
  if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
2641
- gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string,
2601
+ gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string.c_str(),
2642
2602
  grpc_error_string(error));
2643
2603
  }
2644
2604
  if (error != GRPC_ERROR_NONE || t->closed_with_error != GRPC_ERROR_NONE) {
2645
2605
  return;
2646
2606
  }
2647
- /* Reset the keepalive ping timer */
2607
+ // Reset the keepalive ping timer
2648
2608
  if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
2649
2609
  grpc_timer_cancel(&t->keepalive_ping_timer);
2650
2610
  }
@@ -2662,7 +2622,7 @@ static void finish_bdp_ping(void* tp, grpc_error* error) {
2662
2622
  static void finish_bdp_ping_locked(void* tp, grpc_error* error) {
2663
2623
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2664
2624
  if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
2665
- gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string,
2625
+ gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string.c_str(),
2666
2626
  grpc_error_string(error));
2667
2627
  }
2668
2628
  if (error != GRPC_ERROR_NONE || t->closed_with_error != GRPC_ERROR_NONE) {
@@ -2670,8 +2630,8 @@ static void finish_bdp_ping_locked(void* tp, grpc_error* error) {
2670
2630
  return;
2671
2631
  }
2672
2632
  if (!t->bdp_ping_started) {
2673
- /* start_bdp_ping_locked has not been run yet. Schedule
2674
- * finish_bdp_ping_locked to be run later. */
2633
+ // start_bdp_ping_locked has not been run yet. Schedule
2634
+ // finish_bdp_ping_locked to be run later.
2675
2635
  t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked,
2676
2636
  finish_bdp_ping_locked, t, nullptr),
2677
2637
  GRPC_ERROR_REF(error));
@@ -2804,7 +2764,7 @@ static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
2804
2764
  &t->init_keepalive_ping_locked);
2805
2765
  }
2806
2766
  } else if (error == GRPC_ERROR_CANCELLED) {
2807
- /* The keepalive ping timer may be cancelled by bdp */
2767
+ // The keepalive ping timer may be cancelled by bdp
2808
2768
  GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
2809
2769
  GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping, t,
2810
2770
  grpc_schedule_on_exec_ctx);
@@ -2832,7 +2792,7 @@ static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
2832
2792
  }
2833
2793
  if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
2834
2794
  GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
2835
- gpr_log(GPR_INFO, "%s: Start keepalive ping", t->peer_string);
2795
+ gpr_log(GPR_INFO, "%s: Start keepalive ping", t->peer_string.c_str());
2836
2796
  }
2837
2797
  GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog");
2838
2798
  GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked,
@@ -2856,11 +2816,11 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
2856
2816
  if (error == GRPC_ERROR_NONE) {
2857
2817
  if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
2858
2818
  GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
2859
- gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string);
2819
+ gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string.c_str());
2860
2820
  }
2861
2821
  if (!t->keepalive_ping_started) {
2862
- /* start_keepalive_ping_locked has not run yet. Reschedule
2863
- * finish_keepalive_ping_locked for it to be run later. */
2822
+ // start_keepalive_ping_locked has not run yet. Reschedule
2823
+ // finish_keepalive_ping_locked for it to be run later.
2864
2824
  t->combiner->Run(
2865
2825
  GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
2866
2826
  finish_keepalive_ping_locked, t, nullptr),
@@ -2894,7 +2854,7 @@ static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
2894
2854
  if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
2895
2855
  if (error == GRPC_ERROR_NONE) {
2896
2856
  gpr_log(GPR_INFO, "%s: Keepalive watchdog fired. Closing transport.",
2897
- t->peer_string);
2857
+ t->peer_string.c_str());
2898
2858
  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
2899
2859
  close_transport_locked(
2900
2860
  t, grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
@@ -2903,8 +2863,8 @@ static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
2903
2863
  GRPC_STATUS_UNAVAILABLE));
2904
2864
  }
2905
2865
  } else {
2906
- /* The watchdog timer should have been cancelled by
2907
- * finish_keepalive_ping_locked. */
2866
+ // The watchdog timer should have been cancelled by
2867
+ // finish_keepalive_ping_locked.
2908
2868
  if (GPR_UNLIKELY(error != GRPC_ERROR_CANCELLED)) {
2909
2869
  gpr_log(GPR_ERROR, "keepalive_ping_end state error: %d (expect: %d)",
2910
2870
  t->keepalive_state, GRPC_CHTTP2_KEEPALIVE_STATE_PINGING);
@@ -2913,21 +2873,22 @@ static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
2913
2873
  GRPC_CHTTP2_UNREF_TRANSPORT(t, "keepalive watchdog");
2914
2874
  }
2915
2875
 
2916
- /*******************************************************************************
2917
- * CALLBACK LOOP
2918
- */
2876
+ //
2877
+ // CALLBACK LOOP
2878
+ //
2919
2879
 
2920
2880
  static void connectivity_state_set(grpc_chttp2_transport* t,
2921
2881
  grpc_connectivity_state state,
2882
+ const absl::Status& status,
2922
2883
  const char* reason) {
2923
2884
  GRPC_CHTTP2_IF_TRACING(
2924
2885
  gpr_log(GPR_INFO, "transport %p set connectivity_state=%d", t, state));
2925
- t->state_tracker.SetState(state, reason);
2886
+ t->state_tracker.SetState(state, status, reason);
2926
2887
  }
2927
2888
 
2928
- /*******************************************************************************
2929
- * POLLSET STUFF
2930
- */
2889
+ //
2890
+ // POLLSET STUFF
2891
+ //
2931
2892
 
2932
2893
  static void set_pollset(grpc_transport* gt, grpc_stream* /*gs*/,
2933
2894
  grpc_pollset* pollset) {
@@ -2941,9 +2902,9 @@ static void set_pollset_set(grpc_transport* gt, grpc_stream* /*gs*/,
2941
2902
  grpc_endpoint_add_to_pollset_set(t->ep, pollset_set);
2942
2903
  }
2943
2904
 
2944
- /*******************************************************************************
2945
- * BYTE STREAM
2946
- */
2905
+ //
2906
+ // BYTE STREAM
2907
+ //
2947
2908
 
2948
2909
  static void reset_byte_stream(void* arg, grpc_error* error) {
2949
2910
  grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(arg);
@@ -3031,7 +2992,7 @@ void Chttp2IncomingByteStream::NextLocked(void* arg,
3031
2992
  s->data_parser.parsing_frame = nullptr;
3032
2993
  }
3033
2994
  } else {
3034
- /* Should never reach here. */
2995
+ // Should never reach here.
3035
2996
  GPR_ASSERT(false);
3036
2997
  }
3037
2998
  } else {
@@ -3160,9 +3121,9 @@ void Chttp2IncomingByteStream::Shutdown(grpc_error* error) {
3160
3121
 
3161
3122
  } // namespace grpc_core
3162
3123
 
3163
- /*******************************************************************************
3164
- * RESOURCE QUOTAS
3165
- */
3124
+ //
3125
+ // RESOURCE QUOTAS
3126
+ //
3166
3127
 
3167
3128
  static void post_benign_reclaimer(grpc_chttp2_transport* t) {
3168
3129
  if (!t->benign_reclaimer_registered) {
@@ -3197,11 +3158,11 @@ static void benign_reclaimer_locked(void* arg, grpc_error* error) {
3197
3158
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
3198
3159
  if (error == GRPC_ERROR_NONE &&
3199
3160
  grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
3200
- /* Channel with no active streams: send a goaway to try and make it
3201
- * disconnect cleanly */
3161
+ // Channel with no active streams: send a goaway to try and make it
3162
+ // disconnect cleanly
3202
3163
  if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
3203
3164
  gpr_log(GPR_INFO, "HTTP2: %s - send goaway to free memory",
3204
- t->peer_string);
3165
+ t->peer_string.c_str());
3205
3166
  }
3206
3167
  send_goaway(t,
3207
3168
  grpc_error_set_int(
@@ -3212,7 +3173,8 @@ static void benign_reclaimer_locked(void* arg, grpc_error* error) {
3212
3173
  gpr_log(GPR_INFO,
3213
3174
  "HTTP2: %s - skip benign reclamation, there are still %" PRIdPTR
3214
3175
  " streams",
3215
- t->peer_string, grpc_chttp2_stream_map_size(&t->stream_map));
3176
+ t->peer_string.c_str(),
3177
+ grpc_chttp2_stream_map_size(&t->stream_map));
3216
3178
  }
3217
3179
  t->benign_reclaimer_registered = false;
3218
3180
  if (error != GRPC_ERROR_CANCELLED) {
@@ -3237,8 +3199,8 @@ static void destructive_reclaimer_locked(void* arg, grpc_error* error) {
3237
3199
  grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
3238
3200
  grpc_chttp2_stream_map_rand(&t->stream_map));
3239
3201
  if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
3240
- gpr_log(GPR_INFO, "HTTP2: %s - abandon stream id %d", t->peer_string,
3241
- s->id);
3202
+ gpr_log(GPR_INFO, "HTTP2: %s - abandon stream id %d",
3203
+ t->peer_string.c_str(), s->id);
3242
3204
  }
3243
3205
  grpc_chttp2_cancel_stream(
3244
3206
  t, s,
@@ -3246,10 +3208,10 @@ static void destructive_reclaimer_locked(void* arg, grpc_error* error) {
3246
3208
  GRPC_ERROR_INT_HTTP2_ERROR,
3247
3209
  GRPC_HTTP2_ENHANCE_YOUR_CALM));
3248
3210
  if (n > 1) {
3249
- /* Since we cancel one stream per destructive reclamation, if
3250
- there are more streams left, we can immediately post a new
3251
- reclaimer in case the resource quota needs to free more
3252
- memory */
3211
+ // Since we cancel one stream per destructive reclamation, if
3212
+ // there are more streams left, we can immediately post a new
3213
+ // reclaimer in case the resource quota needs to free more
3214
+ // memory
3253
3215
  post_destructive_reclaimer(t);
3254
3216
  }
3255
3217
  }
@@ -3260,9 +3222,9 @@ static void destructive_reclaimer_locked(void* arg, grpc_error* error) {
3260
3222
  GRPC_CHTTP2_UNREF_TRANSPORT(t, "destructive_reclaimer");
3261
3223
  }
3262
3224
 
3263
- /*******************************************************************************
3264
- * MONITORING
3265
- */
3225
+ //
3226
+ // MONITORING
3227
+ //
3266
3228
 
3267
3229
  const char* grpc_chttp2_initiate_write_reason_string(
3268
3230
  grpc_chttp2_initiate_write_reason reason) {