grpc 1.24.0 → 1.25.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 (504) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +306 -243
  3. data/etc/roots.pem +0 -100
  4. data/include/grpc/grpc_security.h +44 -18
  5. data/include/grpc/impl/codegen/grpc_types.h +15 -0
  6. data/include/grpc/impl/codegen/port_platform.h +27 -11
  7. data/include/grpc/impl/codegen/sync_generic.h +1 -1
  8. data/src/boringssl/err_data.c +695 -650
  9. data/src/core/ext/filters/client_channel/client_channel.cc +257 -179
  10. data/src/core/ext/filters/client_channel/client_channel.h +24 -0
  11. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +2 -3
  12. data/src/core/ext/filters/client_channel/client_channel_factory.h +1 -5
  13. data/src/core/ext/filters/client_channel/health/health_check_client.cc +18 -45
  14. data/src/core/ext/filters/client_channel/health/health_check_client.h +5 -13
  15. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
  16. data/src/core/ext/filters/client_channel/lb_policy.cc +2 -3
  17. data/src/core/ext/filters/client_channel/lb_policy.h +65 -55
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -14
  19. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +113 -36
  20. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +14 -19
  21. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +36 -13
  22. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +3 -10
  23. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +814 -1589
  24. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +2 -5
  25. data/src/core/ext/filters/client_channel/lb_policy_factory.h +3 -6
  26. data/src/core/ext/filters/client_channel/resolver.cc +1 -2
  27. data/src/core/ext/filters/client_channel/resolver.h +8 -16
  28. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +25 -8
  29. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +46 -12
  30. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +10 -17
  31. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +7 -8
  32. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -4
  33. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +111 -44
  34. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +22 -14
  35. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +1 -1
  36. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +2 -2
  37. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +29 -10
  38. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +27 -36
  39. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +7 -10
  40. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +60 -16
  41. data/src/core/ext/filters/client_channel/resolver_factory.h +4 -8
  42. data/src/core/ext/filters/client_channel/resolver_registry.cc +1 -1
  43. data/src/core/ext/filters/client_channel/resolver_registry.h +1 -1
  44. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +7 -10
  45. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +7 -8
  46. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +1 -1
  47. data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -5
  48. data/src/core/ext/filters/client_channel/retry_throttle.h +1 -4
  49. data/src/core/ext/filters/client_channel/service_config.h +8 -8
  50. data/src/core/ext/filters/client_channel/subchannel.cc +53 -86
  51. data/src/core/ext/filters/client_channel/subchannel.h +7 -9
  52. data/src/core/ext/filters/client_channel/subchannel_interface.h +9 -13
  53. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +3 -6
  54. data/src/core/ext/filters/client_channel/{lb_policy/xds/xds_load_balancer_api.cc → xds/xds_api.cc} +169 -52
  55. data/src/core/ext/filters/client_channel/xds/xds_api.h +171 -0
  56. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +450 -0
  57. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +99 -0
  58. data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_channel.h +8 -6
  59. data/src/core/ext/filters/client_channel/xds/xds_channel_args.h +26 -0
  60. data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_channel_secure.cc +28 -11
  61. data/src/core/ext/filters/client_channel/xds/xds_client.cc +1413 -0
  62. data/src/core/ext/filters/client_channel/xds/xds_client.h +221 -0
  63. data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_client_stats.cc +1 -5
  64. data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_client_stats.h +3 -4
  65. data/src/core/ext/filters/deadline/deadline_filter.cc +20 -20
  66. data/src/core/ext/filters/http/client/http_client_filter.cc +15 -15
  67. data/src/core/ext/filters/http/client_authority_filter.cc +14 -14
  68. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +12 -12
  69. data/src/core/ext/filters/max_age/max_age_filter.cc +59 -50
  70. data/src/core/ext/filters/message_size/message_size_filter.cc +18 -18
  71. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +15 -14
  72. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +233 -175
  73. data/src/core/ext/transport/chttp2/transport/flow_control.h +21 -24
  74. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +253 -163
  75. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +24 -12
  76. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +2 -3
  77. data/src/core/ext/transport/chttp2/transport/internal.h +13 -15
  78. data/src/core/ext/transport/chttp2/transport/writing.cc +3 -0
  79. data/src/core/ext/transport/inproc/inproc_transport.cc +20 -13
  80. data/src/core/lib/channel/channel_args.cc +16 -0
  81. data/src/core/lib/channel/channel_args.h +22 -0
  82. data/src/core/lib/channel/channelz.cc +5 -6
  83. data/src/core/lib/channel/channelz.h +1 -1
  84. data/src/core/lib/channel/connected_channel.cc +20 -20
  85. data/src/core/lib/channel/handshaker.h +3 -4
  86. data/src/core/lib/channel/handshaker_factory.h +1 -3
  87. data/src/core/lib/debug/trace.h +3 -2
  88. data/src/core/lib/gprpp/arena.cc +3 -3
  89. data/src/core/lib/gprpp/arena.h +2 -3
  90. data/src/core/lib/gprpp/inlined_vector.h +9 -0
  91. data/src/core/lib/gprpp/map.h +3 -501
  92. data/src/core/lib/gprpp/memory.h +45 -41
  93. data/src/core/lib/gprpp/mpscq.cc +108 -0
  94. data/src/core/lib/gprpp/mpscq.h +98 -0
  95. data/src/core/lib/gprpp/orphanable.h +6 -11
  96. data/src/core/lib/gprpp/ref_counted.h +25 -19
  97. data/src/core/lib/gprpp/set.h +33 -0
  98. data/src/core/lib/gprpp/thd.h +2 -4
  99. data/src/core/lib/http/httpcli.cc +1 -1
  100. data/src/core/lib/http/httpcli_security_connector.cc +15 -11
  101. data/src/core/lib/http/parser.cc +1 -1
  102. data/src/core/lib/iomgr/buffer_list.cc +4 -5
  103. data/src/core/lib/iomgr/buffer_list.h +5 -6
  104. data/src/core/lib/iomgr/call_combiner.cc +4 -5
  105. data/src/core/lib/iomgr/call_combiner.h +2 -2
  106. data/src/core/lib/iomgr/cfstream_handle.h +3 -5
  107. data/src/core/lib/iomgr/closure.h +8 -3
  108. data/src/core/lib/iomgr/combiner.cc +45 -82
  109. data/src/core/lib/iomgr/combiner.h +32 -8
  110. data/src/core/lib/iomgr/endpoint_cfstream.cc +5 -3
  111. data/src/core/lib/iomgr/ev_epoll1_linux.cc +19 -15
  112. data/src/core/lib/iomgr/exec_ctx.h +4 -3
  113. data/src/core/lib/iomgr/executor.cc +4 -2
  114. data/src/core/lib/iomgr/executor.h +3 -0
  115. data/src/core/lib/iomgr/executor/mpmcqueue.h +3 -6
  116. data/src/core/lib/iomgr/executor/threadpool.cc +1 -2
  117. data/src/core/lib/iomgr/executor/threadpool.h +7 -11
  118. data/src/core/lib/iomgr/resource_quota.cc +55 -51
  119. data/src/core/lib/iomgr/resource_quota.h +13 -9
  120. data/src/core/lib/iomgr/socket_utils_common_posix.cc +13 -0
  121. data/src/core/lib/iomgr/socket_utils_posix.h +4 -0
  122. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -11
  123. data/src/core/lib/iomgr/tcp_custom.cc +9 -7
  124. data/src/core/lib/iomgr/tcp_posix.cc +20 -16
  125. data/src/core/lib/iomgr/tcp_server.h +1 -4
  126. data/src/core/lib/iomgr/tcp_server_custom.cc +5 -5
  127. data/src/core/lib/iomgr/tcp_server_posix.cc +1 -1
  128. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +2 -11
  129. data/src/core/lib/iomgr/timer_custom.cc +2 -2
  130. data/src/core/lib/iomgr/udp_server.cc +3 -2
  131. data/src/core/lib/iomgr/udp_server.h +6 -12
  132. data/src/core/lib/json/json.h +1 -1
  133. data/src/core/lib/json/json_string.cc +2 -2
  134. data/src/core/lib/profiling/basic_timers.cc +2 -2
  135. data/src/core/lib/security/credentials/alts/alts_credentials.cc +2 -2
  136. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +1 -1
  137. data/src/core/lib/security/credentials/credentials.h +4 -20
  138. data/src/core/lib/security/credentials/fake/fake_credentials.cc +4 -4
  139. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -3
  140. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +64 -0
  141. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +4 -4
  142. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +9 -7
  143. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +2 -0
  144. data/src/core/lib/security/security_connector/local/local_security_connector.cc +4 -4
  145. data/src/core/lib/security/security_connector/security_connector.cc +1 -0
  146. data/src/core/lib/security/security_connector/security_connector.h +19 -17
  147. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +8 -5
  148. data/src/core/lib/security/security_connector/ssl_utils.cc +2 -2
  149. data/src/core/lib/security/security_connector/ssl_utils.h +1 -1
  150. data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +14 -6
  151. data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +4 -2
  152. data/src/core/lib/security/transport/client_auth_filter.cc +17 -17
  153. data/src/core/lib/security/transport/security_handshaker.cc +29 -13
  154. data/src/core/lib/security/transport/security_handshaker.h +4 -2
  155. data/src/core/lib/security/transport/server_auth_filter.cc +14 -14
  156. data/src/core/lib/slice/slice.cc +2 -10
  157. data/src/core/lib/slice/slice_hash_table.h +4 -6
  158. data/src/core/lib/slice/slice_intern.cc +42 -39
  159. data/src/core/lib/slice/slice_internal.h +3 -3
  160. data/src/core/lib/slice/slice_utils.h +21 -4
  161. data/src/core/lib/slice/slice_weak_hash_table.h +4 -6
  162. data/src/core/lib/surface/call.cc +3 -3
  163. data/src/core/lib/surface/channel.cc +7 -0
  164. data/src/core/lib/surface/completion_queue.cc +12 -11
  165. data/src/core/lib/surface/completion_queue.h +4 -2
  166. data/src/core/lib/surface/init.cc +1 -0
  167. data/src/core/lib/surface/lame_client.cc +33 -18
  168. data/src/core/lib/surface/server.cc +77 -76
  169. data/src/core/lib/surface/version.cc +1 -1
  170. data/src/core/lib/transport/byte_stream.h +3 -7
  171. data/src/core/lib/transport/connectivity_state.cc +112 -98
  172. data/src/core/lib/transport/connectivity_state.h +100 -50
  173. data/src/core/lib/transport/static_metadata.cc +276 -288
  174. data/src/core/lib/transport/static_metadata.h +73 -76
  175. data/src/core/lib/transport/status_conversion.cc +1 -1
  176. data/src/core/lib/transport/status_metadata.cc +1 -1
  177. data/src/core/lib/transport/transport.cc +2 -2
  178. data/src/core/lib/transport/transport.h +12 -4
  179. data/src/core/lib/transport/transport_op_string.cc +14 -11
  180. data/src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc +1 -1
  181. data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +1 -1
  182. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +5 -5
  183. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +12 -2
  184. data/src/core/tsi/fake_transport_security.cc +7 -5
  185. data/src/core/tsi/grpc_shadow_boringssl.h +2918 -2627
  186. data/src/core/tsi/local_transport_security.cc +8 -6
  187. data/src/core/tsi/ssl/session_cache/ssl_session.h +1 -3
  188. data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -2
  189. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +7 -5
  190. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -6
  191. data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -2
  192. data/src/core/tsi/ssl_transport_security.cc +12 -12
  193. data/src/core/tsi/ssl_transport_security.h +2 -2
  194. data/src/core/tsi/transport_security_grpc.cc +7 -0
  195. data/src/core/tsi/transport_security_grpc.h +6 -0
  196. data/src/ruby/ext/grpc/extconf.rb +1 -0
  197. data/src/ruby/ext/grpc/rb_call.c +1 -1
  198. data/src/ruby/ext/grpc/rb_channel.c +1 -1
  199. data/src/ruby/lib/grpc/generic/bidi_call.rb +1 -1
  200. data/src/ruby/lib/grpc/generic/rpc_server.rb +1 -1
  201. data/src/ruby/lib/grpc/version.rb +1 -1
  202. data/src/ruby/spec/google_rpc_status_utils_spec.rb +2 -2
  203. data/third_party/boringssl/crypto/asn1/a_bool.c +18 -5
  204. data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +17 -221
  205. data/third_party/boringssl/crypto/asn1/a_dup.c +0 -24
  206. data/third_party/boringssl/crypto/asn1/a_enum.c +2 -2
  207. data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +10 -72
  208. data/third_party/boringssl/crypto/asn1/a_int.c +12 -71
  209. data/third_party/boringssl/crypto/asn1/a_mbstr.c +110 -216
  210. data/third_party/boringssl/crypto/asn1/a_object.c +16 -5
  211. data/third_party/boringssl/crypto/asn1/a_strnid.c +1 -0
  212. data/third_party/boringssl/crypto/asn1/asn1_lib.c +5 -1
  213. data/third_party/boringssl/crypto/asn1/tasn_enc.c +3 -1
  214. data/third_party/boringssl/crypto/base64/base64.c +2 -2
  215. data/third_party/boringssl/crypto/bio/bio.c +73 -9
  216. data/third_party/boringssl/crypto/bio/connect.c +4 -0
  217. data/third_party/boringssl/crypto/bio/fd.c +4 -0
  218. data/third_party/boringssl/crypto/bio/file.c +5 -2
  219. data/third_party/boringssl/crypto/bio/socket.c +4 -0
  220. data/third_party/boringssl/crypto/bio/socket_helper.c +4 -0
  221. data/third_party/boringssl/crypto/bn_extra/convert.c +11 -7
  222. data/third_party/boringssl/crypto/bytestring/ber.c +8 -4
  223. data/third_party/boringssl/crypto/bytestring/cbb.c +19 -7
  224. data/third_party/boringssl/crypto/bytestring/cbs.c +28 -15
  225. data/third_party/boringssl/crypto/bytestring/internal.h +28 -7
  226. data/third_party/boringssl/crypto/bytestring/unicode.c +155 -0
  227. data/third_party/boringssl/crypto/chacha/chacha.c +36 -19
  228. data/third_party/boringssl/crypto/chacha/internal.h +45 -0
  229. data/third_party/boringssl/crypto/cipher_extra/cipher_extra.c +29 -0
  230. data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +269 -25
  231. data/third_party/boringssl/crypto/cipher_extra/e_aesctrhmac.c +16 -14
  232. data/third_party/boringssl/crypto/cipher_extra/e_aesgcmsiv.c +54 -38
  233. data/third_party/boringssl/crypto/cipher_extra/e_chacha20poly1305.c +133 -41
  234. data/third_party/boringssl/crypto/cipher_extra/e_tls.c +23 -15
  235. data/third_party/boringssl/crypto/cipher_extra/tls_cbc.c +24 -15
  236. data/third_party/boringssl/crypto/cmac/cmac.c +62 -25
  237. data/third_party/boringssl/crypto/conf/conf.c +7 -0
  238. data/third_party/boringssl/crypto/cpu-arm-linux.c +4 -148
  239. data/third_party/boringssl/crypto/cpu-arm-linux.h +201 -0
  240. data/third_party/boringssl/crypto/cpu-intel.c +45 -51
  241. data/third_party/boringssl/crypto/crypto.c +39 -22
  242. data/third_party/boringssl/crypto/curve25519/spake25519.c +1 -1
  243. data/third_party/boringssl/crypto/dsa/dsa.c +77 -53
  244. data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +20 -8
  245. data/third_party/boringssl/crypto/ec_extra/ec_derive.c +96 -0
  246. data/third_party/boringssl/crypto/{ecdh/ecdh.c → ecdh_extra/ecdh_extra.c} +20 -58
  247. data/third_party/boringssl/crypto/ecdsa_extra/ecdsa_asn1.c +1 -9
  248. data/third_party/boringssl/crypto/engine/engine.c +2 -1
  249. data/third_party/boringssl/crypto/err/err.c +2 -0
  250. data/third_party/boringssl/crypto/err/internal.h +2 -2
  251. data/third_party/boringssl/crypto/evp/evp.c +89 -8
  252. data/third_party/boringssl/crypto/evp/evp_asn1.c +56 -5
  253. data/third_party/boringssl/crypto/evp/evp_ctx.c +52 -14
  254. data/third_party/boringssl/crypto/evp/internal.h +18 -1
  255. data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +5 -0
  256. data/third_party/boringssl/crypto/evp/p_ec.c +51 -3
  257. data/third_party/boringssl/crypto/evp/p_ec_asn1.c +6 -7
  258. data/third_party/boringssl/crypto/evp/p_ed25519.c +36 -3
  259. data/third_party/boringssl/crypto/evp/p_ed25519_asn1.c +76 -45
  260. data/third_party/boringssl/crypto/evp/p_rsa.c +3 -1
  261. data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +5 -0
  262. data/third_party/boringssl/crypto/evp/p_x25519.c +110 -0
  263. data/third_party/boringssl/crypto/evp/p_x25519_asn1.c +249 -0
  264. data/third_party/boringssl/crypto/evp/scrypt.c +6 -2
  265. data/third_party/boringssl/crypto/fipsmodule/aes/aes.c +34 -274
  266. data/third_party/boringssl/crypto/fipsmodule/aes/internal.h +161 -21
  267. data/third_party/boringssl/crypto/fipsmodule/aes/key_wrap.c +111 -13
  268. data/third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.c +17 -21
  269. data/third_party/boringssl/crypto/fipsmodule/bcm.c +119 -7
  270. data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +19 -2
  271. data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +2 -2
  272. data/third_party/boringssl/crypto/fipsmodule/bn/ctx.c +93 -160
  273. data/third_party/boringssl/crypto/fipsmodule/bn/div.c +48 -57
  274. data/third_party/boringssl/crypto/fipsmodule/bn/div_extra.c +87 -0
  275. data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +143 -211
  276. data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +0 -305
  277. data/third_party/boringssl/crypto/fipsmodule/bn/gcd_extra.c +325 -0
  278. data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +168 -50
  279. data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +68 -92
  280. data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +7 -6
  281. data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +11 -14
  282. data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +358 -443
  283. data/third_party/boringssl/crypto/fipsmodule/bn/random.c +25 -35
  284. data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c +20 -25
  285. data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +76 -5
  286. data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +14 -14
  287. data/third_party/boringssl/crypto/fipsmodule/cipher/cipher.c +7 -2
  288. data/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c +383 -516
  289. data/third_party/boringssl/crypto/fipsmodule/cipher/e_des.c +4 -0
  290. data/third_party/boringssl/crypto/fipsmodule/cipher/internal.h +3 -4
  291. data/third_party/boringssl/crypto/fipsmodule/delocate.h +3 -2
  292. data/third_party/boringssl/crypto/fipsmodule/digest/digest.c +32 -17
  293. data/third_party/boringssl/crypto/fipsmodule/digest/md32_common.h +3 -3
  294. data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +228 -122
  295. data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +34 -8
  296. data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +311 -98
  297. data/third_party/boringssl/crypto/fipsmodule/ec/felem.c +82 -0
  298. data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +263 -97
  299. data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +22 -59
  300. data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +317 -234
  301. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +9473 -9475
  302. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +313 -109
  303. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h +36 -0
  304. data/third_party/boringssl/crypto/fipsmodule/ec/scalar.c +96 -0
  305. data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +126 -792
  306. data/third_party/boringssl/crypto/fipsmodule/ec/simple_mul.c +84 -0
  307. data/third_party/boringssl/crypto/fipsmodule/ec/util.c +163 -12
  308. data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +84 -211
  309. data/third_party/boringssl/crypto/fipsmodule/ecdh/ecdh.c +122 -0
  310. data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +60 -205
  311. data/third_party/boringssl/crypto/fipsmodule/fips_shared_support.c +32 -0
  312. data/third_party/boringssl/crypto/fipsmodule/is_fips.c +2 -0
  313. data/third_party/boringssl/crypto/fipsmodule/md4/md4.c +3 -1
  314. data/third_party/boringssl/crypto/fipsmodule/md5/internal.h +37 -0
  315. data/third_party/boringssl/crypto/fipsmodule/md5/md5.c +11 -8
  316. data/third_party/boringssl/crypto/fipsmodule/modes/cbc.c +35 -79
  317. data/third_party/boringssl/crypto/fipsmodule/modes/cfb.c +7 -39
  318. data/third_party/boringssl/crypto/fipsmodule/modes/ctr.c +7 -27
  319. data/third_party/boringssl/crypto/fipsmodule/modes/gcm.c +123 -309
  320. data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +189 -126
  321. data/third_party/boringssl/crypto/fipsmodule/modes/ofb.c +3 -2
  322. data/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c +2 -2
  323. data/third_party/boringssl/crypto/fipsmodule/rand/internal.h +35 -0
  324. data/third_party/boringssl/crypto/fipsmodule/rand/rand.c +24 -19
  325. data/third_party/boringssl/crypto/fipsmodule/rand/urandom.c +256 -77
  326. data/third_party/boringssl/crypto/fipsmodule/rsa/padding.c +10 -7
  327. data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +5 -1
  328. data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +131 -14
  329. data/third_party/boringssl/crypto/fipsmodule/self_check/self_check.c +83 -10
  330. data/third_party/boringssl/crypto/fipsmodule/sha/internal.h +53 -0
  331. data/third_party/boringssl/crypto/fipsmodule/sha/sha1.c +9 -13
  332. data/third_party/boringssl/crypto/fipsmodule/sha/sha256.c +18 -12
  333. data/third_party/boringssl/crypto/fipsmodule/sha/sha512.c +95 -168
  334. data/third_party/boringssl/crypto/hrss/hrss.c +2201 -0
  335. data/third_party/boringssl/crypto/hrss/internal.h +62 -0
  336. data/third_party/boringssl/crypto/internal.h +95 -20
  337. data/third_party/boringssl/crypto/lhash/lhash.c +45 -33
  338. data/third_party/boringssl/crypto/mem.c +39 -2
  339. data/third_party/boringssl/crypto/obj/obj.c +4 -4
  340. data/third_party/boringssl/crypto/obj/obj_dat.h +6181 -875
  341. data/third_party/boringssl/crypto/pem/pem_all.c +2 -3
  342. data/third_party/boringssl/crypto/pem/pem_info.c +144 -162
  343. data/third_party/boringssl/crypto/pem/pem_lib.c +53 -52
  344. data/third_party/boringssl/crypto/pem/pem_pkey.c +13 -21
  345. data/third_party/boringssl/crypto/pkcs7/pkcs7.c +15 -22
  346. data/third_party/boringssl/crypto/pkcs7/pkcs7_x509.c +168 -16
  347. data/third_party/boringssl/crypto/pkcs8/internal.h +11 -0
  348. data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +24 -15
  349. data/third_party/boringssl/crypto/pkcs8/pkcs8.c +42 -25
  350. data/third_party/boringssl/crypto/pkcs8/pkcs8_x509.c +559 -43
  351. data/third_party/boringssl/crypto/pool/internal.h +1 -1
  352. data/third_party/boringssl/crypto/pool/pool.c +21 -0
  353. data/third_party/boringssl/crypto/rand_extra/deterministic.c +8 -0
  354. data/third_party/boringssl/crypto/rand_extra/fuchsia.c +1 -14
  355. data/third_party/boringssl/crypto/refcount_lock.c +2 -2
  356. data/third_party/boringssl/crypto/rsa_extra/rsa_print.c +22 -0
  357. data/third_party/boringssl/crypto/siphash/siphash.c +80 -0
  358. data/third_party/boringssl/crypto/stack/stack.c +83 -32
  359. data/third_party/boringssl/crypto/thread_none.c +2 -2
  360. data/third_party/boringssl/crypto/thread_pthread.c +2 -2
  361. data/third_party/boringssl/crypto/thread_win.c +38 -19
  362. data/third_party/boringssl/crypto/x509/a_strex.c +22 -2
  363. data/third_party/boringssl/crypto/x509/asn1_gen.c +2 -1
  364. data/third_party/boringssl/crypto/x509/by_dir.c +7 -0
  365. data/third_party/boringssl/crypto/x509/by_file.c +12 -10
  366. data/third_party/boringssl/crypto/x509/t_crl.c +5 -8
  367. data/third_party/boringssl/crypto/x509/t_req.c +1 -3
  368. data/third_party/boringssl/crypto/x509/t_x509.c +5 -8
  369. data/third_party/boringssl/crypto/x509/x509_cmp.c +1 -1
  370. data/third_party/boringssl/crypto/x509/x509_def.c +1 -1
  371. data/third_party/boringssl/crypto/x509/x509_lu.c +114 -5
  372. data/third_party/boringssl/crypto/x509/x509_req.c +20 -0
  373. data/third_party/boringssl/crypto/x509/x509_set.c +5 -0
  374. data/third_party/boringssl/crypto/x509/x509_trs.c +1 -0
  375. data/third_party/boringssl/crypto/x509/x509_txt.c +4 -5
  376. data/third_party/boringssl/crypto/x509/x509_vfy.c +145 -138
  377. data/third_party/boringssl/crypto/x509/x509_vpm.c +2 -0
  378. data/third_party/boringssl/crypto/x509/x509cset.c +40 -0
  379. data/third_party/boringssl/crypto/x509/x509name.c +2 -3
  380. data/third_party/boringssl/crypto/x509/x_all.c +109 -210
  381. data/third_party/boringssl/crypto/x509/x_x509.c +6 -0
  382. data/third_party/boringssl/crypto/x509v3/ext_dat.h +1 -3
  383. data/third_party/boringssl/crypto/x509v3/internal.h +56 -0
  384. data/third_party/boringssl/crypto/x509v3/pcy_cache.c +2 -0
  385. data/third_party/boringssl/crypto/x509v3/pcy_node.c +1 -0
  386. data/third_party/boringssl/crypto/x509v3/pcy_tree.c +4 -2
  387. data/third_party/boringssl/crypto/x509v3/v3_akey.c +5 -2
  388. data/third_party/boringssl/crypto/x509v3/v3_alt.c +19 -13
  389. data/third_party/boringssl/crypto/x509v3/v3_conf.c +2 -1
  390. data/third_party/boringssl/crypto/x509v3/v3_cpols.c +3 -2
  391. data/third_party/boringssl/crypto/x509v3/v3_genn.c +1 -6
  392. data/third_party/boringssl/crypto/x509v3/v3_lib.c +1 -0
  393. data/third_party/boringssl/crypto/x509v3/v3_ocsp.c +68 -0
  394. data/third_party/boringssl/crypto/x509v3/v3_pci.c +2 -1
  395. data/third_party/boringssl/crypto/x509v3/v3_purp.c +47 -69
  396. data/third_party/boringssl/crypto/x509v3/v3_skey.c +5 -2
  397. data/third_party/boringssl/crypto/x509v3/v3_utl.c +69 -25
  398. data/third_party/boringssl/include/openssl/aead.h +45 -19
  399. data/third_party/boringssl/include/openssl/aes.h +32 -7
  400. data/third_party/boringssl/include/openssl/asn1.h +7 -77
  401. data/third_party/boringssl/include/openssl/base.h +120 -6
  402. data/third_party/boringssl/include/openssl/base64.h +4 -1
  403. data/third_party/boringssl/include/openssl/bio.h +112 -81
  404. data/third_party/boringssl/include/openssl/blowfish.h +3 -3
  405. data/third_party/boringssl/include/openssl/bn.h +55 -29
  406. data/third_party/boringssl/include/openssl/buf.h +2 -2
  407. data/third_party/boringssl/include/openssl/bytestring.h +54 -32
  408. data/third_party/boringssl/include/openssl/cast.h +2 -2
  409. data/third_party/boringssl/include/openssl/cipher.h +46 -16
  410. data/third_party/boringssl/include/openssl/cmac.h +6 -2
  411. data/third_party/boringssl/include/openssl/conf.h +3 -6
  412. data/third_party/boringssl/include/openssl/cpu.h +25 -9
  413. data/third_party/boringssl/include/openssl/crypto.h +32 -10
  414. data/third_party/boringssl/include/openssl/curve25519.h +4 -4
  415. data/third_party/boringssl/include/openssl/dh.h +3 -2
  416. data/third_party/boringssl/include/openssl/digest.h +21 -7
  417. data/third_party/boringssl/include/openssl/dsa.h +8 -2
  418. data/third_party/boringssl/include/openssl/e_os2.h +18 -0
  419. data/third_party/boringssl/include/openssl/ec.h +25 -21
  420. data/third_party/boringssl/include/openssl/ec_key.h +36 -8
  421. data/third_party/boringssl/include/openssl/ecdh.h +17 -0
  422. data/third_party/boringssl/include/openssl/ecdsa.h +3 -3
  423. data/third_party/boringssl/include/openssl/engine.h +4 -4
  424. data/third_party/boringssl/include/openssl/err.h +3 -0
  425. data/third_party/boringssl/include/openssl/evp.h +199 -42
  426. data/third_party/boringssl/include/openssl/hmac.h +4 -4
  427. data/third_party/boringssl/include/openssl/hrss.h +100 -0
  428. data/third_party/boringssl/include/openssl/lhash.h +131 -23
  429. data/third_party/boringssl/include/openssl/md4.h +6 -4
  430. data/third_party/boringssl/include/openssl/md5.h +6 -4
  431. data/third_party/boringssl/include/openssl/mem.h +6 -2
  432. data/third_party/boringssl/include/openssl/nid.h +3 -0
  433. data/third_party/boringssl/include/openssl/obj.h +3 -0
  434. data/third_party/boringssl/include/openssl/pem.h +102 -64
  435. data/third_party/boringssl/include/openssl/pkcs7.h +136 -3
  436. data/third_party/boringssl/include/openssl/pkcs8.h +42 -3
  437. data/third_party/boringssl/include/openssl/pool.h +13 -2
  438. data/third_party/boringssl/include/openssl/ripemd.h +5 -4
  439. data/third_party/boringssl/include/openssl/rsa.h +46 -15
  440. data/third_party/boringssl/include/openssl/sha.h +40 -28
  441. data/third_party/boringssl/include/openssl/siphash.h +37 -0
  442. data/third_party/boringssl/include/openssl/span.h +17 -9
  443. data/third_party/boringssl/include/openssl/ssl.h +766 -393
  444. data/third_party/boringssl/include/openssl/ssl3.h +4 -3
  445. data/third_party/boringssl/include/openssl/stack.h +134 -77
  446. data/third_party/boringssl/include/openssl/thread.h +1 -1
  447. data/third_party/boringssl/include/openssl/tls1.h +25 -9
  448. data/third_party/boringssl/include/openssl/type_check.h +14 -15
  449. data/third_party/boringssl/include/openssl/x509.h +28 -3
  450. data/third_party/boringssl/include/openssl/x509_vfy.h +98 -32
  451. data/third_party/boringssl/include/openssl/x509v3.h +17 -13
  452. data/third_party/boringssl/ssl/d1_both.cc +9 -18
  453. data/third_party/boringssl/ssl/d1_lib.cc +4 -3
  454. data/third_party/boringssl/ssl/d1_pkt.cc +4 -4
  455. data/third_party/boringssl/ssl/d1_srtp.cc +15 -15
  456. data/third_party/boringssl/ssl/dtls_method.cc +0 -1
  457. data/third_party/boringssl/ssl/dtls_record.cc +28 -28
  458. data/third_party/boringssl/ssl/handoff.cc +295 -91
  459. data/third_party/boringssl/ssl/handshake.cc +133 -72
  460. data/third_party/boringssl/ssl/handshake_client.cc +218 -189
  461. data/third_party/boringssl/ssl/handshake_server.cc +399 -272
  462. data/third_party/boringssl/ssl/internal.h +1413 -928
  463. data/third_party/boringssl/ssl/s3_both.cc +175 -36
  464. data/third_party/boringssl/ssl/s3_lib.cc +9 -13
  465. data/third_party/boringssl/ssl/s3_pkt.cc +63 -29
  466. data/third_party/boringssl/ssl/ssl_aead_ctx.cc +55 -35
  467. data/third_party/boringssl/ssl/ssl_asn1.cc +57 -73
  468. data/third_party/boringssl/ssl/ssl_buffer.cc +13 -12
  469. data/third_party/boringssl/ssl/ssl_cert.cc +313 -210
  470. data/third_party/boringssl/ssl/ssl_cipher.cc +159 -221
  471. data/third_party/boringssl/ssl/ssl_file.cc +2 -0
  472. data/third_party/boringssl/ssl/ssl_key_share.cc +164 -19
  473. data/third_party/boringssl/ssl/ssl_lib.cc +847 -555
  474. data/third_party/boringssl/ssl/ssl_privkey.cc +441 -111
  475. data/third_party/boringssl/ssl/ssl_session.cc +230 -178
  476. data/third_party/boringssl/ssl/ssl_transcript.cc +21 -142
  477. data/third_party/boringssl/ssl/ssl_versions.cc +88 -93
  478. data/third_party/boringssl/ssl/ssl_x509.cc +279 -218
  479. data/third_party/boringssl/ssl/t1_enc.cc +5 -96
  480. data/third_party/boringssl/ssl/t1_lib.cc +931 -678
  481. data/third_party/boringssl/ssl/tls13_both.cc +251 -121
  482. data/third_party/boringssl/ssl/tls13_client.cc +129 -73
  483. data/third_party/boringssl/ssl/tls13_enc.cc +350 -282
  484. data/third_party/boringssl/ssl/tls13_server.cc +259 -192
  485. data/third_party/boringssl/ssl/tls_method.cc +26 -21
  486. data/third_party/boringssl/ssl/tls_record.cc +42 -47
  487. data/third_party/boringssl/third_party/fiat/curve25519.c +261 -1324
  488. data/third_party/boringssl/third_party/fiat/curve25519_32.h +911 -0
  489. data/third_party/boringssl/third_party/fiat/curve25519_64.h +559 -0
  490. data/third_party/boringssl/third_party/fiat/p256.c +238 -999
  491. data/third_party/boringssl/third_party/fiat/p256_32.h +3226 -0
  492. data/third_party/boringssl/third_party/fiat/p256_64.h +1217 -0
  493. data/third_party/upb/upb/port_def.inc +1 -1
  494. data/third_party/upb/upb/table.c +2 -1
  495. metadata +71 -43
  496. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +0 -127
  497. data/src/core/lib/gpr/mpscq.cc +0 -117
  498. data/src/core/lib/gpr/mpscq.h +0 -88
  499. data/src/core/lib/gprpp/abstract.h +0 -47
  500. data/src/core/lib/gprpp/pair.h +0 -38
  501. data/third_party/boringssl/crypto/cipher_extra/e_ssl3.c +0 -460
  502. data/third_party/boringssl/crypto/fipsmodule/modes/ccm.c +0 -256
  503. data/third_party/boringssl/include/openssl/lhash_macros.h +0 -174
  504. data/third_party/boringssl/ssl/custom_extensions.cc +0 -265
@@ -441,23 +441,23 @@ static void compress_start_transport_stream_op_batch(
441
441
  }
442
442
 
443
443
  /* Constructor for call_data */
444
- static grpc_error* init_call_elem(grpc_call_element* elem,
445
- const grpc_call_element_args* args) {
444
+ static grpc_error* compress_init_call_elem(grpc_call_element* elem,
445
+ const grpc_call_element_args* args) {
446
446
  new (elem->call_data) call_data(elem, *args);
447
447
  return GRPC_ERROR_NONE;
448
448
  }
449
449
 
450
450
  /* Destructor for call_data */
451
- static void destroy_call_elem(grpc_call_element* elem,
452
- const grpc_call_final_info* final_info,
453
- grpc_closure* ignored) {
451
+ static void compress_destroy_call_elem(grpc_call_element* elem,
452
+ const grpc_call_final_info* final_info,
453
+ grpc_closure* ignored) {
454
454
  call_data* calld = static_cast<call_data*>(elem->call_data);
455
455
  calld->~call_data();
456
456
  }
457
457
 
458
458
  /* Constructor for channel_data */
459
- static grpc_error* init_channel_elem(grpc_channel_element* elem,
460
- grpc_channel_element_args* args) {
459
+ static grpc_error* compress_init_channel_elem(grpc_channel_element* elem,
460
+ grpc_channel_element_args* args) {
461
461
  channel_data* channeld = static_cast<channel_data*>(elem->channel_data);
462
462
  // Get the enabled and the default algorithms from channel args.
463
463
  channeld->enabled_compression_algorithms_bitset =
@@ -487,17 +487,17 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
487
487
  }
488
488
 
489
489
  /* Destructor for channel data */
490
- static void destroy_channel_elem(grpc_channel_element* elem) {}
490
+ static void compress_destroy_channel_elem(grpc_channel_element* elem) {}
491
491
 
492
492
  const grpc_channel_filter grpc_message_compress_filter = {
493
493
  compress_start_transport_stream_op_batch,
494
494
  grpc_channel_next_op,
495
495
  sizeof(call_data),
496
- init_call_elem,
496
+ compress_init_call_elem,
497
497
  grpc_call_stack_ignore_set_pollset_or_pollset_set,
498
- destroy_call_elem,
498
+ compress_destroy_call_elem,
499
499
  sizeof(channel_data),
500
- init_channel_elem,
501
- destroy_channel_elem,
500
+ compress_init_channel_elem,
501
+ compress_destroy_channel_elem,
502
502
  grpc_channel_next_get_info,
503
503
  "message_compress"};
@@ -29,6 +29,9 @@
29
29
  #include "src/core/lib/surface/channel_init.h"
30
30
  #include "src/core/lib/transport/http2_errors.h"
31
31
 
32
+ /* If these settings change, make sure that we are not sending a GOAWAY for
33
+ * inproc transport, since a GOAWAY to inproc ends up destroying the transport.
34
+ */
32
35
  #define DEFAULT_MAX_CONNECTION_AGE_MS INT_MAX
33
36
  #define DEFAULT_MAX_CONNECTION_AGE_GRACE_MS INT_MAX
34
37
  #define DEFAULT_MAX_CONNECTION_IDLE_MS INT_MAX
@@ -87,10 +90,6 @@ struct channel_data {
87
90
  grpc_closure start_max_age_timer_after_init;
88
91
  /* Closure to run when the goaway op is finished and the max_age_timer */
89
92
  grpc_closure start_max_age_grace_timer_after_goaway_op;
90
- /* Closure to run when the channel connectivity state changes */
91
- grpc_closure channel_connectivity_changed;
92
- /* Records the current connectivity state */
93
- grpc_connectivity_state connectivity_state;
94
93
  /* Number of active calls */
95
94
  gpr_atm call_count;
96
95
  /* TODO(zyc): C++lize this state machine */
@@ -217,6 +216,47 @@ static void start_max_idle_timer_after_init(void* arg, grpc_error* error) {
217
216
  "max_age start_max_idle_timer_after_init");
218
217
  }
219
218
 
219
+ namespace grpc_core {
220
+
221
+ class ConnectivityWatcher : public AsyncConnectivityStateWatcherInterface {
222
+ public:
223
+ explicit ConnectivityWatcher(channel_data* chand) : chand_(chand) {
224
+ GRPC_CHANNEL_STACK_REF(chand_->channel_stack, "max_age conn_watch");
225
+ }
226
+
227
+ ~ConnectivityWatcher() {
228
+ GRPC_CHANNEL_STACK_UNREF(chand_->channel_stack, "max_age conn_watch");
229
+ }
230
+
231
+ private:
232
+ void OnConnectivityStateChange(grpc_connectivity_state new_state) override {
233
+ if (new_state != GRPC_CHANNEL_SHUTDOWN) return;
234
+ {
235
+ MutexLock lock(&chand_->max_age_timer_mu);
236
+ if (chand_->max_age_timer_pending) {
237
+ grpc_timer_cancel(&chand_->max_age_timer);
238
+ chand_->max_age_timer_pending = false;
239
+ }
240
+ if (chand_->max_age_grace_timer_pending) {
241
+ grpc_timer_cancel(&chand_->max_age_grace_timer);
242
+ chand_->max_age_grace_timer_pending = false;
243
+ }
244
+ }
245
+ /* If there are no active calls, this increasement will cancel
246
+ max_idle_timer, and prevent max_idle_timer from being started in the
247
+ future. */
248
+ increase_call_count(chand_);
249
+ if (gpr_atm_acq_load(&chand_->idle_state) ==
250
+ MAX_IDLE_STATE_SEEN_EXIT_IDLE) {
251
+ grpc_timer_cancel(&chand_->max_idle_timer);
252
+ }
253
+ }
254
+
255
+ channel_data* chand_;
256
+ };
257
+
258
+ } // namespace grpc_core
259
+
220
260
  static void start_max_age_timer_after_init(void* arg, grpc_error* error) {
221
261
  channel_data* chand = static_cast<channel_data*>(arg);
222
262
  gpr_mu_lock(&chand->max_age_timer_mu);
@@ -227,8 +267,9 @@ static void start_max_age_timer_after_init(void* arg, grpc_error* error) {
227
267
  &chand->close_max_age_channel);
228
268
  gpr_mu_unlock(&chand->max_age_timer_mu);
229
269
  grpc_transport_op* op = grpc_make_transport_op(nullptr);
230
- op->on_connectivity_state_change = &chand->channel_connectivity_changed;
231
- op->connectivity_state = &chand->connectivity_state;
270
+ op->start_connectivity_watch.reset(
271
+ grpc_core::New<grpc_core::ConnectivityWatcher>(chand));
272
+ op->start_connectivity_watch_state = GRPC_CHANNEL_IDLE;
232
273
  grpc_channel_next_op(grpc_channel_stack_element(chand->channel_stack, 0), op);
233
274
  GRPC_CHANNEL_STACK_UNREF(chand->channel_stack,
234
275
  "max_age start_max_age_timer_after_init");
@@ -347,35 +388,6 @@ static void force_close_max_age_channel(void* arg, grpc_error* error) {
347
388
  GRPC_CHANNEL_STACK_UNREF(chand->channel_stack, "max_age max_age_grace_timer");
348
389
  }
349
390
 
350
- static void channel_connectivity_changed(void* arg, grpc_error* error) {
351
- channel_data* chand = static_cast<channel_data*>(arg);
352
- if (chand->connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
353
- grpc_transport_op* op = grpc_make_transport_op(nullptr);
354
- op->on_connectivity_state_change = &chand->channel_connectivity_changed;
355
- op->connectivity_state = &chand->connectivity_state;
356
- grpc_channel_next_op(grpc_channel_stack_element(chand->channel_stack, 0),
357
- op);
358
- } else {
359
- gpr_mu_lock(&chand->max_age_timer_mu);
360
- if (chand->max_age_timer_pending) {
361
- grpc_timer_cancel(&chand->max_age_timer);
362
- chand->max_age_timer_pending = false;
363
- }
364
- if (chand->max_age_grace_timer_pending) {
365
- grpc_timer_cancel(&chand->max_age_grace_timer);
366
- chand->max_age_grace_timer_pending = false;
367
- }
368
- gpr_mu_unlock(&chand->max_age_timer_mu);
369
- /* If there are no active calls, this increasement will cancel
370
- max_idle_timer, and prevent max_idle_timer from being started in the
371
- future. */
372
- increase_call_count(chand);
373
- if (gpr_atm_acq_load(&chand->idle_state) == MAX_IDLE_STATE_SEEN_EXIT_IDLE) {
374
- grpc_timer_cancel(&chand->max_idle_timer);
375
- }
376
- }
377
- }
378
-
379
391
  /* A random jitter of +/-10% will be added to MAX_CONNECTION_AGE to spread out
380
392
  connection storms. Note that the MAX_CONNECTION_AGE option without jitter
381
393
  would not create connection storms by itself, but if there happened to be a
@@ -395,24 +407,24 @@ add_random_max_connection_age_jitter_and_convert_to_grpc_millis(int value) {
395
407
  }
396
408
 
397
409
  /* Constructor for call_data. */
398
- static grpc_error* init_call_elem(grpc_call_element* elem,
399
- const grpc_call_element_args* args) {
410
+ static grpc_error* max_age_init_call_elem(grpc_call_element* elem,
411
+ const grpc_call_element_args* args) {
400
412
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
401
413
  increase_call_count(chand);
402
414
  return GRPC_ERROR_NONE;
403
415
  }
404
416
 
405
417
  /* Destructor for call_data. */
406
- static void destroy_call_elem(grpc_call_element* elem,
407
- const grpc_call_final_info* final_info,
408
- grpc_closure* ignored) {
418
+ static void max_age_destroy_call_elem(grpc_call_element* elem,
419
+ const grpc_call_final_info* final_info,
420
+ grpc_closure* ignored) {
409
421
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
410
422
  decrease_call_count(chand);
411
423
  }
412
424
 
413
425
  /* Constructor for channel_data. */
414
- static grpc_error* init_channel_elem(grpc_channel_element* elem,
415
- grpc_channel_element_args* args) {
426
+ static grpc_error* max_age_init_channel_elem(grpc_channel_element* elem,
427
+ grpc_channel_element_args* args) {
416
428
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
417
429
  gpr_mu_init(&chand->max_age_timer_mu);
418
430
  chand->max_age_timer_pending = false;
@@ -469,9 +481,6 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
469
481
  GRPC_CLOSURE_INIT(&chand->start_max_age_grace_timer_after_goaway_op,
470
482
  start_max_age_grace_timer_after_goaway_op, chand,
471
483
  grpc_schedule_on_exec_ctx);
472
- GRPC_CLOSURE_INIT(&chand->channel_connectivity_changed,
473
- channel_connectivity_changed, chand,
474
- grpc_schedule_on_exec_ctx);
475
484
 
476
485
  if (chand->max_connection_age != GRPC_MILLIS_INF_FUTURE) {
477
486
  /* When the channel reaches its max age, we send down an op with
@@ -499,7 +508,7 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
499
508
  }
500
509
 
501
510
  /* Destructor for channel_data. */
502
- static void destroy_channel_elem(grpc_channel_element* elem) {
511
+ static void max_age_destroy_channel_elem(grpc_channel_element* elem) {
503
512
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
504
513
  gpr_mu_destroy(&chand->max_age_timer_mu);
505
514
  }
@@ -508,12 +517,12 @@ const grpc_channel_filter grpc_max_age_filter = {
508
517
  grpc_call_next_op,
509
518
  grpc_channel_next_op,
510
519
  0, /* sizeof_call_data */
511
- init_call_elem,
520
+ max_age_init_call_elem,
512
521
  grpc_call_stack_ignore_set_pollset_or_pollset_set,
513
- destroy_call_elem,
522
+ max_age_destroy_call_elem,
514
523
  sizeof(channel_data),
515
- init_channel_elem,
516
- destroy_channel_elem,
524
+ max_age_init_channel_elem,
525
+ max_age_destroy_channel_elem,
517
526
  grpc_channel_next_get_info,
518
527
  "max_age"};
519
528
 
@@ -88,13 +88,13 @@ UniquePtr<ServiceConfig::ParsedConfig> MessageSizeParser::ParsePerMethodParams(
88
88
  *error = GRPC_ERROR_CREATE_FROM_VECTOR("Message size parser", &error_list);
89
89
  return nullptr;
90
90
  }
91
- return UniquePtr<ServiceConfig::ParsedConfig>(New<MessageSizeParsedConfig>(
92
- max_request_message_bytes, max_response_message_bytes));
91
+ return MakeUnique<MessageSizeParsedConfig>(max_request_message_bytes,
92
+ max_response_message_bytes);
93
93
  }
94
94
 
95
95
  void MessageSizeParser::Register() {
96
- g_message_size_parser_index = ServiceConfig::RegisterParser(
97
- UniquePtr<ServiceConfig::Parser>(New<MessageSizeParser>()));
96
+ g_message_size_parser_index =
97
+ ServiceConfig::RegisterParser(MakeUnique<MessageSizeParser>());
98
98
  }
99
99
 
100
100
  size_t MessageSizeParser::ParserIndex() { return g_message_size_parser_index; }
@@ -238,7 +238,7 @@ static void recv_trailing_metadata_ready(void* user_data, grpc_error* error) {
238
238
  }
239
239
 
240
240
  // Start transport stream op.
241
- static void start_transport_stream_op_batch(
241
+ static void message_size_start_transport_stream_op_batch(
242
242
  grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
243
243
  call_data* calld = static_cast<call_data*>(elem->call_data);
244
244
  // Check max send message size.
@@ -277,17 +277,17 @@ static void start_transport_stream_op_batch(
277
277
  }
278
278
 
279
279
  // Constructor for call_data.
280
- static grpc_error* init_call_elem(grpc_call_element* elem,
281
- const grpc_call_element_args* args) {
280
+ static grpc_error* message_size_init_call_elem(
281
+ grpc_call_element* elem, const grpc_call_element_args* args) {
282
282
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
283
283
  new (elem->call_data) call_data(elem, *chand, *args);
284
284
  return GRPC_ERROR_NONE;
285
285
  }
286
286
 
287
287
  // Destructor for call_data.
288
- static void destroy_call_elem(grpc_call_element* elem,
289
- const grpc_call_final_info* final_info,
290
- grpc_closure* ignored) {
288
+ static void message_size_destroy_call_elem(
289
+ grpc_call_element* elem, const grpc_call_final_info* final_info,
290
+ grpc_closure* ignored) {
291
291
  call_data* calld = (call_data*)elem->call_data;
292
292
  calld->~call_data();
293
293
  }
@@ -325,8 +325,8 @@ grpc_core::MessageSizeParsedConfig::message_size_limits get_message_size_limits(
325
325
  }
326
326
 
327
327
  // Constructor for channel_data.
328
- static grpc_error* init_channel_elem(grpc_channel_element* elem,
329
- grpc_channel_element_args* args) {
328
+ static grpc_error* message_size_init_channel_elem(
329
+ grpc_channel_element* elem, grpc_channel_element_args* args) {
330
330
  GPR_ASSERT(!args->is_last);
331
331
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
332
332
  new (chand) channel_data();
@@ -355,21 +355,21 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
355
355
  }
356
356
 
357
357
  // Destructor for channel_data.
358
- static void destroy_channel_elem(grpc_channel_element* elem) {
358
+ static void message_size_destroy_channel_elem(grpc_channel_element* elem) {
359
359
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
360
360
  chand->~channel_data();
361
361
  }
362
362
 
363
363
  const grpc_channel_filter grpc_message_size_filter = {
364
- start_transport_stream_op_batch,
364
+ message_size_start_transport_stream_op_batch,
365
365
  grpc_channel_next_op,
366
366
  sizeof(call_data),
367
- init_call_elem,
367
+ message_size_init_call_elem,
368
368
  grpc_call_stack_ignore_set_pollset_or_pollset_set,
369
- destroy_call_elem,
369
+ message_size_destroy_call_elem,
370
370
  sizeof(channel_data),
371
- init_channel_elem,
372
- destroy_channel_elem,
371
+ message_size_init_channel_elem,
372
+ message_size_destroy_channel_elem,
373
373
  grpc_channel_next_get_info,
374
374
  "message_size"};
375
375
 
@@ -75,7 +75,7 @@ static void recv_initial_metadata_ready(void* user_data, grpc_error* error) {
75
75
  }
76
76
 
77
77
  // Start transport stream op.
78
- static void start_transport_stream_op_batch(
78
+ static void cronet_compression_start_transport_stream_op_batch(
79
79
  grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
80
80
  call_data* calld = static_cast<call_data*>(elem->call_data);
81
81
 
@@ -104,8 +104,8 @@ static void start_transport_stream_op_batch(
104
104
  }
105
105
 
106
106
  // Constructor for call_data.
107
- static grpc_error* init_call_elem(grpc_call_element* elem,
108
- const grpc_call_element_args* args) {
107
+ static grpc_error* cronet_compression_init_call_elem(
108
+ grpc_call_element* elem, const grpc_call_element_args* args) {
109
109
  call_data* calld = static_cast<call_data*>(elem->call_data);
110
110
  calld->next_recv_initial_metadata_ready = nullptr;
111
111
  calld->workaround_active = false;
@@ -116,18 +116,19 @@ static grpc_error* init_call_elem(grpc_call_element* elem,
116
116
  }
117
117
 
118
118
  // Destructor for call_data.
119
- static void destroy_call_elem(grpc_call_element* elem,
120
- const grpc_call_final_info* final_info,
121
- grpc_closure* ignored) {}
119
+ static void cronet_compression_destroy_call_elem(
120
+ grpc_call_element* elem, const grpc_call_final_info* final_info,
121
+ grpc_closure* ignored) {}
122
122
 
123
123
  // Constructor for channel_data.
124
- static grpc_error* init_channel_elem(grpc_channel_element* elem,
125
- grpc_channel_element_args* args) {
124
+ static grpc_error* cronet_compression_init_channel_elem(
125
+ grpc_channel_element* elem, grpc_channel_element_args* args) {
126
126
  return GRPC_ERROR_NONE;
127
127
  }
128
128
 
129
129
  // Destructor for channel_data.
130
- static void destroy_channel_elem(grpc_channel_element* elem) {}
130
+ static void cronet_compression_destroy_channel_elem(
131
+ grpc_channel_element* elem) {}
131
132
 
132
133
  // Parse the user agent
133
134
  static bool parse_user_agent(grpc_mdelem md) {
@@ -169,15 +170,15 @@ static bool parse_user_agent(grpc_mdelem md) {
169
170
  }
170
171
 
171
172
  const grpc_channel_filter grpc_workaround_cronet_compression_filter = {
172
- start_transport_stream_op_batch,
173
+ cronet_compression_start_transport_stream_op_batch,
173
174
  grpc_channel_next_op,
174
175
  sizeof(call_data),
175
- init_call_elem,
176
+ cronet_compression_init_call_elem,
176
177
  grpc_call_stack_ignore_set_pollset_or_pollset_set,
177
- destroy_call_elem,
178
+ cronet_compression_destroy_call_elem,
178
179
  0,
179
- init_channel_elem,
180
- destroy_channel_elem,
180
+ cronet_compression_init_channel_elem,
181
+ cronet_compression_destroy_channel_elem,
181
182
  grpc_channel_next_get_info,
182
183
  "workaround_cronet_compression"};
183
184
 
@@ -104,11 +104,14 @@ grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount(false,
104
104
  /* forward declarations of various callbacks that we'll build closures around */
105
105
  static void write_action_begin_locked(void* t, grpc_error* error);
106
106
  static void write_action(void* t, grpc_error* error);
107
+ static void write_action_end(void* t, grpc_error* error);
107
108
  static void write_action_end_locked(void* t, grpc_error* error);
108
109
 
110
+ static void read_action(void* t, grpc_error* error);
109
111
  static void read_action_locked(void* t, grpc_error* error);
110
112
  static void continue_read_action_locked(grpc_chttp2_transport* t);
111
113
 
114
+ static void complete_fetch(void* gs, grpc_error* error);
112
115
  static void complete_fetch_locked(void* gs, grpc_error* error);
113
116
  /** Set a transport level setting, and push it to our peer */
114
117
  static void queue_setting_update(grpc_chttp2_transport* t,
@@ -124,6 +127,8 @@ static void connectivity_state_set(grpc_chttp2_transport* t,
124
127
  grpc_connectivity_state state,
125
128
  const char* reason);
126
129
 
130
+ static void benign_reclaimer(void* t, grpc_error* error);
131
+ static void destructive_reclaimer(void* t, grpc_error* error);
127
132
  static void benign_reclaimer_locked(void* t, grpc_error* error);
128
133
  static void destructive_reclaimer_locked(void* t, grpc_error* error);
129
134
 
@@ -134,8 +139,11 @@ static void close_transport_locked(grpc_chttp2_transport* t, grpc_error* error);
134
139
  static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error);
135
140
 
136
141
  static void schedule_bdp_ping_locked(grpc_chttp2_transport* t);
142
+ static void start_bdp_ping(void* tp, grpc_error* error);
143
+ static void finish_bdp_ping(void* tp, grpc_error* error);
137
144
  static void start_bdp_ping_locked(void* tp, grpc_error* error);
138
145
  static void finish_bdp_ping_locked(void* tp, grpc_error* error);
146
+ static void next_bdp_ping_timer_expired(void* tp, grpc_error* error);
139
147
  static void next_bdp_ping_timer_expired_locked(void* tp, grpc_error* error);
140
148
 
141
149
  static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error);
@@ -145,9 +153,13 @@ static void send_ping_locked(grpc_chttp2_transport* t,
145
153
  static void retry_initiate_ping_locked(void* tp, grpc_error* error);
146
154
 
147
155
  /** keepalive-relevant functions */
156
+ static void init_keepalive_ping(void* arg, grpc_error* error);
148
157
  static void init_keepalive_ping_locked(void* arg, grpc_error* error);
158
+ static void start_keepalive_ping(void* arg, grpc_error* error);
159
+ static void finish_keepalive_ping(void* arg, grpc_error* error);
149
160
  static void start_keepalive_ping_locked(void* arg, grpc_error* error);
150
161
  static void finish_keepalive_ping_locked(void* arg, grpc_error* error);
162
+ static void keepalive_watchdog_fired(void* arg, grpc_error* error);
151
163
  static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error);
152
164
 
153
165
  static void reset_byte_stream(void* arg, grpc_error* error);
@@ -196,7 +208,6 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
196
208
  GPR_ASSERT(grpc_chttp2_stream_map_size(&stream_map) == 0);
197
209
 
198
210
  grpc_chttp2_stream_map_destroy(&stream_map);
199
- grpc_connectivity_state_destroy(&channel_callback.state_tracker);
200
211
 
201
212
  GRPC_COMBINER_UNREF(combiner, "chttp2_transport");
202
213
 
@@ -309,21 +320,7 @@ static bool read_channel_args(grpc_chttp2_transport* t,
309
320
  grpc_channel_arg_get_integer(&channel_args->args[i], {0, 0, 1}));
310
321
  } else if (0 == strcmp(channel_args->args[i].key,
311
322
  GRPC_ARG_OPTIMIZATION_TARGET)) {
312
- if (channel_args->args[i].type != GRPC_ARG_STRING) {
313
- gpr_log(GPR_ERROR, "%s should be a string",
314
- GRPC_ARG_OPTIMIZATION_TARGET);
315
- } else if (0 == strcmp(channel_args->args[i].value.string, "blend")) {
316
- t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY;
317
- } else if (0 == strcmp(channel_args->args[i].value.string, "latency")) {
318
- t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY;
319
- } else if (0 ==
320
- strcmp(channel_args->args[i].value.string, "throughput")) {
321
- t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_THROUGHPUT;
322
- } else {
323
- gpr_log(GPR_ERROR, "%s value '%s' unknown, assuming 'blend'",
324
- GRPC_ARG_OPTIMIZATION_TARGET,
325
- channel_args->args[i].value.string);
326
- }
323
+ gpr_log(GPR_INFO, "GRPC_ARG_OPTIMIZATION_TARGET is deprecated");
327
324
  } else if (0 ==
328
325
  strcmp(channel_args->args[i].key, GRPC_ARG_ENABLE_CHANNELZ)) {
329
326
  channelz_enabled = grpc_channel_arg_get_bool(
@@ -392,36 +389,6 @@ static bool read_channel_args(grpc_chttp2_transport* t,
392
389
  return enable_bdp;
393
390
  }
394
391
 
395
- static void init_transport_closures(grpc_chttp2_transport* t) {
396
- GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t,
397
- grpc_combiner_scheduler(t->combiner));
398
- GRPC_CLOSURE_INIT(&t->benign_reclaimer_locked, benign_reclaimer_locked, t,
399
- grpc_combiner_scheduler(t->combiner));
400
- GRPC_CLOSURE_INIT(&t->destructive_reclaimer_locked,
401
- destructive_reclaimer_locked, t,
402
- grpc_combiner_scheduler(t->combiner));
403
- GRPC_CLOSURE_INIT(&t->retry_initiate_ping_locked, retry_initiate_ping_locked,
404
- t, grpc_combiner_scheduler(t->combiner));
405
- GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked, start_bdp_ping_locked, t,
406
- grpc_combiner_scheduler(t->combiner));
407
- GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked, finish_bdp_ping_locked, t,
408
- grpc_combiner_scheduler(t->combiner));
409
- GRPC_CLOSURE_INIT(&t->next_bdp_ping_timer_expired_locked,
410
- next_bdp_ping_timer_expired_locked, t,
411
- grpc_combiner_scheduler(t->combiner));
412
- GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping_locked,
413
- t, grpc_combiner_scheduler(t->combiner));
414
- GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
415
- start_keepalive_ping_locked, t,
416
- grpc_combiner_scheduler(t->combiner));
417
- GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
418
- finish_keepalive_ping_locked, t,
419
- grpc_combiner_scheduler(t->combiner));
420
- GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked,
421
- keepalive_watchdog_fired_locked, t,
422
- grpc_combiner_scheduler(t->combiner));
423
- }
424
-
425
392
  static void init_transport_keepalive_settings(grpc_chttp2_transport* t) {
426
393
  if (t->is_client) {
427
394
  t->keepalive_time = g_default_client_keepalive_time_ms == INT_MAX
@@ -457,6 +424,8 @@ static void init_keepalive_pings_if_enabled(grpc_chttp2_transport* t) {
457
424
  if (t->keepalive_time != GRPC_MILLIS_INF_FUTURE) {
458
425
  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
459
426
  GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
427
+ GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping, t,
428
+ grpc_schedule_on_exec_ctx);
460
429
  grpc_timer_init(&t->keepalive_ping_timer,
461
430
  grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
462
431
  &t->init_keepalive_ping_locked);
@@ -475,6 +444,8 @@ grpc_chttp2_transport::grpc_chttp2_transport(
475
444
  peer_string(grpc_endpoint_get_peer(ep)),
476
445
  resource_user(resource_user),
477
446
  combiner(grpc_combiner_create()),
447
+ state_tracker(is_client ? "client_transport" : "server_transport",
448
+ GRPC_CHANNEL_READY),
478
449
  is_client(is_client),
479
450
  next_stream_id(is_client ? 1 : 2),
480
451
  deframe_state(is_client ? GRPC_DTS_FH_0 : GRPC_DTS_CLIENT_PREFIX_0) {
@@ -489,9 +460,6 @@ grpc_chttp2_transport::grpc_chttp2_transport(
489
460
  grpc_chttp2_stream_map_init(&stream_map, 8);
490
461
 
491
462
  grpc_slice_buffer_init(&read_buffer);
492
- grpc_connectivity_state_init(
493
- &channel_callback.state_tracker, GRPC_CHANNEL_READY,
494
- is_client ? "client_transport" : "server_transport");
495
463
  grpc_slice_buffer_init(&outbuf);
496
464
  if (is_client) {
497
465
  grpc_slice_buffer_add(&outbuf, grpc_slice_from_copied_string(
@@ -510,8 +478,6 @@ grpc_chttp2_transport::grpc_chttp2_transport(
510
478
  grpc_chttp2_hpack_parser_init(&hpack_parser);
511
479
  grpc_chttp2_goaway_parser_init(&goaway_parser);
512
480
 
513
- init_transport_closures(this);
514
-
515
481
  /* configure http2 the way we like it */
516
482
  if (is_client) {
517
483
  queue_setting_update(this, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0);
@@ -572,9 +538,8 @@ static void destroy_transport_locked(void* tp, grpc_error* error) {
572
538
 
573
539
  static void destroy_transport(grpc_transport* gt) {
574
540
  grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
575
- GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(destroy_transport_locked, t,
576
- grpc_combiner_scheduler(t->combiner)),
577
- GRPC_ERROR_NONE);
541
+ t->combiner->Run(GRPC_CLOSURE_CREATE(destroy_transport_locked, t, nullptr),
542
+ GRPC_ERROR_NONE);
578
543
  }
579
544
 
580
545
  static void close_transport_locked(grpc_chttp2_transport* t,
@@ -685,11 +650,7 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
685
650
  grpc_slice_buffer_init(&frame_storage);
686
651
  grpc_slice_buffer_init(&unprocessed_incoming_frames_buffer);
687
652
  grpc_slice_buffer_init(&flow_controlled_buffer);
688
-
689
- GRPC_CLOSURE_INIT(&complete_fetch_locked, ::complete_fetch_locked, this,
690
- grpc_combiner_scheduler(t->combiner));
691
- GRPC_CLOSURE_INIT(&reset_byte_stream, ::reset_byte_stream, this,
692
- grpc_combiner_scheduler(t->combiner));
653
+ GRPC_CLOSURE_INIT(&reset_byte_stream, ::reset_byte_stream, this, nullptr);
693
654
  }
694
655
 
695
656
  grpc_chttp2_stream::~grpc_chttp2_stream() {
@@ -782,15 +743,14 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
782
743
  }
783
744
 
784
745
  s->destroy_stream_arg = then_schedule_closure;
785
- GRPC_CLOSURE_SCHED(
786
- GRPC_CLOSURE_INIT(&s->destroy_stream, destroy_stream_locked, s,
787
- grpc_combiner_scheduler(t->combiner)),
746
+ t->combiner->Run(
747
+ GRPC_CLOSURE_INIT(&s->destroy_stream, destroy_stream_locked, s, nullptr),
788
748
  GRPC_ERROR_NONE);
789
749
  }
790
750
 
791
751
  grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
792
752
  uint32_t id) {
793
- if (t->channel_callback.accept_stream == nullptr) {
753
+ if (t->accept_stream_cb == nullptr) {
794
754
  return nullptr;
795
755
  }
796
756
  // Don't accept the stream if memory quota doesn't allow. Note that we should
@@ -808,9 +768,8 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
808
768
  grpc_chttp2_stream* accepting = nullptr;
809
769
  GPR_ASSERT(t->accepting_stream == nullptr);
810
770
  t->accepting_stream = &accepting;
811
- t->channel_callback.accept_stream(t->channel_callback.accept_stream_user_data,
812
- &t->base,
813
- (void*)static_cast<uintptr_t>(id));
771
+ t->accept_stream_cb(t->accept_stream_cb_user_data, &t->base,
772
+ (void*)static_cast<uintptr_t>(id));
814
773
  t->accepting_stream = nullptr;
815
774
  return accepting;
816
775
  }
@@ -929,7 +888,6 @@ void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
929
888
  inc_initiate_write_reason(reason);
930
889
  set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING,
931
890
  grpc_chttp2_initiate_write_reason_string(reason));
932
- t->is_first_write_in_batch = true;
933
891
  GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
934
892
  /* Note that the 'write_action_begin_locked' closure is being scheduled
935
893
  * on the 'finally_scheduler' of t->combiner. This means that
@@ -947,10 +905,9 @@ void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
947
905
  * Also, 'write_action_begin_locked' only gathers the bytes into outbuf.
948
906
  * It does not call the endpoint to write the bytes. That is done by the
949
907
  * 'write_action' (which is scheduled by 'write_action_begin_locked') */
950
- GRPC_CLOSURE_SCHED(
908
+ t->combiner->FinallyRun(
951
909
  GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
952
- write_action_begin_locked, t,
953
- grpc_combiner_finally_scheduler(t->combiner)),
910
+ write_action_begin_locked, t, nullptr),
954
911
  GRPC_ERROR_NONE);
955
912
  break;
956
913
  case GRPC_CHTTP2_WRITE_STATE_WRITING:
@@ -970,50 +927,12 @@ void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
970
927
  }
971
928
  }
972
929
 
973
- static grpc_closure_scheduler* write_scheduler(grpc_chttp2_transport* t,
974
- bool early_results_scheduled,
975
- bool partial_write) {
976
- // If we're already in a background poller, don't offload this to an executor
977
- if (grpc_iomgr_is_any_background_poller_thread()) {
978
- return grpc_schedule_on_exec_ctx;
979
- }
980
- /* if it's not the first write in a batch, always offload to the executor:
981
- we'll probably end up queuing against the kernel anyway, so we'll likely
982
- get better latency overall if we switch writing work elsewhere and continue
983
- with application work above */
984
- if (!t->is_first_write_in_batch) {
985
- return grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT);
986
- }
987
- /* equivalently, if it's a partial write, we *know* we're going to be taking a
988
- thread jump to write it because of the above, may as well do so
989
- immediately */
990
- if (partial_write) {
991
- return grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT);
992
- }
993
- switch (t->opt_target) {
994
- case GRPC_CHTTP2_OPTIMIZE_FOR_THROUGHPUT:
995
- /* executor gives us the largest probability of being able to batch a
996
- * write with others on this transport */
997
- return grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT);
998
- case GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY:
999
- return grpc_schedule_on_exec_ctx;
1000
- }
1001
- GPR_UNREACHABLE_CODE(return nullptr);
1002
- }
1003
-
1004
- #define WRITE_STATE_TUPLE_TO_INT(p, i) (2 * (int)(p) + (int)(i))
1005
- static const char* begin_writing_desc(bool partial, bool inlined) {
1006
- switch (WRITE_STATE_TUPLE_TO_INT(partial, inlined)) {
1007
- case WRITE_STATE_TUPLE_TO_INT(false, false):
1008
- return "begin write in background";
1009
- case WRITE_STATE_TUPLE_TO_INT(false, true):
1010
- return "begin write in current thread";
1011
- case WRITE_STATE_TUPLE_TO_INT(true, false):
1012
- return "begin partial write in background";
1013
- case WRITE_STATE_TUPLE_TO_INT(true, true):
1014
- return "begin partial write in current thread";
930
+ static const char* begin_writing_desc(bool partial) {
931
+ if (partial) {
932
+ return "begin partial write in background";
933
+ } else {
934
+ return "begin write in current thread";
1015
935
  }
1016
- GPR_UNREACHABLE_CODE(return "bad state tuple");
1017
936
  }
1018
937
 
1019
938
  static void write_action_begin_locked(void* gt, grpc_error* error_ignored) {
@@ -1030,22 +949,11 @@ static void write_action_begin_locked(void* gt, grpc_error* error_ignored) {
1030
949
  if (r.partial) {
1031
950
  GRPC_STATS_INC_HTTP2_PARTIAL_WRITES();
1032
951
  }
1033
- if (!t->is_first_write_in_batch) {
1034
- GRPC_STATS_INC_HTTP2_WRITES_CONTINUED();
1035
- }
1036
- grpc_closure_scheduler* scheduler =
1037
- write_scheduler(t, r.early_results_scheduled, r.partial);
1038
- if (scheduler != grpc_schedule_on_exec_ctx) {
1039
- GRPC_STATS_INC_HTTP2_WRITES_OFFLOADED();
1040
- }
1041
- set_write_state(
1042
- t,
1043
- r.partial ? GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE
1044
- : GRPC_CHTTP2_WRITE_STATE_WRITING,
1045
- begin_writing_desc(r.partial, scheduler == grpc_schedule_on_exec_ctx));
1046
- GRPC_CLOSURE_SCHED(
1047
- GRPC_CLOSURE_INIT(&t->write_action, write_action, t, scheduler),
1048
- GRPC_ERROR_NONE);
952
+ set_write_state(t,
953
+ r.partial ? GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE
954
+ : GRPC_CHTTP2_WRITE_STATE_WRITING,
955
+ begin_writing_desc(r.partial));
956
+ write_action(t, GRPC_ERROR_NONE);
1049
957
  if (t->reading_paused_on_pending_induced_frames) {
1050
958
  GPR_ASSERT(t->num_pending_induced_frames == 0);
1051
959
  /* We had paused reading, because we had many induced frames (SETTINGS
@@ -1073,11 +981,18 @@ static void write_action(void* gt, grpc_error* error) {
1073
981
  t->cl = nullptr;
1074
982
  grpc_endpoint_write(
1075
983
  t->ep, &t->outbuf,
1076
- GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end_locked, t,
1077
- grpc_combiner_scheduler(t->combiner)),
984
+ GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end, t,
985
+ grpc_schedule_on_exec_ctx),
1078
986
  cl);
1079
987
  }
1080
988
 
989
+ static void write_action_end(void* tp, grpc_error* error) {
990
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
991
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->write_action_end_locked,
992
+ write_action_end_locked, t, nullptr),
993
+ GRPC_ERROR_REF(error));
994
+ }
995
+
1081
996
  /* Callback from the grpc_endpoint after bytes have been written by calling
1082
997
  * sendmsg */
1083
998
  static void write_action_end_locked(void* tp, grpc_error* error) {
@@ -1109,7 +1024,6 @@ static void write_action_end_locked(void* tp, grpc_error* error) {
1109
1024
  case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE:
1110
1025
  GPR_TIMER_MARK("state=writing_stale_no_poller", 0);
1111
1026
  set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING, "continue writing");
1112
- t->is_first_write_in_batch = false;
1113
1027
  GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
1114
1028
  // If the transport is closed, we will retry writing on the endpoint
1115
1029
  // and next write may contain part of the currently serialized frames.
@@ -1119,10 +1033,9 @@ static void write_action_end_locked(void* tp, grpc_error* error) {
1119
1033
  if (!closed) {
1120
1034
  GRPC_CLOSURE_LIST_SCHED(&t->run_after_write);
1121
1035
  }
1122
- GRPC_CLOSURE_RUN(
1036
+ t->combiner->FinallyRun(
1123
1037
  GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
1124
- write_action_begin_locked, t,
1125
- grpc_combiner_finally_scheduler(t->combiner)),
1038
+ write_action_begin_locked, t, nullptr),
1126
1039
  GRPC_ERROR_NONE);
1127
1040
  break;
1128
1041
  }
@@ -1373,8 +1286,10 @@ static void continue_fetching_send_locked(grpc_chttp2_transport* t,
1373
1286
  }
1374
1287
  s->fetching_send_message.reset();
1375
1288
  return; /* early out */
1376
- } else if (s->fetching_send_message->Next(UINT32_MAX,
1377
- &s->complete_fetch_locked)) {
1289
+ } else if (s->fetching_send_message->Next(
1290
+ UINT32_MAX, GRPC_CLOSURE_INIT(&s->complete_fetch_locked,
1291
+ ::complete_fetch, s,
1292
+ grpc_schedule_on_exec_ctx))) {
1378
1293
  grpc_error* error = s->fetching_send_message->Pull(&s->fetching_slice);
1379
1294
  if (error != GRPC_ERROR_NONE) {
1380
1295
  s->fetching_send_message.reset();
@@ -1386,6 +1301,13 @@ static void continue_fetching_send_locked(grpc_chttp2_transport* t,
1386
1301
  }
1387
1302
  }
1388
1303
 
1304
+ static void complete_fetch(void* gs, grpc_error* error) {
1305
+ grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(gs);
1306
+ s->t->combiner->Run(GRPC_CLOSURE_INIT(&s->complete_fetch_locked,
1307
+ ::complete_fetch_locked, s, nullptr),
1308
+ GRPC_ERROR_REF(error));
1309
+ }
1310
+
1389
1311
  static void complete_fetch_locked(void* gs, grpc_error* error) {
1390
1312
  grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(gs);
1391
1313
  grpc_chttp2_transport* t = s->t;
@@ -1736,10 +1658,9 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
1736
1658
 
1737
1659
  GRPC_CHTTP2_STREAM_REF(s, "perform_stream_op");
1738
1660
  op->handler_private.extra_arg = gs;
1739
- GRPC_CLOSURE_SCHED(
1740
- GRPC_CLOSURE_INIT(&op->handler_private.closure, perform_stream_op_locked,
1741
- op, grpc_combiner_scheduler(t->combiner)),
1742
- GRPC_ERROR_NONE);
1661
+ t->combiner->Run(GRPC_CLOSURE_INIT(&op->handler_private.closure,
1662
+ perform_stream_op_locked, op, nullptr),
1663
+ GRPC_ERROR_NONE);
1743
1664
  }
1744
1665
 
1745
1666
  static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error) {
@@ -1775,24 +1696,45 @@ static void send_ping_locked(grpc_chttp2_transport* t,
1775
1696
  */
1776
1697
  static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
1777
1698
  if (t->closed_with_error != GRPC_ERROR_NONE) {
1778
- GRPC_CLOSURE_RUN(&t->start_keepalive_ping_locked,
1779
- GRPC_ERROR_REF(t->closed_with_error));
1780
- GRPC_CLOSURE_RUN(&t->finish_keepalive_ping_locked,
1699
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
1700
+ start_keepalive_ping_locked, t, nullptr),
1781
1701
  GRPC_ERROR_REF(t->closed_with_error));
1702
+ t->combiner->Run(
1703
+ GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
1704
+ finish_keepalive_ping_locked, t, nullptr),
1705
+ GRPC_ERROR_REF(t->closed_with_error));
1782
1706
  return;
1783
1707
  }
1784
1708
  grpc_chttp2_ping_queue* pq = &t->ping_queue;
1785
1709
  if (!grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_INFLIGHT])) {
1786
1710
  /* There is a ping in flight. Add yourself to the inflight closure list. */
1787
- GRPC_CLOSURE_RUN(&t->start_keepalive_ping_locked, GRPC_ERROR_NONE);
1788
- grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_INFLIGHT],
1789
- &t->finish_keepalive_ping_locked, GRPC_ERROR_NONE);
1711
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
1712
+ start_keepalive_ping_locked, t, nullptr),
1713
+ GRPC_ERROR_REF(t->closed_with_error));
1714
+ grpc_closure_list_append(
1715
+ &pq->lists[GRPC_CHTTP2_PCL_INFLIGHT],
1716
+ GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
1717
+ finish_keepalive_ping, t, grpc_schedule_on_exec_ctx),
1718
+ GRPC_ERROR_NONE);
1790
1719
  return;
1791
1720
  }
1792
- grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_INITIATE],
1793
- &t->start_keepalive_ping_locked, GRPC_ERROR_NONE);
1794
- grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_NEXT],
1795
- &t->finish_keepalive_ping_locked, GRPC_ERROR_NONE);
1721
+ grpc_closure_list_append(
1722
+ &pq->lists[GRPC_CHTTP2_PCL_INITIATE],
1723
+ GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked, start_keepalive_ping,
1724
+ t, grpc_schedule_on_exec_ctx),
1725
+ GRPC_ERROR_NONE);
1726
+ grpc_closure_list_append(
1727
+ &pq->lists[GRPC_CHTTP2_PCL_NEXT],
1728
+ GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked, finish_keepalive_ping,
1729
+ t, grpc_schedule_on_exec_ctx),
1730
+ GRPC_ERROR_NONE);
1731
+ }
1732
+
1733
+ void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error* error) {
1734
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
1735
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->retry_initiate_ping_locked,
1736
+ retry_initiate_ping_locked, t, nullptr),
1737
+ GRPC_ERROR_REF(error));
1796
1738
  }
1797
1739
 
1798
1740
  static void retry_initiate_ping_locked(void* tp, grpc_error* error) {
@@ -1860,9 +1802,8 @@ static void perform_transport_op_locked(void* stream_op,
1860
1802
  }
1861
1803
 
1862
1804
  if (op->set_accept_stream) {
1863
- t->channel_callback.accept_stream = op->set_accept_stream_fn;
1864
- t->channel_callback.accept_stream_user_data =
1865
- op->set_accept_stream_user_data;
1805
+ t->accept_stream_cb = op->set_accept_stream_fn;
1806
+ t->accept_stream_cb_user_data = op->set_accept_stream_user_data;
1866
1807
  }
1867
1808
 
1868
1809
  if (op->bind_pollset) {
@@ -1878,10 +1819,12 @@ static void perform_transport_op_locked(void* stream_op,
1878
1819
  grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING);
1879
1820
  }
1880
1821
 
1881
- if (op->on_connectivity_state_change != nullptr) {
1882
- grpc_connectivity_state_notify_on_state_change(
1883
- &t->channel_callback.state_tracker, op->connectivity_state,
1884
- op->on_connectivity_state_change);
1822
+ if (op->start_connectivity_watch != nullptr) {
1823
+ t->state_tracker.AddWatcher(op->start_connectivity_watch_state,
1824
+ std::move(op->start_connectivity_watch));
1825
+ }
1826
+ if (op->stop_connectivity_watch != nullptr) {
1827
+ t->state_tracker.RemoveWatcher(op->stop_connectivity_watch);
1885
1828
  }
1886
1829
 
1887
1830
  if (op->disconnect_with_error != GRPC_ERROR_NONE) {
@@ -1902,10 +1845,9 @@ static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
1902
1845
  }
1903
1846
  op->handler_private.extra_arg = gt;
1904
1847
  GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op");
1905
- GRPC_CLOSURE_SCHED(GRPC_CLOSURE_INIT(&op->handler_private.closure,
1906
- perform_transport_op_locked, op,
1907
- grpc_combiner_scheduler(t->combiner)),
1908
- GRPC_ERROR_NONE);
1848
+ t->combiner->Run(GRPC_CLOSURE_INIT(&op->handler_private.closure,
1849
+ perform_transport_op_locked, op, nullptr),
1850
+ GRPC_ERROR_NONE);
1909
1851
  }
1910
1852
 
1911
1853
  /*******************************************************************************
@@ -2546,6 +2488,13 @@ static grpc_error* try_http_parsing(grpc_chttp2_transport* t) {
2546
2488
  return error;
2547
2489
  }
2548
2490
 
2491
+ static void read_action(void* tp, grpc_error* error) {
2492
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2493
+ t->combiner->Run(
2494
+ GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, nullptr),
2495
+ GRPC_ERROR_REF(error));
2496
+ }
2497
+
2549
2498
  static void read_action_locked(void* tp, grpc_error* error) {
2550
2499
  GPR_TIMER_SCOPE("reading_action_locked", 0);
2551
2500
 
@@ -2643,6 +2592,8 @@ static void read_action_locked(void* tp, grpc_error* error) {
2643
2592
 
2644
2593
  static void continue_read_action_locked(grpc_chttp2_transport* t) {
2645
2594
  const bool urgent = t->goaway_error != GRPC_ERROR_NONE;
2595
+ GRPC_CLOSURE_INIT(&t->read_action_locked, read_action, t,
2596
+ grpc_schedule_on_exec_ctx);
2646
2597
  grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent);
2647
2598
  grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t, nullptr);
2648
2599
  }
@@ -2651,7 +2602,19 @@ static void continue_read_action_locked(grpc_chttp2_transport* t) {
2651
2602
  // that kicks off finishes, it's unreffed
2652
2603
  static void schedule_bdp_ping_locked(grpc_chttp2_transport* t) {
2653
2604
  t->flow_control->bdp_estimator()->SchedulePing();
2654
- send_ping_locked(t, &t->start_bdp_ping_locked, &t->finish_bdp_ping_locked);
2605
+ send_ping_locked(
2606
+ t,
2607
+ GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked, start_bdp_ping, t,
2608
+ grpc_schedule_on_exec_ctx),
2609
+ GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked, finish_bdp_ping, t,
2610
+ grpc_schedule_on_exec_ctx));
2611
+ }
2612
+
2613
+ static void start_bdp_ping(void* tp, grpc_error* error) {
2614
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2615
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked,
2616
+ start_bdp_ping_locked, t, nullptr),
2617
+ GRPC_ERROR_REF(error));
2655
2618
  }
2656
2619
 
2657
2620
  static void start_bdp_ping_locked(void* tp, grpc_error* error) {
@@ -2668,6 +2631,14 @@ static void start_bdp_ping_locked(void* tp, grpc_error* error) {
2668
2631
  grpc_timer_cancel(&t->keepalive_ping_timer);
2669
2632
  }
2670
2633
  t->flow_control->bdp_estimator()->StartPing();
2634
+ t->bdp_ping_started = true;
2635
+ }
2636
+
2637
+ static void finish_bdp_ping(void* tp, grpc_error* error) {
2638
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2639
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked,
2640
+ finish_bdp_ping_locked, t, nullptr),
2641
+ GRPC_ERROR_REF(error));
2671
2642
  }
2672
2643
 
2673
2644
  static void finish_bdp_ping_locked(void* tp, grpc_error* error) {
@@ -2680,15 +2651,34 @@ static void finish_bdp_ping_locked(void* tp, grpc_error* error) {
2680
2651
  GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
2681
2652
  return;
2682
2653
  }
2654
+ if (!t->bdp_ping_started) {
2655
+ /* start_bdp_ping_locked has not been run yet. Schedule
2656
+ * finish_bdp_ping_locked to be run later. */
2657
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked,
2658
+ finish_bdp_ping_locked, t, nullptr),
2659
+ GRPC_ERROR_REF(error));
2660
+ return;
2661
+ }
2662
+ t->bdp_ping_started = false;
2683
2663
  grpc_millis next_ping = t->flow_control->bdp_estimator()->CompletePing();
2684
2664
  grpc_chttp2_act_on_flowctl_action(t->flow_control->PeriodicUpdate(), t,
2685
2665
  nullptr);
2686
2666
  GPR_ASSERT(!t->have_next_bdp_ping_timer);
2687
2667
  t->have_next_bdp_ping_timer = true;
2668
+ GRPC_CLOSURE_INIT(&t->next_bdp_ping_timer_expired_locked,
2669
+ next_bdp_ping_timer_expired, t, grpc_schedule_on_exec_ctx);
2688
2670
  grpc_timer_init(&t->next_bdp_ping_timer, next_ping,
2689
2671
  &t->next_bdp_ping_timer_expired_locked);
2690
2672
  }
2691
2673
 
2674
+ static void next_bdp_ping_timer_expired(void* tp, grpc_error* error) {
2675
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2676
+ t->combiner->Run(
2677
+ GRPC_CLOSURE_INIT(&t->next_bdp_ping_timer_expired_locked,
2678
+ next_bdp_ping_timer_expired_locked, t, nullptr),
2679
+ GRPC_ERROR_REF(error));
2680
+ }
2681
+
2692
2682
  static void next_bdp_ping_timer_expired_locked(void* tp, grpc_error* error) {
2693
2683
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2694
2684
  GPR_ASSERT(t->have_next_bdp_ping_timer);
@@ -2767,6 +2757,13 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
2767
2757
  }
2768
2758
  }
2769
2759
 
2760
+ static void init_keepalive_ping(void* arg, grpc_error* error) {
2761
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2762
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked,
2763
+ init_keepalive_ping_locked, t, nullptr),
2764
+ GRPC_ERROR_REF(error));
2765
+ }
2766
+
2770
2767
  static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
2771
2768
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2772
2769
  GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING);
@@ -2782,6 +2779,8 @@ static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
2782
2779
  grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING);
2783
2780
  } else {
2784
2781
  GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
2782
+ GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping, t,
2783
+ grpc_schedule_on_exec_ctx);
2785
2784
  grpc_timer_init(&t->keepalive_ping_timer,
2786
2785
  grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
2787
2786
  &t->init_keepalive_ping_locked);
@@ -2789,6 +2788,8 @@ static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
2789
2788
  } else if (error == GRPC_ERROR_CANCELLED) {
2790
2789
  /* The keepalive ping timer may be cancelled by bdp */
2791
2790
  GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
2791
+ GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping, t,
2792
+ grpc_schedule_on_exec_ctx);
2792
2793
  grpc_timer_init(&t->keepalive_ping_timer,
2793
2794
  grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
2794
2795
  &t->init_keepalive_ping_locked);
@@ -2796,6 +2797,13 @@ static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
2796
2797
  GRPC_CHTTP2_UNREF_TRANSPORT(t, "init keepalive ping");
2797
2798
  }
2798
2799
 
2800
+ static void start_keepalive_ping(void* arg, grpc_error* error) {
2801
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2802
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
2803
+ start_keepalive_ping_locked, t, nullptr),
2804
+ GRPC_ERROR_REF(error));
2805
+ }
2806
+
2799
2807
  static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
2800
2808
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2801
2809
  if (error != GRPC_ERROR_NONE) {
@@ -2808,9 +2816,19 @@ static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
2808
2816
  gpr_log(GPR_INFO, "%s: Start keepalive ping", t->peer_string);
2809
2817
  }
2810
2818
  GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog");
2819
+ GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked,
2820
+ keepalive_watchdog_fired, t, grpc_schedule_on_exec_ctx);
2811
2821
  grpc_timer_init(&t->keepalive_watchdog_timer,
2812
2822
  grpc_core::ExecCtx::Get()->Now() + t->keepalive_timeout,
2813
2823
  &t->keepalive_watchdog_fired_locked);
2824
+ t->keepalive_ping_started = true;
2825
+ }
2826
+
2827
+ static void finish_keepalive_ping(void* arg, grpc_error* error) {
2828
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2829
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
2830
+ finish_keepalive_ping_locked, t, nullptr),
2831
+ GRPC_ERROR_REF(error));
2814
2832
  }
2815
2833
 
2816
2834
  static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
@@ -2820,9 +2838,21 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
2820
2838
  if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
2821
2839
  gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string);
2822
2840
  }
2841
+ if (!t->keepalive_ping_started) {
2842
+ /* start_keepalive_ping_locked has not run yet. Reschedule
2843
+ * finish_keepalive_ping_locked for it to be run later. */
2844
+ t->combiner->Run(
2845
+ GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
2846
+ finish_keepalive_ping_locked, t, nullptr),
2847
+ GRPC_ERROR_REF(error));
2848
+ return;
2849
+ }
2850
+ t->keepalive_ping_started = false;
2823
2851
  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
2824
2852
  grpc_timer_cancel(&t->keepalive_watchdog_timer);
2825
2853
  GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
2854
+ GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping, t,
2855
+ grpc_schedule_on_exec_ctx);
2826
2856
  grpc_timer_init(&t->keepalive_ping_timer,
2827
2857
  grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
2828
2858
  &t->init_keepalive_ping_locked);
@@ -2831,6 +2861,14 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
2831
2861
  GRPC_CHTTP2_UNREF_TRANSPORT(t, "keepalive ping end");
2832
2862
  }
2833
2863
 
2864
+ static void keepalive_watchdog_fired(void* arg, grpc_error* error) {
2865
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2866
+ t->combiner->Run(
2867
+ GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked,
2868
+ keepalive_watchdog_fired_locked, t, nullptr),
2869
+ GRPC_ERROR_REF(error));
2870
+ }
2871
+
2834
2872
  static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
2835
2873
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2836
2874
  if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
@@ -2864,8 +2902,7 @@ static void connectivity_state_set(grpc_chttp2_transport* t,
2864
2902
  const char* reason) {
2865
2903
  GRPC_CHTTP2_IF_TRACING(
2866
2904
  gpr_log(GPR_INFO, "transport %p set connectivity_state=%d", t, state));
2867
- grpc_connectivity_state_set(&t->channel_callback.state_tracker, state,
2868
- reason);
2905
+ t->state_tracker.SetState(state, reason);
2869
2906
  }
2870
2907
 
2871
2908
  /*******************************************************************************
@@ -2932,10 +2969,9 @@ void Chttp2IncomingByteStream::OrphanLocked(void* arg,
2932
2969
 
2933
2970
  void Chttp2IncomingByteStream::Orphan() {
2934
2971
  GPR_TIMER_SCOPE("incoming_byte_stream_destroy", 0);
2935
- GRPC_CLOSURE_SCHED(
2972
+ transport_->combiner->Run(
2936
2973
  GRPC_CLOSURE_INIT(&destroy_action_,
2937
- &Chttp2IncomingByteStream::OrphanLocked, this,
2938
- grpc_combiner_scheduler(transport_->combiner)),
2974
+ &Chttp2IncomingByteStream::OrphanLocked, this, nullptr),
2939
2975
  GRPC_ERROR_NONE);
2940
2976
  }
2941
2977
 
@@ -2992,10 +3028,9 @@ bool Chttp2IncomingByteStream::Next(size_t max_size_hint,
2992
3028
  Ref();
2993
3029
  next_action_.max_size_hint = max_size_hint;
2994
3030
  next_action_.on_complete = on_complete;
2995
- GRPC_CLOSURE_SCHED(
3031
+ transport_->combiner->Run(
2996
3032
  GRPC_CLOSURE_INIT(&next_action_.closure,
2997
- &Chttp2IncomingByteStream::NextLocked, this,
2998
- grpc_combiner_scheduler(transport_->combiner)),
3033
+ &Chttp2IncomingByteStream::NextLocked, this, nullptr),
2999
3034
  GRPC_ERROR_NONE);
3000
3035
  return false;
3001
3036
  }
@@ -3048,7 +3083,8 @@ grpc_error* Chttp2IncomingByteStream::Pull(grpc_slice* slice) {
3048
3083
  }
3049
3084
  } else {
3050
3085
  error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
3051
- GRPC_CLOSURE_SCHED(&stream_->reset_byte_stream, GRPC_ERROR_REF(error));
3086
+ stream_->t->combiner->Run(&stream_->reset_byte_stream,
3087
+ GRPC_ERROR_REF(error));
3052
3088
  return error;
3053
3089
  }
3054
3090
  return GRPC_ERROR_NONE;
@@ -3068,7 +3104,8 @@ grpc_error* Chttp2IncomingByteStream::Push(const grpc_slice& slice,
3068
3104
  if (remaining_bytes_ < GRPC_SLICE_LENGTH(slice)) {
3069
3105
  grpc_error* error =
3070
3106
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream");
3071
- GRPC_CLOSURE_SCHED(&stream_->reset_byte_stream, GRPC_ERROR_REF(error));
3107
+ transport_->combiner->Run(&stream_->reset_byte_stream,
3108
+ GRPC_ERROR_REF(error));
3072
3109
  grpc_slice_unref_internal(slice);
3073
3110
  return error;
3074
3111
  } else {
@@ -3088,7 +3125,8 @@ grpc_error* Chttp2IncomingByteStream::Finished(grpc_error* error,
3088
3125
  }
3089
3126
  }
3090
3127
  if (error != GRPC_ERROR_NONE && reset_on_error) {
3091
- GRPC_CLOSURE_SCHED(&stream_->reset_byte_stream, GRPC_ERROR_REF(error));
3128
+ transport_->combiner->Run(&stream_->reset_byte_stream,
3129
+ GRPC_ERROR_REF(error));
3092
3130
  }
3093
3131
  Unref();
3094
3132
  return error;
@@ -3108,6 +3146,8 @@ static void post_benign_reclaimer(grpc_chttp2_transport* t) {
3108
3146
  if (!t->benign_reclaimer_registered) {
3109
3147
  t->benign_reclaimer_registered = true;
3110
3148
  GRPC_CHTTP2_REF_TRANSPORT(t, "benign_reclaimer");
3149
+ GRPC_CLOSURE_INIT(&t->benign_reclaimer_locked, benign_reclaimer, t,
3150
+ grpc_schedule_on_exec_ctx);
3111
3151
  grpc_resource_user_post_reclaimer(grpc_endpoint_get_resource_user(t->ep),
3112
3152
  false, &t->benign_reclaimer_locked);
3113
3153
  }
@@ -3117,11 +3157,20 @@ static void post_destructive_reclaimer(grpc_chttp2_transport* t) {
3117
3157
  if (!t->destructive_reclaimer_registered) {
3118
3158
  t->destructive_reclaimer_registered = true;
3119
3159
  GRPC_CHTTP2_REF_TRANSPORT(t, "destructive_reclaimer");
3160
+ GRPC_CLOSURE_INIT(&t->destructive_reclaimer_locked, destructive_reclaimer,
3161
+ t, grpc_schedule_on_exec_ctx);
3120
3162
  grpc_resource_user_post_reclaimer(grpc_endpoint_get_resource_user(t->ep),
3121
3163
  true, &t->destructive_reclaimer_locked);
3122
3164
  }
3123
3165
  }
3124
3166
 
3167
+ static void benign_reclaimer(void* arg, grpc_error* error) {
3168
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
3169
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->benign_reclaimer_locked,
3170
+ benign_reclaimer_locked, t, nullptr),
3171
+ GRPC_ERROR_REF(error));
3172
+ }
3173
+
3125
3174
  static void benign_reclaimer_locked(void* arg, grpc_error* error) {
3126
3175
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
3127
3176
  if (error == GRPC_ERROR_NONE &&
@@ -3151,6 +3200,13 @@ static void benign_reclaimer_locked(void* arg, grpc_error* error) {
3151
3200
  GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
3152
3201
  }
3153
3202
 
3203
+ static void destructive_reclaimer(void* arg, grpc_error* error) {
3204
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
3205
+ t->combiner->Run(GRPC_CLOSURE_INIT(&t->destructive_reclaimer_locked,
3206
+ destructive_reclaimer_locked, t, nullptr),
3207
+ GRPC_ERROR_REF(error));
3208
+ }
3209
+
3154
3210
  static void destructive_reclaimer_locked(void* arg, grpc_error* error) {
3155
3211
  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
3156
3212
  size_t n = grpc_chttp2_stream_map_size(&t->stream_map);
@@ -3277,5 +3333,7 @@ void grpc_chttp2_transport_start_reading(
3277
3333
  gpr_free(read_buffer);
3278
3334
  }
3279
3335
  t->notify_on_receive_settings = notify_on_receive_settings;
3280
- GRPC_CLOSURE_SCHED(&t->read_action_locked, GRPC_ERROR_NONE);
3336
+ t->combiner->Run(
3337
+ GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, nullptr),
3338
+ GRPC_ERROR_NONE);
3281
3339
  }