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.
- checksums.yaml +4 -4
- data/Makefile +306 -243
- data/etc/roots.pem +0 -100
- data/include/grpc/grpc_security.h +44 -18
- data/include/grpc/impl/codegen/grpc_types.h +15 -0
- data/include/grpc/impl/codegen/port_platform.h +27 -11
- data/include/grpc/impl/codegen/sync_generic.h +1 -1
- data/src/boringssl/err_data.c +695 -650
- data/src/core/ext/filters/client_channel/client_channel.cc +257 -179
- data/src/core/ext/filters/client_channel/client_channel.h +24 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +2 -3
- data/src/core/ext/filters/client_channel/client_channel_factory.h +1 -5
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +18 -45
- data/src/core/ext/filters/client_channel/health/health_check_client.h +5 -13
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.cc +2 -3
- data/src/core/ext/filters/client_channel/lb_policy.h +65 -55
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -14
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +113 -36
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +14 -19
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +36 -13
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +3 -10
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +814 -1589
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +2 -5
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +3 -6
- data/src/core/ext/filters/client_channel/resolver.cc +1 -2
- data/src/core/ext/filters/client_channel/resolver.h +8 -16
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +25 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +46 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +10 -17
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +7 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +111 -44
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +22 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +29 -10
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +27 -36
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +7 -10
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +60 -16
- data/src/core/ext/filters/client_channel/resolver_factory.h +4 -8
- data/src/core/ext/filters/client_channel/resolver_registry.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver_registry.h +1 -1
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +7 -10
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +7 -8
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +1 -1
- data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -5
- data/src/core/ext/filters/client_channel/retry_throttle.h +1 -4
- data/src/core/ext/filters/client_channel/service_config.h +8 -8
- data/src/core/ext/filters/client_channel/subchannel.cc +53 -86
- data/src/core/ext/filters/client_channel/subchannel.h +7 -9
- data/src/core/ext/filters/client_channel/subchannel_interface.h +9 -13
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +3 -6
- data/src/core/ext/filters/client_channel/{lb_policy/xds/xds_load_balancer_api.cc → xds/xds_api.cc} +169 -52
- data/src/core/ext/filters/client_channel/xds/xds_api.h +171 -0
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +450 -0
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +99 -0
- data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_channel.h +8 -6
- data/src/core/ext/filters/client_channel/xds/xds_channel_args.h +26 -0
- data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_channel_secure.cc +28 -11
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +1413 -0
- data/src/core/ext/filters/client_channel/xds/xds_client.h +221 -0
- data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_client_stats.cc +1 -5
- data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_client_stats.h +3 -4
- data/src/core/ext/filters/deadline/deadline_filter.cc +20 -20
- data/src/core/ext/filters/http/client/http_client_filter.cc +15 -15
- data/src/core/ext/filters/http/client_authority_filter.cc +14 -14
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +12 -12
- data/src/core/ext/filters/max_age/max_age_filter.cc +59 -50
- data/src/core/ext/filters/message_size/message_size_filter.cc +18 -18
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +15 -14
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +233 -175
- data/src/core/ext/transport/chttp2/transport/flow_control.h +21 -24
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +253 -163
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +24 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +13 -15
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -0
- data/src/core/ext/transport/inproc/inproc_transport.cc +20 -13
- data/src/core/lib/channel/channel_args.cc +16 -0
- data/src/core/lib/channel/channel_args.h +22 -0
- data/src/core/lib/channel/channelz.cc +5 -6
- data/src/core/lib/channel/channelz.h +1 -1
- data/src/core/lib/channel/connected_channel.cc +20 -20
- data/src/core/lib/channel/handshaker.h +3 -4
- data/src/core/lib/channel/handshaker_factory.h +1 -3
- data/src/core/lib/debug/trace.h +3 -2
- data/src/core/lib/gprpp/arena.cc +3 -3
- data/src/core/lib/gprpp/arena.h +2 -3
- data/src/core/lib/gprpp/inlined_vector.h +9 -0
- data/src/core/lib/gprpp/map.h +3 -501
- data/src/core/lib/gprpp/memory.h +45 -41
- data/src/core/lib/gprpp/mpscq.cc +108 -0
- data/src/core/lib/gprpp/mpscq.h +98 -0
- data/src/core/lib/gprpp/orphanable.h +6 -11
- data/src/core/lib/gprpp/ref_counted.h +25 -19
- data/src/core/lib/gprpp/set.h +33 -0
- data/src/core/lib/gprpp/thd.h +2 -4
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/http/httpcli_security_connector.cc +15 -11
- data/src/core/lib/http/parser.cc +1 -1
- data/src/core/lib/iomgr/buffer_list.cc +4 -5
- data/src/core/lib/iomgr/buffer_list.h +5 -6
- data/src/core/lib/iomgr/call_combiner.cc +4 -5
- data/src/core/lib/iomgr/call_combiner.h +2 -2
- data/src/core/lib/iomgr/cfstream_handle.h +3 -5
- data/src/core/lib/iomgr/closure.h +8 -3
- data/src/core/lib/iomgr/combiner.cc +45 -82
- data/src/core/lib/iomgr/combiner.h +32 -8
- data/src/core/lib/iomgr/endpoint_cfstream.cc +5 -3
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +19 -15
- data/src/core/lib/iomgr/exec_ctx.h +4 -3
- data/src/core/lib/iomgr/executor.cc +4 -2
- data/src/core/lib/iomgr/executor.h +3 -0
- data/src/core/lib/iomgr/executor/mpmcqueue.h +3 -6
- data/src/core/lib/iomgr/executor/threadpool.cc +1 -2
- data/src/core/lib/iomgr/executor/threadpool.h +7 -11
- data/src/core/lib/iomgr/resource_quota.cc +55 -51
- data/src/core/lib/iomgr/resource_quota.h +13 -9
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +13 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +4 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -11
- data/src/core/lib/iomgr/tcp_custom.cc +9 -7
- data/src/core/lib/iomgr/tcp_posix.cc +20 -16
- data/src/core/lib/iomgr/tcp_server.h +1 -4
- data/src/core/lib/iomgr/tcp_server_custom.cc +5 -5
- data/src/core/lib/iomgr/tcp_server_posix.cc +1 -1
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +2 -11
- data/src/core/lib/iomgr/timer_custom.cc +2 -2
- data/src/core/lib/iomgr/udp_server.cc +3 -2
- data/src/core/lib/iomgr/udp_server.h +6 -12
- data/src/core/lib/json/json.h +1 -1
- data/src/core/lib/json/json_string.cc +2 -2
- data/src/core/lib/profiling/basic_timers.cc +2 -2
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +2 -2
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +1 -1
- data/src/core/lib/security/credentials/credentials.h +4 -20
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +4 -4
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +64 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +4 -4
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +9 -7
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +2 -0
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +4 -4
- data/src/core/lib/security/security_connector/security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/security_connector.h +19 -17
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +8 -5
- data/src/core/lib/security/security_connector/ssl_utils.cc +2 -2
- data/src/core/lib/security/security_connector/ssl_utils.h +1 -1
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +14 -6
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +4 -2
- data/src/core/lib/security/transport/client_auth_filter.cc +17 -17
- data/src/core/lib/security/transport/security_handshaker.cc +29 -13
- data/src/core/lib/security/transport/security_handshaker.h +4 -2
- data/src/core/lib/security/transport/server_auth_filter.cc +14 -14
- data/src/core/lib/slice/slice.cc +2 -10
- data/src/core/lib/slice/slice_hash_table.h +4 -6
- data/src/core/lib/slice/slice_intern.cc +42 -39
- data/src/core/lib/slice/slice_internal.h +3 -3
- data/src/core/lib/slice/slice_utils.h +21 -4
- data/src/core/lib/slice/slice_weak_hash_table.h +4 -6
- data/src/core/lib/surface/call.cc +3 -3
- data/src/core/lib/surface/channel.cc +7 -0
- data/src/core/lib/surface/completion_queue.cc +12 -11
- data/src/core/lib/surface/completion_queue.h +4 -2
- data/src/core/lib/surface/init.cc +1 -0
- data/src/core/lib/surface/lame_client.cc +33 -18
- data/src/core/lib/surface/server.cc +77 -76
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/byte_stream.h +3 -7
- data/src/core/lib/transport/connectivity_state.cc +112 -98
- data/src/core/lib/transport/connectivity_state.h +100 -50
- data/src/core/lib/transport/static_metadata.cc +276 -288
- data/src/core/lib/transport/static_metadata.h +73 -76
- data/src/core/lib/transport/status_conversion.cc +1 -1
- data/src/core/lib/transport/status_metadata.cc +1 -1
- data/src/core/lib/transport/transport.cc +2 -2
- data/src/core/lib/transport/transport.h +12 -4
- data/src/core/lib/transport/transport_op_string.cc +14 -11
- data/src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +5 -5
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +12 -2
- data/src/core/tsi/fake_transport_security.cc +7 -5
- data/src/core/tsi/grpc_shadow_boringssl.h +2918 -2627
- data/src/core/tsi/local_transport_security.cc +8 -6
- data/src/core/tsi/ssl/session_cache/ssl_session.h +1 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +7 -5
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -6
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -2
- data/src/core/tsi/ssl_transport_security.cc +12 -12
- data/src/core/tsi/ssl_transport_security.h +2 -2
- data/src/core/tsi/transport_security_grpc.cc +7 -0
- data/src/core/tsi/transport_security_grpc.h +6 -0
- data/src/ruby/ext/grpc/extconf.rb +1 -0
- data/src/ruby/ext/grpc/rb_call.c +1 -1
- data/src/ruby/ext/grpc/rb_channel.c +1 -1
- data/src/ruby/lib/grpc/generic/bidi_call.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +2 -2
- data/third_party/boringssl/crypto/asn1/a_bool.c +18 -5
- data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +17 -221
- data/third_party/boringssl/crypto/asn1/a_dup.c +0 -24
- data/third_party/boringssl/crypto/asn1/a_enum.c +2 -2
- data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +10 -72
- data/third_party/boringssl/crypto/asn1/a_int.c +12 -71
- data/third_party/boringssl/crypto/asn1/a_mbstr.c +110 -216
- data/third_party/boringssl/crypto/asn1/a_object.c +16 -5
- data/third_party/boringssl/crypto/asn1/a_strnid.c +1 -0
- data/third_party/boringssl/crypto/asn1/asn1_lib.c +5 -1
- data/third_party/boringssl/crypto/asn1/tasn_enc.c +3 -1
- data/third_party/boringssl/crypto/base64/base64.c +2 -2
- data/third_party/boringssl/crypto/bio/bio.c +73 -9
- data/third_party/boringssl/crypto/bio/connect.c +4 -0
- data/third_party/boringssl/crypto/bio/fd.c +4 -0
- data/third_party/boringssl/crypto/bio/file.c +5 -2
- data/third_party/boringssl/crypto/bio/socket.c +4 -0
- data/third_party/boringssl/crypto/bio/socket_helper.c +4 -0
- data/third_party/boringssl/crypto/bn_extra/convert.c +11 -7
- data/third_party/boringssl/crypto/bytestring/ber.c +8 -4
- data/third_party/boringssl/crypto/bytestring/cbb.c +19 -7
- data/third_party/boringssl/crypto/bytestring/cbs.c +28 -15
- data/third_party/boringssl/crypto/bytestring/internal.h +28 -7
- data/third_party/boringssl/crypto/bytestring/unicode.c +155 -0
- data/third_party/boringssl/crypto/chacha/chacha.c +36 -19
- data/third_party/boringssl/crypto/chacha/internal.h +45 -0
- data/third_party/boringssl/crypto/cipher_extra/cipher_extra.c +29 -0
- data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +269 -25
- data/third_party/boringssl/crypto/cipher_extra/e_aesctrhmac.c +16 -14
- data/third_party/boringssl/crypto/cipher_extra/e_aesgcmsiv.c +54 -38
- data/third_party/boringssl/crypto/cipher_extra/e_chacha20poly1305.c +133 -41
- data/third_party/boringssl/crypto/cipher_extra/e_tls.c +23 -15
- data/third_party/boringssl/crypto/cipher_extra/tls_cbc.c +24 -15
- data/third_party/boringssl/crypto/cmac/cmac.c +62 -25
- data/third_party/boringssl/crypto/conf/conf.c +7 -0
- data/third_party/boringssl/crypto/cpu-arm-linux.c +4 -148
- data/third_party/boringssl/crypto/cpu-arm-linux.h +201 -0
- data/third_party/boringssl/crypto/cpu-intel.c +45 -51
- data/third_party/boringssl/crypto/crypto.c +39 -22
- data/third_party/boringssl/crypto/curve25519/spake25519.c +1 -1
- data/third_party/boringssl/crypto/dsa/dsa.c +77 -53
- data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +20 -8
- data/third_party/boringssl/crypto/ec_extra/ec_derive.c +96 -0
- data/third_party/boringssl/crypto/{ecdh/ecdh.c → ecdh_extra/ecdh_extra.c} +20 -58
- data/third_party/boringssl/crypto/ecdsa_extra/ecdsa_asn1.c +1 -9
- data/third_party/boringssl/crypto/engine/engine.c +2 -1
- data/third_party/boringssl/crypto/err/err.c +2 -0
- data/third_party/boringssl/crypto/err/internal.h +2 -2
- data/third_party/boringssl/crypto/evp/evp.c +89 -8
- data/third_party/boringssl/crypto/evp/evp_asn1.c +56 -5
- data/third_party/boringssl/crypto/evp/evp_ctx.c +52 -14
- data/third_party/boringssl/crypto/evp/internal.h +18 -1
- data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +5 -0
- data/third_party/boringssl/crypto/evp/p_ec.c +51 -3
- data/third_party/boringssl/crypto/evp/p_ec_asn1.c +6 -7
- data/third_party/boringssl/crypto/evp/p_ed25519.c +36 -3
- data/third_party/boringssl/crypto/evp/p_ed25519_asn1.c +76 -45
- data/third_party/boringssl/crypto/evp/p_rsa.c +3 -1
- data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +5 -0
- data/third_party/boringssl/crypto/evp/p_x25519.c +110 -0
- data/third_party/boringssl/crypto/evp/p_x25519_asn1.c +249 -0
- data/third_party/boringssl/crypto/evp/scrypt.c +6 -2
- data/third_party/boringssl/crypto/fipsmodule/aes/aes.c +34 -274
- data/third_party/boringssl/crypto/fipsmodule/aes/internal.h +161 -21
- data/third_party/boringssl/crypto/fipsmodule/aes/key_wrap.c +111 -13
- data/third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.c +17 -21
- data/third_party/boringssl/crypto/fipsmodule/bcm.c +119 -7
- data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +19 -2
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +2 -2
- data/third_party/boringssl/crypto/fipsmodule/bn/ctx.c +93 -160
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +48 -57
- data/third_party/boringssl/crypto/fipsmodule/bn/div_extra.c +87 -0
- data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +143 -211
- data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +0 -305
- data/third_party/boringssl/crypto/fipsmodule/bn/gcd_extra.c +325 -0
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +168 -50
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +68 -92
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +7 -6
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +11 -14
- data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +358 -443
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +25 -35
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c +20 -25
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +76 -5
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +14 -14
- data/third_party/boringssl/crypto/fipsmodule/cipher/cipher.c +7 -2
- data/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c +383 -516
- data/third_party/boringssl/crypto/fipsmodule/cipher/e_des.c +4 -0
- data/third_party/boringssl/crypto/fipsmodule/cipher/internal.h +3 -4
- data/third_party/boringssl/crypto/fipsmodule/delocate.h +3 -2
- data/third_party/boringssl/crypto/fipsmodule/digest/digest.c +32 -17
- data/third_party/boringssl/crypto/fipsmodule/digest/md32_common.h +3 -3
- data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +228 -122
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +34 -8
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +311 -98
- data/third_party/boringssl/crypto/fipsmodule/ec/felem.c +82 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +263 -97
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +22 -59
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +317 -234
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +9473 -9475
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +313 -109
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h +36 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/scalar.c +96 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +126 -792
- data/third_party/boringssl/crypto/fipsmodule/ec/simple_mul.c +84 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/util.c +163 -12
- data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +84 -211
- data/third_party/boringssl/crypto/fipsmodule/ecdh/ecdh.c +122 -0
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +60 -205
- data/third_party/boringssl/crypto/fipsmodule/fips_shared_support.c +32 -0
- data/third_party/boringssl/crypto/fipsmodule/is_fips.c +2 -0
- data/third_party/boringssl/crypto/fipsmodule/md4/md4.c +3 -1
- data/third_party/boringssl/crypto/fipsmodule/md5/internal.h +37 -0
- data/third_party/boringssl/crypto/fipsmodule/md5/md5.c +11 -8
- data/third_party/boringssl/crypto/fipsmodule/modes/cbc.c +35 -79
- data/third_party/boringssl/crypto/fipsmodule/modes/cfb.c +7 -39
- data/third_party/boringssl/crypto/fipsmodule/modes/ctr.c +7 -27
- data/third_party/boringssl/crypto/fipsmodule/modes/gcm.c +123 -309
- data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +189 -126
- data/third_party/boringssl/crypto/fipsmodule/modes/ofb.c +3 -2
- data/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c +2 -2
- data/third_party/boringssl/crypto/fipsmodule/rand/internal.h +35 -0
- data/third_party/boringssl/crypto/fipsmodule/rand/rand.c +24 -19
- data/third_party/boringssl/crypto/fipsmodule/rand/urandom.c +256 -77
- data/third_party/boringssl/crypto/fipsmodule/rsa/padding.c +10 -7
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +5 -1
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +131 -14
- data/third_party/boringssl/crypto/fipsmodule/self_check/self_check.c +83 -10
- data/third_party/boringssl/crypto/fipsmodule/sha/internal.h +53 -0
- data/third_party/boringssl/crypto/fipsmodule/sha/sha1.c +9 -13
- data/third_party/boringssl/crypto/fipsmodule/sha/sha256.c +18 -12
- data/third_party/boringssl/crypto/fipsmodule/sha/sha512.c +95 -168
- data/third_party/boringssl/crypto/hrss/hrss.c +2201 -0
- data/third_party/boringssl/crypto/hrss/internal.h +62 -0
- data/third_party/boringssl/crypto/internal.h +95 -20
- data/third_party/boringssl/crypto/lhash/lhash.c +45 -33
- data/third_party/boringssl/crypto/mem.c +39 -2
- data/third_party/boringssl/crypto/obj/obj.c +4 -4
- data/third_party/boringssl/crypto/obj/obj_dat.h +6181 -875
- data/third_party/boringssl/crypto/pem/pem_all.c +2 -3
- data/third_party/boringssl/crypto/pem/pem_info.c +144 -162
- data/third_party/boringssl/crypto/pem/pem_lib.c +53 -52
- data/third_party/boringssl/crypto/pem/pem_pkey.c +13 -21
- data/third_party/boringssl/crypto/pkcs7/pkcs7.c +15 -22
- data/third_party/boringssl/crypto/pkcs7/pkcs7_x509.c +168 -16
- data/third_party/boringssl/crypto/pkcs8/internal.h +11 -0
- data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +24 -15
- data/third_party/boringssl/crypto/pkcs8/pkcs8.c +42 -25
- data/third_party/boringssl/crypto/pkcs8/pkcs8_x509.c +559 -43
- data/third_party/boringssl/crypto/pool/internal.h +1 -1
- data/third_party/boringssl/crypto/pool/pool.c +21 -0
- data/third_party/boringssl/crypto/rand_extra/deterministic.c +8 -0
- data/third_party/boringssl/crypto/rand_extra/fuchsia.c +1 -14
- data/third_party/boringssl/crypto/refcount_lock.c +2 -2
- data/third_party/boringssl/crypto/rsa_extra/rsa_print.c +22 -0
- data/third_party/boringssl/crypto/siphash/siphash.c +80 -0
- data/third_party/boringssl/crypto/stack/stack.c +83 -32
- data/third_party/boringssl/crypto/thread_none.c +2 -2
- data/third_party/boringssl/crypto/thread_pthread.c +2 -2
- data/third_party/boringssl/crypto/thread_win.c +38 -19
- data/third_party/boringssl/crypto/x509/a_strex.c +22 -2
- data/third_party/boringssl/crypto/x509/asn1_gen.c +2 -1
- data/third_party/boringssl/crypto/x509/by_dir.c +7 -0
- data/third_party/boringssl/crypto/x509/by_file.c +12 -10
- data/third_party/boringssl/crypto/x509/t_crl.c +5 -8
- data/third_party/boringssl/crypto/x509/t_req.c +1 -3
- data/third_party/boringssl/crypto/x509/t_x509.c +5 -8
- data/third_party/boringssl/crypto/x509/x509_cmp.c +1 -1
- data/third_party/boringssl/crypto/x509/x509_def.c +1 -1
- data/third_party/boringssl/crypto/x509/x509_lu.c +114 -5
- data/third_party/boringssl/crypto/x509/x509_req.c +20 -0
- data/third_party/boringssl/crypto/x509/x509_set.c +5 -0
- data/third_party/boringssl/crypto/x509/x509_trs.c +1 -0
- data/third_party/boringssl/crypto/x509/x509_txt.c +4 -5
- data/third_party/boringssl/crypto/x509/x509_vfy.c +145 -138
- data/third_party/boringssl/crypto/x509/x509_vpm.c +2 -0
- data/third_party/boringssl/crypto/x509/x509cset.c +40 -0
- data/third_party/boringssl/crypto/x509/x509name.c +2 -3
- data/third_party/boringssl/crypto/x509/x_all.c +109 -210
- data/third_party/boringssl/crypto/x509/x_x509.c +6 -0
- data/third_party/boringssl/crypto/x509v3/ext_dat.h +1 -3
- data/third_party/boringssl/crypto/x509v3/internal.h +56 -0
- data/third_party/boringssl/crypto/x509v3/pcy_cache.c +2 -0
- data/third_party/boringssl/crypto/x509v3/pcy_node.c +1 -0
- data/third_party/boringssl/crypto/x509v3/pcy_tree.c +4 -2
- data/third_party/boringssl/crypto/x509v3/v3_akey.c +5 -2
- data/third_party/boringssl/crypto/x509v3/v3_alt.c +19 -13
- data/third_party/boringssl/crypto/x509v3/v3_conf.c +2 -1
- data/third_party/boringssl/crypto/x509v3/v3_cpols.c +3 -2
- data/third_party/boringssl/crypto/x509v3/v3_genn.c +1 -6
- data/third_party/boringssl/crypto/x509v3/v3_lib.c +1 -0
- data/third_party/boringssl/crypto/x509v3/v3_ocsp.c +68 -0
- data/third_party/boringssl/crypto/x509v3/v3_pci.c +2 -1
- data/third_party/boringssl/crypto/x509v3/v3_purp.c +47 -69
- data/third_party/boringssl/crypto/x509v3/v3_skey.c +5 -2
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +69 -25
- data/third_party/boringssl/include/openssl/aead.h +45 -19
- data/third_party/boringssl/include/openssl/aes.h +32 -7
- data/third_party/boringssl/include/openssl/asn1.h +7 -77
- data/third_party/boringssl/include/openssl/base.h +120 -6
- data/third_party/boringssl/include/openssl/base64.h +4 -1
- data/third_party/boringssl/include/openssl/bio.h +112 -81
- data/third_party/boringssl/include/openssl/blowfish.h +3 -3
- data/third_party/boringssl/include/openssl/bn.h +55 -29
- data/third_party/boringssl/include/openssl/buf.h +2 -2
- data/third_party/boringssl/include/openssl/bytestring.h +54 -32
- data/third_party/boringssl/include/openssl/cast.h +2 -2
- data/third_party/boringssl/include/openssl/cipher.h +46 -16
- data/third_party/boringssl/include/openssl/cmac.h +6 -2
- data/third_party/boringssl/include/openssl/conf.h +3 -6
- data/third_party/boringssl/include/openssl/cpu.h +25 -9
- data/third_party/boringssl/include/openssl/crypto.h +32 -10
- data/third_party/boringssl/include/openssl/curve25519.h +4 -4
- data/third_party/boringssl/include/openssl/dh.h +3 -2
- data/third_party/boringssl/include/openssl/digest.h +21 -7
- data/third_party/boringssl/include/openssl/dsa.h +8 -2
- data/third_party/boringssl/include/openssl/e_os2.h +18 -0
- data/third_party/boringssl/include/openssl/ec.h +25 -21
- data/third_party/boringssl/include/openssl/ec_key.h +36 -8
- data/third_party/boringssl/include/openssl/ecdh.h +17 -0
- data/third_party/boringssl/include/openssl/ecdsa.h +3 -3
- data/third_party/boringssl/include/openssl/engine.h +4 -4
- data/third_party/boringssl/include/openssl/err.h +3 -0
- data/third_party/boringssl/include/openssl/evp.h +199 -42
- data/third_party/boringssl/include/openssl/hmac.h +4 -4
- data/third_party/boringssl/include/openssl/hrss.h +100 -0
- data/third_party/boringssl/include/openssl/lhash.h +131 -23
- data/third_party/boringssl/include/openssl/md4.h +6 -4
- data/third_party/boringssl/include/openssl/md5.h +6 -4
- data/third_party/boringssl/include/openssl/mem.h +6 -2
- data/third_party/boringssl/include/openssl/nid.h +3 -0
- data/third_party/boringssl/include/openssl/obj.h +3 -0
- data/third_party/boringssl/include/openssl/pem.h +102 -64
- data/third_party/boringssl/include/openssl/pkcs7.h +136 -3
- data/third_party/boringssl/include/openssl/pkcs8.h +42 -3
- data/third_party/boringssl/include/openssl/pool.h +13 -2
- data/third_party/boringssl/include/openssl/ripemd.h +5 -4
- data/third_party/boringssl/include/openssl/rsa.h +46 -15
- data/third_party/boringssl/include/openssl/sha.h +40 -28
- data/third_party/boringssl/include/openssl/siphash.h +37 -0
- data/third_party/boringssl/include/openssl/span.h +17 -9
- data/third_party/boringssl/include/openssl/ssl.h +766 -393
- data/third_party/boringssl/include/openssl/ssl3.h +4 -3
- data/third_party/boringssl/include/openssl/stack.h +134 -77
- data/third_party/boringssl/include/openssl/thread.h +1 -1
- data/third_party/boringssl/include/openssl/tls1.h +25 -9
- data/third_party/boringssl/include/openssl/type_check.h +14 -15
- data/third_party/boringssl/include/openssl/x509.h +28 -3
- data/third_party/boringssl/include/openssl/x509_vfy.h +98 -32
- data/third_party/boringssl/include/openssl/x509v3.h +17 -13
- data/third_party/boringssl/ssl/d1_both.cc +9 -18
- data/third_party/boringssl/ssl/d1_lib.cc +4 -3
- data/third_party/boringssl/ssl/d1_pkt.cc +4 -4
- data/third_party/boringssl/ssl/d1_srtp.cc +15 -15
- data/third_party/boringssl/ssl/dtls_method.cc +0 -1
- data/third_party/boringssl/ssl/dtls_record.cc +28 -28
- data/third_party/boringssl/ssl/handoff.cc +295 -91
- data/third_party/boringssl/ssl/handshake.cc +133 -72
- data/third_party/boringssl/ssl/handshake_client.cc +218 -189
- data/third_party/boringssl/ssl/handshake_server.cc +399 -272
- data/third_party/boringssl/ssl/internal.h +1413 -928
- data/third_party/boringssl/ssl/s3_both.cc +175 -36
- data/third_party/boringssl/ssl/s3_lib.cc +9 -13
- data/third_party/boringssl/ssl/s3_pkt.cc +63 -29
- data/third_party/boringssl/ssl/ssl_aead_ctx.cc +55 -35
- data/third_party/boringssl/ssl/ssl_asn1.cc +57 -73
- data/third_party/boringssl/ssl/ssl_buffer.cc +13 -12
- data/third_party/boringssl/ssl/ssl_cert.cc +313 -210
- data/third_party/boringssl/ssl/ssl_cipher.cc +159 -221
- data/third_party/boringssl/ssl/ssl_file.cc +2 -0
- data/third_party/boringssl/ssl/ssl_key_share.cc +164 -19
- data/third_party/boringssl/ssl/ssl_lib.cc +847 -555
- data/third_party/boringssl/ssl/ssl_privkey.cc +441 -111
- data/third_party/boringssl/ssl/ssl_session.cc +230 -178
- data/third_party/boringssl/ssl/ssl_transcript.cc +21 -142
- data/third_party/boringssl/ssl/ssl_versions.cc +88 -93
- data/third_party/boringssl/ssl/ssl_x509.cc +279 -218
- data/third_party/boringssl/ssl/t1_enc.cc +5 -96
- data/third_party/boringssl/ssl/t1_lib.cc +931 -678
- data/third_party/boringssl/ssl/tls13_both.cc +251 -121
- data/third_party/boringssl/ssl/tls13_client.cc +129 -73
- data/third_party/boringssl/ssl/tls13_enc.cc +350 -282
- data/third_party/boringssl/ssl/tls13_server.cc +259 -192
- data/third_party/boringssl/ssl/tls_method.cc +26 -21
- data/third_party/boringssl/ssl/tls_record.cc +42 -47
- data/third_party/boringssl/third_party/fiat/curve25519.c +261 -1324
- data/third_party/boringssl/third_party/fiat/curve25519_32.h +911 -0
- data/third_party/boringssl/third_party/fiat/curve25519_64.h +559 -0
- data/third_party/boringssl/third_party/fiat/p256.c +238 -999
- data/third_party/boringssl/third_party/fiat/p256_32.h +3226 -0
- data/third_party/boringssl/third_party/fiat/p256_64.h +1217 -0
- data/third_party/upb/upb/port_def.inc +1 -1
- data/third_party/upb/upb/table.c +2 -1
- metadata +71 -43
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +0 -127
- data/src/core/lib/gpr/mpscq.cc +0 -117
- data/src/core/lib/gpr/mpscq.h +0 -88
- data/src/core/lib/gprpp/abstract.h +0 -47
- data/src/core/lib/gprpp/pair.h +0 -38
- data/third_party/boringssl/crypto/cipher_extra/e_ssl3.c +0 -460
- data/third_party/boringssl/crypto/fipsmodule/modes/ccm.c +0 -256
- data/third_party/boringssl/include/openssl/lhash_macros.h +0 -174
- 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*
|
445
|
-
|
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
|
452
|
-
|
453
|
-
|
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*
|
460
|
-
|
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
|
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
|
-
|
496
|
+
compress_init_call_elem,
|
497
497
|
grpc_call_stack_ignore_set_pollset_or_pollset_set,
|
498
|
-
|
498
|
+
compress_destroy_call_elem,
|
499
499
|
sizeof(channel_data),
|
500
|
-
|
501
|
-
|
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->
|
231
|
-
|
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*
|
399
|
-
|
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
|
407
|
-
|
408
|
-
|
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*
|
415
|
-
|
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
|
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
|
-
|
520
|
+
max_age_init_call_elem,
|
512
521
|
grpc_call_stack_ignore_set_pollset_or_pollset_set,
|
513
|
-
|
522
|
+
max_age_destroy_call_elem,
|
514
523
|
sizeof(channel_data),
|
515
|
-
|
516
|
-
|
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
|
92
|
-
|
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 =
|
97
|
-
|
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
|
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*
|
281
|
-
|
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
|
289
|
-
|
290
|
-
|
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*
|
329
|
-
|
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
|
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
|
-
|
364
|
+
message_size_start_transport_stream_op_batch,
|
365
365
|
grpc_channel_next_op,
|
366
366
|
sizeof(call_data),
|
367
|
-
|
367
|
+
message_size_init_call_elem,
|
368
368
|
grpc_call_stack_ignore_set_pollset_or_pollset_set,
|
369
|
-
|
369
|
+
message_size_destroy_call_elem,
|
370
370
|
sizeof(channel_data),
|
371
|
-
|
372
|
-
|
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
|
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*
|
108
|
-
|
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
|
120
|
-
|
121
|
-
|
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*
|
125
|
-
|
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
|
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
|
-
|
173
|
+
cronet_compression_start_transport_stream_op_batch,
|
173
174
|
grpc_channel_next_op,
|
174
175
|
sizeof(call_data),
|
175
|
-
|
176
|
+
cronet_compression_init_call_elem,
|
176
177
|
grpc_call_stack_ignore_set_pollset_or_pollset_set,
|
177
|
-
|
178
|
+
cronet_compression_destroy_call_elem,
|
178
179
|
0,
|
179
|
-
|
180
|
-
|
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
|
-
|
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
|
-
|
576
|
-
|
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
|
-
|
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->
|
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->
|
812
|
-
|
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
|
-
|
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
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
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
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
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,
|
1077
|
-
|
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
|
-
|
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(
|
1377
|
-
|
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
|
-
|
1740
|
-
|
1741
|
-
|
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
|
-
|
1779
|
-
|
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
|
-
|
1788
|
-
|
1789
|
-
|
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(
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
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->
|
1864
|
-
t->
|
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->
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
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
|
-
|
1906
|
-
|
1907
|
-
|
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(
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
3336
|
+
t->combiner->Run(
|
3337
|
+
GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, nullptr),
|
3338
|
+
GRPC_ERROR_NONE);
|
3281
3339
|
}
|