grpc 1.18.0 → 1.22.0
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 +4731 -7404
- data/etc/roots.pem +146 -0
- data/include/grpc/grpc.h +11 -6
- data/include/grpc/grpc_security.h +297 -4
- data/include/grpc/grpc_security_constants.h +1 -1
- data/include/grpc/impl/codegen/byte_buffer.h +13 -0
- data/include/grpc/impl/codegen/gpr_types.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +30 -7
- data/include/grpc/impl/codegen/port_platform.h +88 -7
- data/include/grpc/impl/codegen/slice.h +2 -22
- data/include/grpc/impl/codegen/status.h +2 -1
- data/include/grpc/impl/codegen/sync_posix.h +18 -0
- data/include/grpc/slice.h +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +21 -16
- data/src/core/ext/filters/client_channel/backup_poller.h +8 -2
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +3 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +2435 -1557
- data/src/core/ext/filters/client_channel/client_channel.h +2 -10
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +6 -89
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +8 -33
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +22 -34
- data/src/core/ext/filters/client_channel/client_channel_factory.h +19 -38
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +9 -11
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +179 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +68 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +59 -55
- data/src/core/ext/filters/client_channel/health/health_check_client.h +20 -9
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +146 -157
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +29 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +844 -859
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +2 -6
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +14 -12
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +16 -12
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +185 -312
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +143 -375
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +192 -245
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +1554 -955
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +0 -43
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +14 -10
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +2 -2
- data/src/core/ext/filters/client_channel/lb_policy.cc +115 -22
- data/src/core/ext/filters/client_channel/lb_policy.h +260 -129
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +5 -2
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +107 -4
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +10 -3
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +96 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +56 -0
- data/src/core/ext/filters/client_channel/parse_address.cc +24 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +121 -122
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +84 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +179 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +24 -10
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +111 -47
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +7 -13
- 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/c_ares/grpc_ares_wrapper_libuv.cc +39 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc +0 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +2 -64
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc +28 -0
- data/src/core/{lib/iomgr/network_status_tracker.cc → ext/filters/client_channel/resolver/dns/dns_resolver_selection.h} +8 -15
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +36 -82
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +111 -72
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +13 -8
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +28 -63
- data/src/core/ext/filters/client_channel/resolver.cc +54 -1
- data/src/core/ext/filters/client_channel/resolver.h +52 -23
- data/src/core/ext/filters/client_channel/resolver_factory.h +3 -1
- data/src/core/ext/filters/client_channel/resolver_registry.cc +5 -2
- data/src/core/ext/filters/client_channel/resolver_registry.h +5 -4
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +368 -241
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +58 -76
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +543 -0
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +139 -0
- data/src/core/ext/filters/client_channel/server_address.cc +4 -54
- data/src/core/ext/filters/client_channel/server_address.h +1 -13
- data/src/core/ext/filters/client_channel/service_config.cc +329 -0
- data/src/core/ext/filters/client_channel/service_config.h +205 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +803 -838
- data/src/core/ext/filters/client_channel/subchannel.h +295 -128
- data/src/core/ext/filters/client_channel/subchannel_interface.h +113 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +97 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +94 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +3 -4
- data/src/core/ext/filters/deadline/deadline_filter.h +3 -2
- data/src/core/ext/filters/http/client/http_client_filter.cc +7 -5
- data/src/core/ext/filters/http/client/http_client_filter.h +1 -1
- data/src/core/ext/filters/http/client_authority_filter.cc +6 -3
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +4 -3
- data/src/core/ext/filters/http/server/http_server_filter.cc +18 -12
- data/src/core/ext/filters/max_age/max_age_filter.cc +5 -2
- data/src/core/ext/filters/message_size/message_size_filter.cc +119 -77
- data/src/core/ext/filters/message_size/message_size_filter.h +33 -0
- data/src/core/ext/transport/chttp2/alpn/alpn.h +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +13 -12
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +45 -47
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +134 -143
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +68 -21
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +4 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +9 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +156 -94
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +33 -37
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +6 -5
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -4
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +8 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -4
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +74 -55
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +33 -11
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -2
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +7 -14
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +10 -1
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +9 -5
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +9 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +43 -30
- data/src/core/ext/transport/chttp2/transport/parsing.cc +52 -70
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +70 -33
- data/src/core/ext/transport/inproc/inproc_transport.cc +26 -18
- data/src/core/lib/channel/channel_args.cc +2 -101
- data/src/core/lib/channel/channel_args.h +3 -37
- data/src/core/lib/channel/channel_stack.h +10 -6
- data/src/core/lib/channel/channel_trace.cc +4 -4
- data/src/core/lib/channel/channel_trace.h +4 -4
- data/src/core/lib/channel/channelz.cc +168 -38
- data/src/core/lib/channel/channelz.h +40 -44
- data/src/core/lib/channel/channelz_registry.cc +75 -107
- data/src/core/lib/channel/channelz_registry.h +10 -28
- data/src/core/lib/channel/connected_channel.cc +2 -2
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/channel/handshaker.cc +151 -218
- data/src/core/lib/channel/handshaker.h +110 -101
- data/src/core/lib/channel/handshaker_factory.h +11 -19
- data/src/core/lib/channel/handshaker_registry.cc +67 -51
- data/src/core/lib/channel/handshaker_registry.h +21 -16
- data/src/core/lib/compression/algorithm_metadata.h +3 -3
- data/src/core/lib/compression/compression.cc +14 -9
- data/src/core/lib/compression/compression_args.cc +127 -0
- data/src/core/lib/compression/compression_args.h +55 -0
- data/src/core/lib/compression/compression_internal.cc +16 -12
- data/src/core/lib/compression/compression_internal.h +1 -1
- data/src/core/lib/compression/stream_compression.cc +3 -2
- data/src/core/lib/compression/stream_compression.h +2 -2
- data/src/core/lib/compression/stream_compression_gzip.cc +9 -9
- data/src/core/lib/debug/trace.cc +13 -7
- data/src/core/lib/debug/trace.h +14 -1
- data/src/core/lib/gpr/arena.h +13 -9
- data/src/core/lib/gpr/cpu_posix.cc +5 -3
- data/src/core/lib/gpr/env.h +3 -6
- data/src/core/lib/gpr/env_linux.cc +6 -1
- data/src/core/lib/gpr/env_posix.cc +5 -0
- data/src/core/lib/gpr/env_windows.cc +7 -5
- data/src/core/lib/gpr/log.cc +9 -13
- data/src/core/lib/gpr/log_posix.cc +2 -1
- data/src/core/lib/gpr/string.cc +20 -7
- data/src/core/lib/gpr/string.h +10 -3
- data/src/core/lib/gpr/sync_posix.cc +65 -4
- data/src/core/lib/gpr/time.cc +8 -0
- data/src/core/lib/gpr/time_posix.cc +21 -2
- data/src/core/lib/gprpp/arena.cc +103 -0
- data/src/core/lib/gprpp/arena.h +121 -0
- data/src/core/lib/gprpp/atomic.h +75 -5
- data/src/core/lib/gprpp/fork.cc +13 -32
- data/src/core/lib/gprpp/fork.h +5 -1
- data/src/core/lib/gprpp/global_config.h +96 -0
- data/src/core/lib/gprpp/global_config_custom.h +29 -0
- data/src/core/lib/gprpp/global_config_env.cc +135 -0
- data/src/core/lib/gprpp/global_config_env.h +131 -0
- data/src/core/lib/gprpp/global_config_generic.h +44 -0
- data/src/core/lib/gprpp/inlined_vector.h +8 -0
- data/src/core/lib/gprpp/map.h +436 -0
- data/src/core/lib/gprpp/memory.h +2 -2
- data/src/core/lib/gprpp/optional.h +48 -0
- data/src/core/lib/gprpp/orphanable.h +6 -5
- data/src/core/lib/gprpp/{mutex_lock.h → pair.h} +15 -19
- data/src/core/lib/gprpp/ref_counted.h +36 -17
- data/src/core/lib/gprpp/sync.h +126 -0
- data/src/core/lib/gprpp/thd.h +42 -7
- data/src/core/lib/gprpp/thd_posix.cc +31 -13
- data/src/core/lib/gprpp/thd_windows.cc +47 -34
- data/src/core/lib/http/httpcli.cc +6 -5
- data/src/core/lib/http/httpcli_security_connector.cc +13 -15
- data/src/core/lib/http/parser.cc +3 -2
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/buffer_list.cc +182 -24
- data/src/core/lib/iomgr/buffer_list.h +72 -10
- data/src/core/lib/iomgr/call_combiner.cc +84 -90
- data/src/core/lib/iomgr/call_combiner.h +75 -82
- data/src/core/lib/iomgr/cfstream_handle.cc +203 -0
- data/src/core/lib/iomgr/cfstream_handle.h +86 -0
- data/src/core/lib/iomgr/combiner.cc +11 -3
- data/src/core/lib/iomgr/combiner.h +1 -1
- data/src/core/lib/iomgr/endpoint.cc +2 -2
- data/src/core/lib/iomgr/endpoint.h +3 -2
- data/src/core/lib/iomgr/endpoint_cfstream.cc +375 -0
- data/src/core/lib/iomgr/endpoint_cfstream.h +49 -0
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/error.cc +21 -17
- data/src/core/lib/iomgr/error.h +36 -6
- data/src/core/lib/iomgr/error_cfstream.cc +52 -0
- data/src/core/lib/iomgr/error_cfstream.h +31 -0
- data/src/core/lib/iomgr/error_internal.h +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +44 -28
- data/src/core/lib/iomgr/ev_epollex_linux.cc +173 -194
- data/src/core/lib/iomgr/ev_poll_posix.cc +16 -487
- data/src/core/lib/iomgr/ev_posix.cc +29 -19
- data/src/core/lib/iomgr/ev_posix.h +19 -3
- data/src/core/lib/iomgr/ev_windows.cc +2 -2
- data/src/core/lib/iomgr/exec_ctx.cc +1 -0
- data/src/core/lib/iomgr/exec_ctx.h +137 -8
- data/src/core/lib/iomgr/executor.cc +147 -95
- data/src/core/lib/iomgr/executor.h +55 -49
- data/src/core/lib/iomgr/fork_posix.cc +6 -5
- data/src/core/lib/{gprpp/atomic_with_std.h → iomgr/grpc_if_nametoindex.h} +8 -13
- data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +42 -0
- data/src/core/lib/iomgr/{network_status_tracker.h → grpc_if_nametoindex_unsupported.cc} +15 -9
- data/src/core/lib/iomgr/internal_errqueue.cc +3 -5
- data/src/core/lib/iomgr/internal_errqueue.h +105 -3
- data/src/core/lib/iomgr/iomgr.cc +20 -13
- data/src/core/lib/iomgr/iomgr.h +15 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +17 -3
- data/src/core/lib/iomgr/iomgr_custom.h +2 -0
- data/src/core/lib/iomgr/iomgr_internal.cc +10 -0
- data/src/core/lib/iomgr/iomgr_internal.h +12 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +19 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +93 -0
- data/src/core/lib/iomgr/iomgr_windows.cc +18 -2
- data/src/core/lib/iomgr/lockfree_event.cc +4 -4
- data/src/core/lib/iomgr/port.h +35 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +4 -3
- data/src/core/lib/iomgr/resolve_address_windows.cc +2 -1
- data/src/core/lib/iomgr/resource_quota.cc +40 -37
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +6 -2
- data/src/core/lib/iomgr/socket_windows.cc +19 -0
- data/src/core/lib/iomgr/socket_windows.h +8 -0
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +216 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_windows.cc +7 -5
- data/src/core/lib/iomgr/tcp_custom.cc +10 -14
- data/src/core/lib/iomgr/tcp_posix.cc +256 -140
- data/src/core/lib/iomgr/tcp_server.cc +5 -0
- data/src/core/lib/iomgr/tcp_server.h +24 -0
- data/src/core/lib/iomgr/tcp_server_custom.cc +14 -12
- data/src/core/lib/iomgr/tcp_server_posix.cc +86 -12
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_windows.cc +13 -11
- data/src/core/lib/iomgr/tcp_uv.cc +5 -7
- data/src/core/lib/iomgr/tcp_windows.cc +8 -14
- data/src/core/lib/iomgr/timer.h +2 -1
- data/src/core/lib/iomgr/timer_generic.cc +16 -16
- data/src/core/lib/iomgr/timer_manager.cc +20 -11
- data/src/core/lib/iomgr/udp_server.cc +8 -6
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +1 -19
- data/src/core/lib/json/json.cc +1 -4
- data/src/core/lib/profiling/basic_timers.cc +10 -4
- data/src/core/lib/security/context/security_context.cc +6 -7
- data/src/core/lib/security/context/security_context.h +3 -4
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +1 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
- data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -0
- data/src/core/lib/security/credentials/credentials.h +9 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +15 -3
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +2 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +10 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +3 -3
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +9 -8
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +20 -2
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +2 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +192 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +210 -0
- data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +129 -0
- data/src/core/lib/security/credentials/tls/spiffe_credentials.h +62 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +13 -12
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +7 -5
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/security_connector.cc +0 -1
- data/src/core/lib/security/security_connector/security_connector.h +3 -3
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +39 -38
- data/src/core/lib/security/security_connector/ssl_utils.cc +164 -26
- data/src/core/lib/security/security_connector/ssl_utils.h +70 -1
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +426 -0
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +122 -0
- data/src/core/lib/security/transport/auth_filters.h +5 -2
- data/src/core/lib/security/transport/client_auth_filter.cc +55 -50
- data/src/core/lib/security/transport/secure_endpoint.cc +6 -6
- data/src/core/lib/security/transport/security_handshaker.cc +271 -303
- data/src/core/lib/security/transport/security_handshaker.h +11 -2
- data/src/core/lib/security/transport/server_auth_filter.cc +3 -3
- data/src/core/lib/slice/b64.h +2 -2
- data/src/core/lib/slice/percent_encoding.cc +3 -3
- data/src/core/lib/slice/percent_encoding.h +3 -3
- data/src/core/lib/slice/slice.cc +174 -122
- data/src/core/lib/slice/slice_buffer.cc +54 -21
- data/src/core/lib/slice/slice_hash_table.h +4 -4
- data/src/core/lib/slice/slice_intern.cc +49 -107
- data/src/core/lib/slice/slice_internal.h +264 -3
- data/src/core/lib/slice/slice_string_helpers.cc +10 -1
- data/src/core/lib/slice/slice_string_helpers.h +3 -1
- data/src/core/lib/slice/slice_utils.h +50 -0
- data/src/core/lib/slice/slice_weak_hash_table.h +6 -6
- data/src/core/lib/surface/api_trace.h +1 -1
- data/src/core/lib/surface/byte_buffer_reader.cc +17 -0
- data/src/core/lib/surface/call.cc +67 -46
- data/src/core/lib/surface/call.h +7 -2
- data/src/core/lib/surface/call_details.cc +0 -1
- data/src/core/lib/surface/channel.cc +89 -97
- data/src/core/lib/surface/channel.h +60 -6
- data/src/core/lib/surface/channel_init.h +5 -0
- data/src/core/lib/surface/completion_queue.cc +221 -216
- data/src/core/lib/surface/completion_queue.h +2 -1
- data/src/core/lib/surface/init.cc +82 -33
- data/src/core/lib/surface/init.h +1 -0
- data/src/core/lib/surface/init_secure.cc +1 -1
- data/src/core/lib/surface/lame_client.cc +5 -7
- data/src/core/lib/surface/server.cc +42 -47
- data/src/core/lib/surface/validate_metadata.cc +14 -8
- data/src/core/lib/surface/validate_metadata.h +13 -2
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/bdp_estimator.cc +3 -3
- data/src/core/lib/transport/bdp_estimator.h +2 -2
- data/src/core/lib/transport/connectivity_state.cc +10 -40
- data/src/core/lib/transport/connectivity_state.h +0 -8
- data/src/core/lib/transport/error_utils.cc +12 -0
- data/src/core/lib/transport/metadata.cc +258 -267
- data/src/core/lib/transport/metadata.h +227 -16
- data/src/core/lib/transport/metadata_batch.cc +1 -1
- data/src/core/lib/transport/metadata_batch.h +1 -1
- data/src/core/lib/transport/static_metadata.cc +477 -399
- data/src/core/lib/transport/static_metadata.h +273 -182
- data/src/core/lib/transport/status_metadata.cc +3 -3
- data/src/core/lib/transport/timeout_encoding.cc +1 -1
- data/src/core/lib/transport/timeout_encoding.h +1 -1
- data/src/core/lib/transport/transport.cc +39 -72
- data/src/core/lib/transport/transport.h +59 -24
- data/src/core/lib/transport/transport_impl.h +1 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -1
- data/src/core/tsi/alts/handshaker/alts_shared_resource.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +4 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +1 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -1
- data/src/core/tsi/fake_transport_security.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +12 -10
- data/src/core/tsi/ssl_transport_security.h +24 -4
- data/src/ruby/bin/math_pb.rb +18 -16
- data/src/ruby/ext/grpc/extconf.rb +12 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +8 -5
- data/src/ruby/ext/grpc/rb_channel.c +14 -10
- data/src/ruby/ext/grpc/rb_channel_credentials.c +8 -4
- data/src/ruby/ext/grpc/rb_compression_options.c +9 -7
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc.c +23 -24
- data/src/ruby/ext/grpc/rb_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +24 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +36 -0
- data/src/ruby/ext/grpc/rb_server.c +8 -4
- data/src/ruby/lib/grpc/errors.rb +22 -3
- data/src/ruby/lib/grpc/generic/bidi_call.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/README.md +1 -1
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +13 -10
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +18 -0
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +3 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +58 -56
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -0
- data/src/ruby/spec/errors_spec.rb +141 -0
- data/third_party/cares/cares/ares.h +12 -0
- data/third_party/cares/cares/ares_create_query.c +5 -1
- data/third_party/cares/cares/ares_data.c +74 -73
- data/third_party/cares/cares/ares_destroy.c +6 -1
- data/third_party/cares/cares/ares_gethostbyaddr.c +5 -5
- data/third_party/cares/cares/ares_gethostbyname.c +15 -4
- data/third_party/cares/cares/ares_getnameinfo.c +11 -0
- data/third_party/cares/cares/ares_init.c +274 -173
- data/third_party/cares/cares/ares_library_init.c +21 -3
- data/third_party/cares/cares/ares_options.c +6 -2
- data/third_party/cares/cares/ares_parse_naptr_reply.c +7 -6
- data/third_party/cares/cares/ares_parse_ptr_reply.c +4 -2
- data/third_party/cares/cares/ares_platform.c +7 -0
- data/third_party/cares/cares/ares_private.h +19 -11
- data/third_party/cares/cares/ares_process.c +27 -2
- data/third_party/cares/cares/ares_rules.h +1 -1
- data/third_party/cares/cares/ares_search.c +7 -0
- data/third_party/cares/cares/ares_send.c +6 -0
- data/third_party/cares/cares/ares_strsplit.c +174 -0
- data/third_party/cares/cares/ares_strsplit.h +43 -0
- data/third_party/cares/cares/ares_version.h +4 -4
- data/third_party/cares/cares/config-win32.h +1 -1
- data/third_party/cares/cares/inet_ntop.c +2 -3
- data/third_party/cares/config_darwin/ares_config.h +3 -0
- data/third_party/cares/config_freebsd/ares_config.h +3 -0
- data/third_party/cares/config_linux/ares_config.h +3 -0
- data/third_party/cares/config_openbsd/ares_config.h +3 -0
- metadata +83 -48
- data/src/core/ext/filters/client_channel/request_routing.cc +0 -936
- data/src/core/ext/filters/client_channel/request_routing.h +0 -177
- data/src/core/ext/filters/client_channel/subchannel_index.cc +0 -248
- data/src/core/ext/filters/client_channel/subchannel_index.h +0 -76
- data/src/core/lib/channel/handshaker_factory.cc +0 -42
- data/src/core/lib/gpr/arena.cc +0 -192
- data/src/core/lib/gprpp/atomic_with_atm.h +0 -57
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +0 -107
- data/src/core/lib/iomgr/wakeup_fd_cv.h +0 -69
- data/src/core/lib/transport/service_config.cc +0 -106
- data/src/core/lib/transport/service_config.h +0 -249
@@ -43,6 +43,7 @@
|
|
43
43
|
#include "src/core/lib/gprpp/memory.h"
|
44
44
|
#include "src/core/lib/http/parser.h"
|
45
45
|
#include "src/core/lib/iomgr/executor.h"
|
46
|
+
#include "src/core/lib/iomgr/iomgr.h"
|
46
47
|
#include "src/core/lib/iomgr/timer.h"
|
47
48
|
#include "src/core/lib/profiling/timers.h"
|
48
49
|
#include "src/core/lib/slice/slice_internal.h"
|
@@ -118,7 +119,7 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t);
|
|
118
119
|
|
119
120
|
static void connectivity_state_set(grpc_chttp2_transport* t,
|
120
121
|
grpc_connectivity_state state,
|
121
|
-
|
122
|
+
const char* reason);
|
122
123
|
|
123
124
|
static void benign_reclaimer_locked(void* t, grpc_error* error);
|
124
125
|
static void destructive_reclaimer_locked(void* t, grpc_error* error);
|
@@ -591,8 +592,7 @@ static void close_transport_locked(grpc_chttp2_transport* t,
|
|
591
592
|
}
|
592
593
|
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
593
594
|
t->closed_with_error = GRPC_ERROR_REF(error);
|
594
|
-
connectivity_state_set(t, GRPC_CHANNEL_SHUTDOWN,
|
595
|
-
"close_transport");
|
595
|
+
connectivity_state_set(t, GRPC_CHANNEL_SHUTDOWN, "close_transport");
|
596
596
|
if (t->ping_state.is_delayed_ping_timer_set) {
|
597
597
|
grpc_timer_cancel(&t->ping_state.delayed_ping_timer);
|
598
598
|
}
|
@@ -644,17 +644,23 @@ void grpc_chttp2_stream_unref(grpc_chttp2_stream* s) {
|
|
644
644
|
}
|
645
645
|
#endif
|
646
646
|
|
647
|
-
grpc_chttp2_stream::grpc_chttp2_stream
|
648
|
-
grpc_stream_refcount* refcount,
|
649
|
-
const void* server_data,
|
650
|
-
gpr_arena* arena)
|
651
|
-
: t(t), refcount(refcount), metadata_buffer{{arena}, {arena}} {
|
647
|
+
grpc_chttp2_stream::Reffer::Reffer(grpc_chttp2_stream* s) {
|
652
648
|
/* We reserve one 'active stream' that's dropped when the stream is
|
653
649
|
read-closed. The others are for Chttp2IncomingByteStreams that are
|
654
650
|
actively reading */
|
655
|
-
GRPC_CHTTP2_STREAM_REF(
|
656
|
-
GRPC_CHTTP2_REF_TRANSPORT(t, "stream");
|
651
|
+
GRPC_CHTTP2_STREAM_REF(s, "chttp2");
|
652
|
+
GRPC_CHTTP2_REF_TRANSPORT(s->t, "stream");
|
653
|
+
}
|
657
654
|
|
655
|
+
grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
|
656
|
+
grpc_stream_refcount* refcount,
|
657
|
+
const void* server_data,
|
658
|
+
grpc_core::Arena* arena)
|
659
|
+
: t(t),
|
660
|
+
refcount(refcount),
|
661
|
+
reffer(this),
|
662
|
+
metadata_buffer{grpc_chttp2_incoming_metadata_buffer(arena),
|
663
|
+
grpc_chttp2_incoming_metadata_buffer(arena)} {
|
658
664
|
if (server_data) {
|
659
665
|
id = static_cast<uint32_t>((uintptr_t)server_data);
|
660
666
|
*t->accepting_stream = this;
|
@@ -673,11 +679,9 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
|
|
673
679
|
grpc_slice_buffer_init(&frame_storage);
|
674
680
|
grpc_slice_buffer_init(&unprocessed_incoming_frames_buffer);
|
675
681
|
grpc_slice_buffer_init(&flow_controlled_buffer);
|
676
|
-
grpc_slice_buffer_init(&compressed_data_buffer);
|
677
|
-
grpc_slice_buffer_init(&decompressed_data_buffer);
|
678
682
|
|
679
683
|
GRPC_CLOSURE_INIT(&complete_fetch_locked, ::complete_fetch_locked, this,
|
680
|
-
|
684
|
+
grpc_combiner_scheduler(t->combiner));
|
681
685
|
GRPC_CLOSURE_INIT(&reset_byte_stream, ::reset_byte_stream, this,
|
682
686
|
grpc_combiner_scheduler(t->combiner));
|
683
687
|
}
|
@@ -698,8 +702,13 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
698
702
|
|
699
703
|
grpc_slice_buffer_destroy_internal(&unprocessed_incoming_frames_buffer);
|
700
704
|
grpc_slice_buffer_destroy_internal(&frame_storage);
|
701
|
-
|
702
|
-
|
705
|
+
if (stream_compression_method != GRPC_STREAM_COMPRESSION_IDENTITY_COMPRESS) {
|
706
|
+
grpc_slice_buffer_destroy_internal(&compressed_data_buffer);
|
707
|
+
}
|
708
|
+
if (stream_decompression_method !=
|
709
|
+
GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS) {
|
710
|
+
grpc_slice_buffer_destroy_internal(&decompressed_data_buffer);
|
711
|
+
}
|
703
712
|
|
704
713
|
grpc_chttp2_list_remove_stalled_by_transport(t, this);
|
705
714
|
grpc_chttp2_list_remove_stalled_by_stream(t, this);
|
@@ -735,7 +744,7 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
735
744
|
|
736
745
|
static int init_stream(grpc_transport* gt, grpc_stream* gs,
|
737
746
|
grpc_stream_refcount* refcount, const void* server_data,
|
738
|
-
|
747
|
+
grpc_core::Arena* arena) {
|
739
748
|
GPR_TIMER_SCOPE("init_stream", 0);
|
740
749
|
grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
|
741
750
|
new (gs) grpc_chttp2_stream(t, refcount, server_data, arena);
|
@@ -753,12 +762,15 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
|
|
753
762
|
GPR_TIMER_SCOPE("destroy_stream", 0);
|
754
763
|
grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
|
755
764
|
grpc_chttp2_stream* s = reinterpret_cast<grpc_chttp2_stream*>(gs);
|
756
|
-
|
757
|
-
|
765
|
+
if (s->stream_compression_method !=
|
766
|
+
GRPC_STREAM_COMPRESSION_IDENTITY_COMPRESS &&
|
767
|
+
s->stream_compression_ctx != nullptr) {
|
758
768
|
grpc_stream_compression_context_destroy(s->stream_compression_ctx);
|
759
769
|
s->stream_compression_ctx = nullptr;
|
760
770
|
}
|
761
|
-
if (s->
|
771
|
+
if (s->stream_decompression_method !=
|
772
|
+
GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS &&
|
773
|
+
s->stream_decompression_ctx != nullptr) {
|
762
774
|
grpc_stream_compression_context_destroy(s->stream_decompression_ctx);
|
763
775
|
s->stream_decompression_ctx = nullptr;
|
764
776
|
}
|
@@ -823,10 +835,10 @@ static const char* write_state_name(grpc_chttp2_write_state st) {
|
|
823
835
|
|
824
836
|
static void set_write_state(grpc_chttp2_transport* t,
|
825
837
|
grpc_chttp2_write_state st, const char* reason) {
|
826
|
-
GRPC_CHTTP2_IF_TRACING(
|
827
|
-
|
828
|
-
|
829
|
-
|
838
|
+
GRPC_CHTTP2_IF_TRACING(
|
839
|
+
gpr_log(GPR_INFO, "W:%p %s [%s] state %s -> %s [%s]", t,
|
840
|
+
t->is_client ? "CLIENT" : "SERVER", t->peer_string,
|
841
|
+
write_state_name(t->write_state), write_state_name(st), reason));
|
830
842
|
t->write_state = st;
|
831
843
|
/* If the state is being reset back to idle, it means a write was just
|
832
844
|
* finished. Make sure all the run_after_write closures are scheduled.
|
@@ -963,24 +975,28 @@ void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
|
|
963
975
|
static grpc_closure_scheduler* write_scheduler(grpc_chttp2_transport* t,
|
964
976
|
bool early_results_scheduled,
|
965
977
|
bool partial_write) {
|
978
|
+
// If we're already in a background poller, don't offload this to an executor
|
979
|
+
if (grpc_iomgr_is_any_background_poller_thread()) {
|
980
|
+
return grpc_schedule_on_exec_ctx;
|
981
|
+
}
|
966
982
|
/* if it's not the first write in a batch, always offload to the executor:
|
967
983
|
we'll probably end up queuing against the kernel anyway, so we'll likely
|
968
984
|
get better latency overall if we switch writing work elsewhere and continue
|
969
985
|
with application work above */
|
970
986
|
if (!t->is_first_write_in_batch) {
|
971
|
-
return
|
987
|
+
return grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT);
|
972
988
|
}
|
973
989
|
/* equivalently, if it's a partial write, we *know* we're going to be taking a
|
974
990
|
thread jump to write it because of the above, may as well do so
|
975
991
|
immediately */
|
976
992
|
if (partial_write) {
|
977
|
-
return
|
993
|
+
return grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT);
|
978
994
|
}
|
979
995
|
switch (t->opt_target) {
|
980
996
|
case GRPC_CHTTP2_OPTIMIZE_FOR_THROUGHPUT:
|
981
997
|
/* executor gives us the largest probability of being able to batch a
|
982
998
|
* write with others on this transport */
|
983
|
-
return
|
999
|
+
return grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT);
|
984
1000
|
case GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY:
|
985
1001
|
return grpc_schedule_on_exec_ctx;
|
986
1002
|
}
|
@@ -1057,12 +1073,15 @@ static void write_action_end_locked(void* tp, grpc_error* error) {
|
|
1057
1073
|
GPR_TIMER_SCOPE("terminate_writing_with_lock", 0);
|
1058
1074
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
1059
1075
|
|
1076
|
+
bool closed = false;
|
1060
1077
|
if (error != GRPC_ERROR_NONE) {
|
1061
1078
|
close_transport_locked(t, GRPC_ERROR_REF(error));
|
1079
|
+
closed = true;
|
1062
1080
|
}
|
1063
1081
|
|
1064
1082
|
if (t->sent_goaway_state == GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED) {
|
1065
1083
|
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SENT;
|
1084
|
+
closed = true;
|
1066
1085
|
if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
1067
1086
|
close_transport_locked(
|
1068
1087
|
t, GRPC_ERROR_CREATE_FROM_STATIC_STRING("goaway sent"));
|
@@ -1081,6 +1100,14 @@ static void write_action_end_locked(void* tp, grpc_error* error) {
|
|
1081
1100
|
set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING, "continue writing");
|
1082
1101
|
t->is_first_write_in_batch = false;
|
1083
1102
|
GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
|
1103
|
+
// If the transport is closed, we will retry writing on the endpoint
|
1104
|
+
// and next write may contain part of the currently serialized frames.
|
1105
|
+
// So, we should only call the run_after_write callbacks when the next
|
1106
|
+
// write finishes, or the callbacks will be invoked when the stream is
|
1107
|
+
// closed.
|
1108
|
+
if (!closed) {
|
1109
|
+
GRPC_CLOSURE_LIST_SCHED(&t->run_after_write);
|
1110
|
+
}
|
1084
1111
|
GRPC_CLOSURE_RUN(
|
1085
1112
|
GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
|
1086
1113
|
write_action_begin_locked, t,
|
@@ -1113,20 +1140,23 @@ static void queue_setting_update(grpc_chttp2_transport* t,
|
|
1113
1140
|
|
1114
1141
|
void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
1115
1142
|
uint32_t goaway_error,
|
1116
|
-
grpc_slice goaway_text) {
|
1117
|
-
// GRPC_CHTTP2_IF_TRACING(
|
1118
|
-
// gpr_log(GPR_INFO, "got goaway [%d]: %s", goaway_error, msg));
|
1119
|
-
|
1143
|
+
const grpc_slice& goaway_text) {
|
1120
1144
|
// Discard the error from a previous goaway frame (if any)
|
1121
1145
|
if (t->goaway_error != GRPC_ERROR_NONE) {
|
1122
1146
|
GRPC_ERROR_UNREF(t->goaway_error);
|
1123
1147
|
}
|
1124
1148
|
t->goaway_error = grpc_error_set_str(
|
1125
1149
|
grpc_error_set_int(
|
1126
|
-
|
1127
|
-
|
1150
|
+
grpc_error_set_int(
|
1151
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("GOAWAY received"),
|
1152
|
+
GRPC_ERROR_INT_HTTP2_ERROR, static_cast<intptr_t>(goaway_error)),
|
1153
|
+
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE),
|
1128
1154
|
GRPC_ERROR_STR_RAW_BYTES, goaway_text);
|
1129
1155
|
|
1156
|
+
/* We want to log this irrespective of whether http tracing is enabled */
|
1157
|
+
gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string, goaway_error,
|
1158
|
+
grpc_error_string(t->goaway_error));
|
1159
|
+
|
1130
1160
|
/* When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug
|
1131
1161
|
* data equal to "too_many_pings", it should log the occurrence at a log level
|
1132
1162
|
* that is enabled by default and double the configured KEEPALIVE_TIME used
|
@@ -1147,8 +1177,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
|
1147
1177
|
|
1148
1178
|
/* lie: use transient failure from the transport to indicate goaway has been
|
1149
1179
|
* received */
|
1150
|
-
connectivity_state_set(t, GRPC_CHANNEL_TRANSIENT_FAILURE,
|
1151
|
-
GRPC_ERROR_REF(t->goaway_error), "got_goaway");
|
1180
|
+
connectivity_state_set(t, GRPC_CHANNEL_TRANSIENT_FAILURE, "got_goaway");
|
1152
1181
|
}
|
1153
1182
|
|
1154
1183
|
static void maybe_start_some_streams(grpc_chttp2_transport* t) {
|
@@ -1170,10 +1199,8 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
|
|
1170
1199
|
t->next_stream_id += 2;
|
1171
1200
|
|
1172
1201
|
if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) {
|
1173
|
-
connectivity_state_set(
|
1174
|
-
|
1175
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
|
1176
|
-
"no_more_stream_ids");
|
1202
|
+
connectivity_state_set(t, GRPC_CHANNEL_TRANSIENT_FAILURE,
|
1203
|
+
"no_more_stream_ids");
|
1177
1204
|
}
|
1178
1205
|
|
1179
1206
|
grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
|
@@ -1222,7 +1249,7 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|
1222
1249
|
return;
|
1223
1250
|
}
|
1224
1251
|
closure->next_data.scratch -= CLOSURE_BARRIER_FIRST_REF_BIT;
|
1225
|
-
if (grpc_http_trace
|
1252
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
1226
1253
|
const char* errstr = grpc_error_string(error);
|
1227
1254
|
gpr_log(
|
1228
1255
|
GPR_INFO,
|
@@ -1249,7 +1276,9 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|
1249
1276
|
if (closure->next_data.scratch < CLOSURE_BARRIER_FIRST_REF_BIT) {
|
1250
1277
|
if ((t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE) ||
|
1251
1278
|
!(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) {
|
1252
|
-
GRPC_CLOSURE_RUN
|
1279
|
+
// Using GRPC_CLOSURE_SCHED instead of GRPC_CLOSURE_RUN to avoid running
|
1280
|
+
// closures earlier than when it is safe to do so.
|
1281
|
+
GRPC_CLOSURE_SCHED(closure, closure->error_data.error);
|
1253
1282
|
} else {
|
1254
1283
|
grpc_closure_list_append(&t->run_after_write, closure,
|
1255
1284
|
closure->error_data.error);
|
@@ -1259,8 +1288,8 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|
1259
1288
|
|
1260
1289
|
static bool contains_non_ok_status(grpc_metadata_batch* batch) {
|
1261
1290
|
if (batch->idx.named.grpc_status != nullptr) {
|
1262
|
-
return !
|
1263
|
-
|
1291
|
+
return !grpc_mdelem_static_value_eq(batch->idx.named.grpc_status->md,
|
1292
|
+
GRPC_MDELEM_GRPC_STATUS_0);
|
1264
1293
|
}
|
1265
1294
|
return false;
|
1266
1295
|
}
|
@@ -1344,8 +1373,6 @@ static void complete_fetch_locked(void* gs, grpc_error* error) {
|
|
1344
1373
|
}
|
1345
1374
|
}
|
1346
1375
|
|
1347
|
-
static void do_nothing(void* arg, grpc_error* error) {}
|
1348
|
-
|
1349
1376
|
static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
|
1350
1377
|
bool is_client, bool is_initial) {
|
1351
1378
|
for (grpc_linked_mdelem* md = md_batch->list.head; md != nullptr;
|
@@ -1374,7 +1401,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1374
1401
|
|
1375
1402
|
s->context = op->payload->context;
|
1376
1403
|
s->traced = op->is_traced;
|
1377
|
-
if (grpc_http_trace
|
1404
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
1378
1405
|
char* str = grpc_transport_stream_op_batch_string(op);
|
1379
1406
|
gpr_log(GPR_INFO, "perform_stream_op_locked: %s; on_complete = %p", str,
|
1380
1407
|
op->on_complete);
|
@@ -1390,21 +1417,14 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1390
1417
|
}
|
1391
1418
|
|
1392
1419
|
grpc_closure* on_complete = op->on_complete;
|
1393
|
-
//
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
on_complete = GRPC_CLOSURE_INIT(&op->handler_private.closure, do_nothing,
|
1400
|
-
nullptr, grpc_schedule_on_exec_ctx);
|
1420
|
+
// on_complete will be null if and only if there are no send ops in the batch.
|
1421
|
+
if (on_complete != nullptr) {
|
1422
|
+
// This batch has send ops. Use final_data as a barrier until enqueue time;
|
1423
|
+
// the initial counter is dropped at the end of this function.
|
1424
|
+
on_complete->next_data.scratch = CLOSURE_BARRIER_FIRST_REF_BIT;
|
1425
|
+
on_complete->error_data.error = GRPC_ERROR_NONE;
|
1401
1426
|
}
|
1402
1427
|
|
1403
|
-
/* use final_data as a barrier until enqueue time; the inital counter is
|
1404
|
-
dropped at the end of this function */
|
1405
|
-
on_complete->next_data.scratch = CLOSURE_BARRIER_FIRST_REF_BIT;
|
1406
|
-
on_complete->error_data.error = GRPC_ERROR_NONE;
|
1407
|
-
|
1408
1428
|
if (op->cancel_stream) {
|
1409
1429
|
GRPC_STATS_INC_HTTP2_OP_CANCEL();
|
1410
1430
|
grpc_chttp2_cancel_stream(t, s, op_payload->cancel_stream.cancel_error);
|
@@ -1428,7 +1448,12 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1428
1448
|
true, &s->stream_compression_method) == 0) {
|
1429
1449
|
s->stream_compression_method = GRPC_STREAM_COMPRESSION_IDENTITY_COMPRESS;
|
1430
1450
|
}
|
1431
|
-
|
1451
|
+
if (s->stream_compression_method !=
|
1452
|
+
GRPC_STREAM_COMPRESSION_IDENTITY_COMPRESS) {
|
1453
|
+
s->uncompressed_data_size = 0;
|
1454
|
+
s->stream_compression_ctx = nullptr;
|
1455
|
+
grpc_slice_buffer_init(&s->compressed_data_buffer);
|
1456
|
+
}
|
1432
1457
|
s->send_initial_metadata_finished = add_closure_barrier(on_complete);
|
1433
1458
|
s->send_initial_metadata =
|
1434
1459
|
op_payload->send_initial_metadata.send_initial_metadata;
|
@@ -1653,8 +1678,10 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1653
1678
|
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
1654
1679
|
}
|
1655
1680
|
|
1656
|
-
|
1657
|
-
|
1681
|
+
if (on_complete != nullptr) {
|
1682
|
+
grpc_chttp2_complete_closure_step(t, s, &on_complete, GRPC_ERROR_NONE,
|
1683
|
+
"op->on_complete");
|
1684
|
+
}
|
1658
1685
|
|
1659
1686
|
GRPC_CHTTP2_STREAM_UNREF(s, "perform_stream_op");
|
1660
1687
|
}
|
@@ -1678,7 +1705,7 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
|
|
1678
1705
|
}
|
1679
1706
|
}
|
1680
1707
|
|
1681
|
-
if (grpc_http_trace
|
1708
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
1682
1709
|
char* str = grpc_transport_stream_op_batch_string(op);
|
1683
1710
|
gpr_log(GPR_INFO, "perform_stream_op[s=%p]: %s", s, str);
|
1684
1711
|
gpr_free(str);
|
@@ -1693,7 +1720,7 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
|
|
1693
1720
|
}
|
1694
1721
|
|
1695
1722
|
static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error) {
|
1696
|
-
/* callback remaining pings: they're not allowed to call into the
|
1723
|
+
/* callback remaining pings: they're not allowed to call into the transport,
|
1697
1724
|
and maybe they hold resources that need to be freed */
|
1698
1725
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
1699
1726
|
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
@@ -1769,6 +1796,9 @@ void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
|
|
1769
1796
|
}
|
1770
1797
|
|
1771
1798
|
static void send_goaway(grpc_chttp2_transport* t, grpc_error* error) {
|
1799
|
+
/* We want to log this irrespective of whether http tracing is enabled */
|
1800
|
+
gpr_log(GPR_INFO, "%s: Sending goaway err=%s", t->peer_string,
|
1801
|
+
grpc_error_string(error));
|
1772
1802
|
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED;
|
1773
1803
|
grpc_http2_error_code http_error;
|
1774
1804
|
grpc_slice slice;
|
@@ -1842,7 +1872,7 @@ static void perform_transport_op_locked(void* stream_op,
|
|
1842
1872
|
|
1843
1873
|
static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
|
1844
1874
|
grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
|
1845
|
-
if (grpc_http_trace
|
1875
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
1846
1876
|
char* msg = grpc_transport_op_string(op);
|
1847
1877
|
gpr_log(GPR_INFO, "perform_transport_op[t=%p]: %s", t, msg);
|
1848
1878
|
gpr_free(msg);
|
@@ -1979,27 +2009,39 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
|
|
1979
2009
|
!s->seen_error && s->recv_trailing_metadata_finished != nullptr) {
|
1980
2010
|
/* Maybe some SYNC_FLUSH data is left in frame_storage. Consume them and
|
1981
2011
|
* maybe decompress the next 5 bytes in the stream. */
|
1982
|
-
|
1983
|
-
|
1984
|
-
s->
|
1985
|
-
|
1986
|
-
|
1987
|
-
if (!grpc_stream_decompress(
|
1988
|
-
s->stream_decompression_ctx, &s->frame_storage,
|
1989
|
-
&s->unprocessed_incoming_frames_buffer, nullptr,
|
1990
|
-
GRPC_HEADER_SIZE_IN_BYTES, &end_of_context)) {
|
1991
|
-
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1992
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
1993
|
-
&s->unprocessed_incoming_frames_buffer);
|
1994
|
-
s->seen_error = true;
|
1995
|
-
} else {
|
2012
|
+
if (s->stream_decompression_method ==
|
2013
|
+
GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS) {
|
2014
|
+
grpc_slice_buffer_move_first(&s->frame_storage,
|
2015
|
+
GRPC_HEADER_SIZE_IN_BYTES,
|
2016
|
+
&s->unprocessed_incoming_frames_buffer);
|
1996
2017
|
if (s->unprocessed_incoming_frames_buffer.length > 0) {
|
1997
2018
|
s->unprocessed_incoming_frames_decompressed = true;
|
1998
2019
|
pending_data = true;
|
1999
2020
|
}
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2021
|
+
} else {
|
2022
|
+
bool end_of_context;
|
2023
|
+
if (!s->stream_decompression_ctx) {
|
2024
|
+
s->stream_decompression_ctx = grpc_stream_compression_context_create(
|
2025
|
+
s->stream_decompression_method);
|
2026
|
+
}
|
2027
|
+
if (!grpc_stream_decompress(
|
2028
|
+
s->stream_decompression_ctx, &s->frame_storage,
|
2029
|
+
&s->unprocessed_incoming_frames_buffer, nullptr,
|
2030
|
+
GRPC_HEADER_SIZE_IN_BYTES, &end_of_context)) {
|
2031
|
+
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
2032
|
+
grpc_slice_buffer_reset_and_unref_internal(
|
2033
|
+
&s->unprocessed_incoming_frames_buffer);
|
2034
|
+
s->seen_error = true;
|
2035
|
+
} else {
|
2036
|
+
if (s->unprocessed_incoming_frames_buffer.length > 0) {
|
2037
|
+
s->unprocessed_incoming_frames_decompressed = true;
|
2038
|
+
pending_data = true;
|
2039
|
+
}
|
2040
|
+
if (end_of_context) {
|
2041
|
+
grpc_stream_compression_context_destroy(
|
2042
|
+
s->stream_decompression_ctx);
|
2043
|
+
s->stream_decompression_ctx = nullptr;
|
2044
|
+
}
|
2003
2045
|
}
|
2004
2046
|
}
|
2005
2047
|
}
|
@@ -2220,7 +2262,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|
2220
2262
|
if (closed_read) {
|
2221
2263
|
for (int i = 0; i < 2; i++) {
|
2222
2264
|
if (s->published_metadata[i] == GRPC_METADATA_NOT_PUBLISHED) {
|
2223
|
-
s->published_metadata[i] =
|
2265
|
+
s->published_metadata[i] = GRPC_METADATA_PUBLISHED_AT_CLOSE;
|
2224
2266
|
}
|
2225
2267
|
}
|
2226
2268
|
grpc_chttp2_maybe_complete_recv_initial_metadata(t, s);
|
@@ -2454,7 +2496,6 @@ static grpc_error* try_http_parsing(grpc_chttp2_transport* t) {
|
|
2454
2496
|
size_t i = 0;
|
2455
2497
|
grpc_error* error = GRPC_ERROR_NONE;
|
2456
2498
|
grpc_http_response response;
|
2457
|
-
memset(&response, 0, sizeof(response));
|
2458
2499
|
|
2459
2500
|
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
|
2460
2501
|
|
@@ -2549,11 +2590,16 @@ static void read_action_locked(void* tp, grpc_error* error) {
|
|
2549
2590
|
} else if (t->closed_with_error == GRPC_ERROR_NONE) {
|
2550
2591
|
keep_reading = true;
|
2551
2592
|
GRPC_CHTTP2_REF_TRANSPORT(t, "keep_reading");
|
2593
|
+
/* Since we have read a byte, reset the keepalive timer */
|
2594
|
+
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
|
2595
|
+
grpc_timer_cancel(&t->keepalive_ping_timer);
|
2596
|
+
}
|
2552
2597
|
}
|
2553
2598
|
grpc_slice_buffer_reset_and_unref_internal(&t->read_buffer);
|
2554
2599
|
|
2555
2600
|
if (keep_reading) {
|
2556
|
-
|
2601
|
+
const bool urgent = t->goaway_error != GRPC_ERROR_NONE;
|
2602
|
+
grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent);
|
2557
2603
|
grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t,
|
2558
2604
|
nullptr);
|
2559
2605
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "keep_reading");
|
@@ -2573,10 +2619,13 @@ static void schedule_bdp_ping_locked(grpc_chttp2_transport* t) {
|
|
2573
2619
|
|
2574
2620
|
static void start_bdp_ping_locked(void* tp, grpc_error* error) {
|
2575
2621
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2576
|
-
if (grpc_http_trace
|
2622
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
2577
2623
|
gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string,
|
2578
2624
|
grpc_error_string(error));
|
2579
2625
|
}
|
2626
|
+
if (error != GRPC_ERROR_NONE || t->closed_with_error != GRPC_ERROR_NONE) {
|
2627
|
+
return;
|
2628
|
+
}
|
2580
2629
|
/* Reset the keepalive ping timer */
|
2581
2630
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
|
2582
2631
|
grpc_timer_cancel(&t->keepalive_ping_timer);
|
@@ -2586,11 +2635,11 @@ static void start_bdp_ping_locked(void* tp, grpc_error* error) {
|
|
2586
2635
|
|
2587
2636
|
static void finish_bdp_ping_locked(void* tp, grpc_error* error) {
|
2588
2637
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2589
|
-
if (grpc_http_trace
|
2638
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
2590
2639
|
gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string,
|
2591
2640
|
grpc_error_string(error));
|
2592
2641
|
}
|
2593
|
-
if (error != GRPC_ERROR_NONE) {
|
2642
|
+
if (error != GRPC_ERROR_NONE || t->closed_with_error != GRPC_ERROR_NONE) {
|
2594
2643
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
2595
2644
|
return;
|
2596
2645
|
}
|
@@ -2718,6 +2767,9 @@ static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
|
|
2718
2767
|
if (t->channelz_socket != nullptr) {
|
2719
2768
|
t->channelz_socket->RecordKeepaliveSent();
|
2720
2769
|
}
|
2770
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
2771
|
+
gpr_log(GPR_INFO, "%s: Start keepalive ping", t->peer_string);
|
2772
|
+
}
|
2721
2773
|
GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog");
|
2722
2774
|
grpc_timer_init(&t->keepalive_watchdog_timer,
|
2723
2775
|
grpc_core::ExecCtx::Get()->Now() + t->keepalive_timeout,
|
@@ -2728,6 +2780,9 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
|
|
2728
2780
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2729
2781
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2730
2782
|
if (error == GRPC_ERROR_NONE) {
|
2783
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
2784
|
+
gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string);
|
2785
|
+
}
|
2731
2786
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
|
2732
2787
|
grpc_timer_cancel(&t->keepalive_watchdog_timer);
|
2733
2788
|
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
|
@@ -2743,6 +2798,8 @@ static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
|
|
2743
2798
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2744
2799
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2745
2800
|
if (error == GRPC_ERROR_NONE) {
|
2801
|
+
gpr_log(GPR_ERROR, "%s: Keepalive watchdog fired. Closing transport.",
|
2802
|
+
t->peer_string);
|
2746
2803
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
|
2747
2804
|
close_transport_locked(
|
2748
2805
|
t, grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
@@ -2767,9 +2824,9 @@ static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
|
|
2767
2824
|
|
2768
2825
|
static void connectivity_state_set(grpc_chttp2_transport* t,
|
2769
2826
|
grpc_connectivity_state state,
|
2770
|
-
|
2827
|
+
const char* reason) {
|
2771
2828
|
GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "set connectivity_state=%d", state));
|
2772
|
-
grpc_connectivity_state_set(&t->channel_callback.state_tracker, state,
|
2829
|
+
grpc_connectivity_state_set(&t->channel_callback.state_tracker, state,
|
2773
2830
|
reason);
|
2774
2831
|
}
|
2775
2832
|
|
@@ -2907,6 +2964,8 @@ bool Chttp2IncomingByteStream::Next(size_t max_size_hint,
|
|
2907
2964
|
}
|
2908
2965
|
|
2909
2966
|
void Chttp2IncomingByteStream::MaybeCreateStreamDecompressionCtx() {
|
2967
|
+
GPR_DEBUG_ASSERT(stream_->stream_decompression_method !=
|
2968
|
+
GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS);
|
2910
2969
|
if (!stream_->stream_decompression_ctx) {
|
2911
2970
|
stream_->stream_decompression_ctx = grpc_stream_compression_context_create(
|
2912
2971
|
stream_->stream_decompression_method);
|
@@ -2917,7 +2976,9 @@ grpc_error* Chttp2IncomingByteStream::Pull(grpc_slice* slice) {
|
|
2917
2976
|
GPR_TIMER_SCOPE("incoming_byte_stream_pull", 0);
|
2918
2977
|
grpc_error* error;
|
2919
2978
|
if (stream_->unprocessed_incoming_frames_buffer.length > 0) {
|
2920
|
-
if (!stream_->unprocessed_incoming_frames_decompressed
|
2979
|
+
if (!stream_->unprocessed_incoming_frames_decompressed &&
|
2980
|
+
stream_->stream_decompression_method !=
|
2981
|
+
GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS) {
|
2921
2982
|
bool end_of_context;
|
2922
2983
|
MaybeCreateStreamDecompressionCtx();
|
2923
2984
|
if (!grpc_stream_decompress(stream_->stream_decompression_ctx,
|
@@ -2964,7 +3025,7 @@ void Chttp2IncomingByteStream::PublishError(grpc_error* error) {
|
|
2964
3025
|
grpc_chttp2_cancel_stream(transport_, stream_, GRPC_ERROR_REF(error));
|
2965
3026
|
}
|
2966
3027
|
|
2967
|
-
grpc_error* Chttp2IncomingByteStream::Push(grpc_slice slice,
|
3028
|
+
grpc_error* Chttp2IncomingByteStream::Push(const grpc_slice& slice,
|
2968
3029
|
grpc_slice* slice_out) {
|
2969
3030
|
if (remaining_bytes_ < GRPC_SLICE_LENGTH(slice)) {
|
2970
3031
|
grpc_error* error =
|
@@ -3029,7 +3090,7 @@ static void benign_reclaimer_locked(void* arg, grpc_error* error) {
|
|
3029
3090
|
grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
3030
3091
|
/* Channel with no active streams: send a goaway to try and make it
|
3031
3092
|
* disconnect cleanly */
|
3032
|
-
if (grpc_resource_quota_trace
|
3093
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
3033
3094
|
gpr_log(GPR_INFO, "HTTP2: %s - send goaway to free memory",
|
3034
3095
|
t->peer_string);
|
3035
3096
|
}
|
@@ -3037,7 +3098,8 @@ static void benign_reclaimer_locked(void* arg, grpc_error* error) {
|
|
3037
3098
|
grpc_error_set_int(
|
3038
3099
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Buffers full"),
|
3039
3100
|
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM));
|
3040
|
-
} else if (error == GRPC_ERROR_NONE &&
|
3101
|
+
} else if (error == GRPC_ERROR_NONE &&
|
3102
|
+
GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
3041
3103
|
gpr_log(GPR_INFO,
|
3042
3104
|
"HTTP2: %s - skip benign reclamation, there are still %" PRIdPTR
|
3043
3105
|
" streams",
|
@@ -3058,7 +3120,7 @@ static void destructive_reclaimer_locked(void* arg, grpc_error* error) {
|
|
3058
3120
|
if (error == GRPC_ERROR_NONE && n > 0) {
|
3059
3121
|
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
|
3060
3122
|
grpc_chttp2_stream_map_rand(&t->stream_map));
|
3061
|
-
if (grpc_resource_quota_trace
|
3123
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
3062
3124
|
gpr_log(GPR_INFO, "HTTP2: %s - abandon stream id %d", t->peer_string,
|
3063
3125
|
s->id);
|
3064
3126
|
}
|
@@ -111,7 +111,7 @@ void FlowControlTrace::Finish() {
|
|
111
111
|
saw_str = gpr_leftpad("", ' ', kTracePadding);
|
112
112
|
}
|
113
113
|
gpr_log(GPR_DEBUG,
|
114
|
-
"%p[%u][%s] | %s | trw:%s,
|
114
|
+
"%p[%u][%s] | %s | trw:%s, tlw:%s, taw:%s, srw:%s, slw:%s, saw:%s",
|
115
115
|
tfc_, sfc_ != nullptr ? sfc_->stream()->id : 0,
|
116
116
|
tfc_->transport()->is_client ? "cli" : "svr", reason_, trw_str,
|
117
117
|
tlw_str, taw_str, srw_str, slw_str, saw_str);
|
@@ -190,7 +190,7 @@ TransportFlowControl::TransportFlowControl(const grpc_chttp2_transport* t,
|
|
190
190
|
uint32_t TransportFlowControl::MaybeSendUpdate(bool writing_anyway) {
|
191
191
|
FlowControlTrace trace("t updt sent", this, nullptr);
|
192
192
|
const uint32_t target_announced_window =
|
193
|
-
static_cast<
|
193
|
+
static_cast<uint32_t>(target_window());
|
194
194
|
if ((writing_anyway || announced_window_ <= target_announced_window / 2) &&
|
195
195
|
announced_window_ != target_announced_window) {
|
196
196
|
const uint32_t announce = static_cast<uint32_t> GPR_CLAMP(
|
@@ -127,7 +127,7 @@ class FlowControlTrace {
|
|
127
127
|
StreamFlowControl* sfc);
|
128
128
|
void Finish();
|
129
129
|
|
130
|
-
const bool enabled_ = grpc_flowctl_trace
|
130
|
+
const bool enabled_ = GRPC_TRACE_FLAG_ENABLED(grpc_flowctl_trace);
|
131
131
|
|
132
132
|
TransportFlowControl* tfc_;
|
133
133
|
StreamFlowControl* sfc_;
|