grpc 1.8.7 → 1.9.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 +549 -325
- data/include/grpc/impl/codegen/grpc_types.h +1 -2
- data/include/grpc/impl/codegen/port_platform.h +46 -5
- data/include/grpc/impl/codegen/slice.h +1 -2
- data/include/grpc/module.modulemap +0 -2
- data/include/grpc/slice_buffer.h +1 -2
- data/include/grpc/support/log.h +4 -2
- data/include/grpc/support/thd.h +4 -1
- data/include/grpc/support/tls.h +6 -0
- data/include/grpc/support/tls_gcc.h +5 -40
- data/include/grpc/support/tls_msvc.h +9 -0
- data/include/grpc/support/tls_pthread.h +9 -0
- data/src/core/ext/filters/client_channel/backup_poller.cc +32 -29
- data/src/core/ext/filters/client_channel/backup_poller.h +2 -2
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +26 -32
- data/src/core/ext/filters/client_channel/client_channel.cc +325 -356
- data/src/core/ext/filters/client_channel/client_channel.h +4 -12
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +9 -14
- data/src/core/ext/filters/client_channel/client_channel_factory.h +7 -20
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +7 -10
- data/src/core/ext/filters/client_channel/connector.cc +6 -7
- data/src/core/ext/filters/client_channel/connector.h +6 -16
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +38 -50
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +0 -8
- data/src/core/ext/filters/client_channel/http_proxy.cc +9 -13
- data/src/core/ext/filters/client_channel/http_proxy.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy.cc +72 -94
- data/src/core/ext/filters/client_channel/lb_policy.h +83 -92
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +474 -591
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +2 -10
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +6 -6
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +0 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +0 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +3 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +9 -12
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +160 -182
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +182 -221
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +24 -35
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +9 -20
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +6 -9
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +4 -15
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -9
- data/src/core/ext/filters/client_channel/parse_address.cc +1 -1
- data/src/core/ext/filters/client_channel/parse_address.h +0 -8
- data/src/core/ext/filters/client_channel/proxy_mapper.cc +6 -8
- data/src/core/ext/filters/client_channel/proxy_mapper.h +6 -16
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +13 -17
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +2 -12
- data/src/core/ext/filters/client_channel/resolver.cc +11 -13
- data/src/core/ext/filters/client_channel/resolver.h +14 -25
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +57 -70
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +2 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +23 -31
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +27 -45
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -15
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +9 -11
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +53 -66
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +25 -33
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +1 -9
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +26 -35
- data/src/core/ext/filters/client_channel/resolver_factory.cc +2 -3
- data/src/core/ext/filters/client_channel/resolver_factory.h +2 -12
- data/src/core/ext/filters/client_channel/resolver_registry.cc +12 -15
- data/src/core/ext/filters/client_channel/resolver_registry.h +3 -12
- data/src/core/ext/filters/client_channel/retry_throttle.h +0 -8
- data/src/core/ext/filters/client_channel/subchannel.cc +289 -301
- data/src/core/ext/filters/client_channel/subchannel.h +57 -84
- data/src/core/ext/filters/client_channel/subchannel_index.cc +30 -33
- data/src/core/ext/filters/client_channel/subchannel_index.h +4 -16
- data/src/core/ext/filters/client_channel/uri_parser.cc +13 -17
- data/src/core/ext/filters/client_channel/uri_parser.h +1 -10
- data/src/core/ext/filters/deadline/deadline_filter.cc +49 -67
- data/src/core/ext/filters/deadline/deadline_filter.h +4 -14
- data/src/core/ext/filters/http/client/http_client_filter.cc +60 -77
- data/src/core/ext/filters/http/client/http_client_filter.h +0 -8
- data/src/core/ext/filters/http/http_filters_plugin.cc +4 -6
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +63 -79
- data/src/core/ext/filters/http/message_compress/message_compress_filter.h +0 -8
- data/src/core/ext/filters/http/server/http_server_filter.cc +57 -71
- data/src/core/ext/filters/http/server/http_server_filter.h +0 -8
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +19 -24
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +0 -8
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +3 -3
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +0 -8
- data/src/core/ext/filters/max_age/max_age_filter.cc +49 -62
- data/src/core/ext/filters/max_age/max_age_filter.h +0 -8
- data/src/core/ext/filters/message_size/message_size_filter.cc +23 -29
- data/src/core/ext/filters/message_size/message_size_filter.h +0 -8
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +15 -18
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +0 -8
- data/src/core/ext/filters/workarounds/workaround_utils.h +0 -8
- data/src/core/ext/transport/chttp2/alpn/alpn.h +0 -8
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +33 -40
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +0 -8
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +15 -17
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +8 -8
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +23 -28
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +50 -57
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +1 -10
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +3 -3
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +7 -10
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +7 -9
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -11
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +1 -9
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +10 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +516 -636
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +4 -11
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +29 -13
- data/src/core/ext/transport/chttp2/transport/flow_control.h +196 -53
- data/src/core/ext/transport/chttp2/transport/frame.h +0 -8
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +31 -33
- data/src/core/ext/transport/chttp2/transport/frame_data.h +3 -12
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -10
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -9
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -10
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +8 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -10
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +8 -8
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +5 -11
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +63 -81
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +230 -318
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +6 -19
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +14 -20
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +5 -16
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +0 -7
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +0 -8
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +8 -11
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +4 -13
- data/src/core/ext/transport/chttp2/transport/internal.h +51 -75
- data/src/core/ext/transport/chttp2/transport/parsing.cc +83 -109
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -8
- data/src/core/ext/transport/chttp2/transport/varint.h +0 -8
- data/src/core/ext/transport/chttp2/transport/writing.cc +61 -65
- data/src/core/ext/transport/inproc/inproc_plugin.cc +2 -4
- data/src/core/ext/transport/inproc/inproc_transport.cc +177 -188
- data/src/core/ext/transport/inproc/inproc_transport.h +0 -8
- data/src/core/lib/backoff/backoff.cc +39 -44
- data/src/core/lib/backoff/backoff.h +61 -57
- data/src/core/lib/channel/channel_args.cc +8 -10
- data/src/core/lib/channel/channel_args.h +4 -13
- data/src/core/lib/channel/channel_stack.cc +19 -27
- data/src/core/lib/channel/channel_stack.h +27 -47
- data/src/core/lib/channel/channel_stack_builder.cc +11 -14
- data/src/core/lib/channel/channel_stack_builder.h +4 -15
- data/src/core/lib/channel/connected_channel.cc +23 -36
- data/src/core/lib/channel/connected_channel.h +1 -10
- data/src/core/lib/channel/handshaker.cc +31 -40
- data/src/core/lib/channel/handshaker.h +14 -25
- data/src/core/lib/channel/handshaker_factory.cc +6 -6
- data/src/core/lib/channel/handshaker_factory.h +5 -15
- data/src/core/lib/channel/handshaker_registry.cc +9 -13
- data/src/core/lib/channel/handshaker_registry.h +2 -11
- data/src/core/lib/compression/algorithm_metadata.h +0 -8
- data/src/core/lib/compression/message_compress.cc +19 -23
- data/src/core/lib/compression/message_compress.h +2 -12
- data/src/core/lib/compression/stream_compression.cc +1 -1
- data/src/core/lib/compression/stream_compression.h +0 -8
- data/src/core/lib/compression/stream_compression_gzip.cc +12 -11
- data/src/core/lib/compression/stream_compression_gzip.h +0 -8
- data/src/core/lib/compression/stream_compression_identity.h +0 -8
- data/src/core/lib/debug/stats.cc +4 -4
- data/src/core/lib/debug/stats.h +9 -19
- data/src/core/lib/debug/stats_data.cc +85 -116
- data/src/core/lib/debug/stats_data.h +236 -312
- data/src/core/lib/debug/trace.cc +1 -1
- data/src/core/lib/debug/trace.h +0 -12
- data/src/core/lib/{support → gpr++}/abstract.h +8 -3
- data/src/core/lib/{support → gpr++}/atomic.h +5 -5
- data/src/core/lib/{support → gpr++}/atomic_with_atm.h +3 -3
- data/src/core/lib/{support → gpr++}/atomic_with_std.h +3 -3
- data/src/core/lib/gpr++/debug_location.h +52 -0
- data/src/core/lib/gpr++/inlined_vector.h +112 -0
- data/src/core/lib/{support → gpr++}/manual_constructor.h +2 -2
- data/src/core/lib/{support → gpr++}/memory.h +3 -3
- data/src/core/lib/gpr++/orphanable.h +171 -0
- data/src/core/lib/gpr++/ref_counted.h +133 -0
- data/src/core/lib/gpr++/ref_counted_ptr.h +99 -0
- data/src/core/lib/{support → gpr}/alloc.cc +0 -0
- data/src/core/lib/{support → gpr}/arena.cc +1 -1
- data/src/core/lib/{support → gpr}/arena.h +3 -11
- data/src/core/lib/{support → gpr}/atm.cc +0 -0
- data/src/core/lib/{support → gpr}/avl.cc +0 -0
- data/src/core/lib/{support → gpr}/cmdline.cc +1 -1
- data/src/core/lib/{support → gpr}/cpu_iphone.cc +0 -0
- data/src/core/lib/{support → gpr}/cpu_linux.cc +0 -0
- data/src/core/lib/{support → gpr}/cpu_posix.cc +0 -0
- data/src/core/lib/{support → gpr}/cpu_windows.cc +0 -0
- data/src/core/lib/{support → gpr}/env.h +3 -11
- data/src/core/lib/{support → gpr}/env_linux.cc +2 -2
- data/src/core/lib/{support → gpr}/env_posix.cc +4 -4
- data/src/core/lib/{support → gpr}/env_windows.cc +3 -3
- data/src/core/lib/{support → gpr}/fork.cc +3 -3
- data/src/core/lib/{support → gpr}/fork.h +3 -3
- data/src/core/lib/{support → gpr}/host_port.cc +1 -1
- data/src/core/lib/{support → gpr}/log.cc +3 -3
- data/src/core/lib/{support → gpr}/log_android.cc +3 -3
- data/src/core/lib/{support → gpr}/log_linux.cc +1 -1
- data/src/core/lib/{support → gpr}/log_posix.cc +5 -5
- data/src/core/lib/{support → gpr}/log_windows.cc +3 -3
- data/src/core/lib/{support → gpr}/mpscq.cc +1 -1
- data/src/core/lib/{support → gpr}/mpscq.h +3 -10
- data/src/core/lib/{support → gpr}/murmur_hash.cc +1 -1
- data/src/core/lib/{support → gpr}/murmur_hash.h +3 -11
- data/src/core/lib/{support → gpr}/spinlock.h +3 -3
- data/src/core/lib/{support → gpr}/string.cc +1 -1
- data/src/core/lib/{support → gpr}/string.h +3 -10
- data/src/core/lib/{support → gpr}/string_posix.cc +0 -0
- data/src/core/lib/{support → gpr}/string_util_windows.cc +2 -2
- data/src/core/lib/{support → gpr}/string_windows.cc +1 -1
- data/src/core/lib/{support → gpr}/string_windows.h +3 -11
- data/src/core/lib/{support → gpr}/subprocess_posix.cc +0 -0
- data/src/core/lib/{support → gpr}/subprocess_windows.cc +2 -2
- data/src/core/lib/{support → gpr}/sync.cc +0 -0
- data/src/core/lib/{support → gpr}/sync_posix.cc +10 -1
- data/src/core/lib/{support → gpr}/sync_windows.cc +0 -0
- data/src/core/lib/{support → gpr}/thd.cc +0 -0
- data/src/core/lib/{support → gpr}/thd_internal.h +3 -3
- data/src/core/lib/{support → gpr}/thd_posix.cc +18 -2
- data/src/core/lib/{support → gpr}/thd_windows.cc +2 -1
- data/src/core/lib/{support → gpr}/time.cc +0 -0
- data/src/core/lib/{support → gpr}/time_posix.cc +2 -4
- data/src/core/lib/{support → gpr}/time_precise.cc +1 -1
- data/src/core/lib/{support → gpr}/time_precise.h +3 -11
- data/src/core/lib/{support → gpr}/time_windows.cc +1 -3
- data/src/core/lib/{support → gpr}/tls_pthread.cc +0 -0
- data/src/core/lib/{support → gpr}/tmpfile.h +3 -11
- data/src/core/lib/{support → gpr}/tmpfile_msys.cc +2 -2
- data/src/core/lib/{support → gpr}/tmpfile_posix.cc +2 -2
- data/src/core/lib/{support → gpr}/tmpfile_windows.cc +2 -2
- data/src/core/lib/{support → gpr}/wrap_memcpy.cc +0 -0
- data/src/core/lib/http/format_request.cc +1 -1
- data/src/core/lib/http/format_request.h +0 -8
- data/src/core/lib/http/httpcli.cc +55 -74
- data/src/core/lib/http/httpcli.h +13 -22
- data/src/core/lib/http/httpcli_security_connector.cc +27 -33
- data/src/core/lib/http/parser.h +0 -8
- data/src/core/lib/iomgr/block_annotate.h +10 -17
- data/src/core/lib/iomgr/call_combiner.cc +14 -17
- data/src/core/lib/iomgr/call_combiner.h +16 -34
- data/src/core/lib/iomgr/closure.h +24 -37
- data/src/core/lib/iomgr/combiner.cc +62 -66
- data/src/core/lib/iomgr/combiner.h +6 -16
- data/src/core/lib/iomgr/endpoint.cc +15 -21
- data/src/core/lib/iomgr/endpoint.h +16 -33
- data/src/core/lib/iomgr/endpoint_pair.h +0 -8
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +4 -5
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +4 -6
- data/src/core/lib/iomgr/error.cc +2 -6
- data/src/core/lib/iomgr/error.h +4 -9
- data/src/core/lib/iomgr/error_internal.h +0 -8
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +110 -117
- data/src/core/lib/iomgr/ev_epoll1_linux.h +0 -8
- data/src/core/lib/iomgr/ev_epollex_linux.cc +111 -141
- data/src/core/lib/iomgr/ev_epollex_linux.h +0 -8
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +83 -109
- data/src/core/lib/iomgr/ev_epollsig_linux.h +2 -10
- data/src/core/lib/iomgr/ev_poll_posix.cc +103 -125
- data/src/core/lib/iomgr/ev_poll_posix.h +0 -8
- data/src/core/lib/iomgr/ev_posix.cc +35 -50
- data/src/core/lib/iomgr/ev_posix.h +27 -53
- data/src/core/lib/iomgr/exec_ctx.cc +46 -78
- data/src/core/lib/iomgr/exec_ctx.h +127 -60
- data/src/core/lib/iomgr/executor.cc +34 -38
- data/src/core/lib/iomgr/executor.h +3 -11
- data/src/core/lib/iomgr/fork_posix.cc +13 -12
- data/src/core/lib/iomgr/gethostname.h +0 -8
- data/src/core/lib/iomgr/gethostname_sysconf.cc +1 -1
- data/src/core/lib/iomgr/iocp_windows.cc +14 -16
- data/src/core/lib/iomgr/iocp_windows.h +1 -10
- data/src/core/lib/iomgr/iomgr.cc +60 -59
- data/src/core/lib/iomgr/iomgr.h +3 -12
- data/src/core/lib/iomgr/iomgr_internal.h +0 -8
- data/src/core/lib/iomgr/iomgr_uv.cc +2 -3
- data/src/core/lib/iomgr/iomgr_uv.h +0 -8
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +1 -1
- data/src/core/lib/iomgr/load_file.cc +1 -1
- data/src/core/lib/iomgr/load_file.h +0 -8
- data/src/core/lib/iomgr/lockfree_event.cc +7 -8
- data/src/core/lib/iomgr/lockfree_event.h +3 -3
- data/src/core/lib/iomgr/polling_entity.cc +6 -10
- data/src/core/lib/iomgr/polling_entity.h +2 -11
- data/src/core/lib/iomgr/pollset.h +4 -13
- data/src/core/lib/iomgr/pollset_set.h +5 -18
- data/src/core/lib/iomgr/pollset_set_uv.cc +5 -10
- data/src/core/lib/iomgr/pollset_set_windows.cc +5 -10
- data/src/core/lib/iomgr/pollset_uv.cc +8 -9
- data/src/core/lib/iomgr/pollset_uv.h +0 -8
- data/src/core/lib/iomgr/pollset_windows.cc +14 -15
- data/src/core/lib/iomgr/pollset_windows.h +0 -8
- data/src/core/lib/iomgr/port.h +6 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -10
- data/src/core/lib/iomgr/resolve_address_posix.cc +10 -12
- data/src/core/lib/iomgr/resolve_address_uv.cc +7 -8
- data/src/core/lib/iomgr/resolve_address_windows.cc +8 -9
- data/src/core/lib/iomgr/resource_quota.cc +77 -107
- data/src/core/lib/iomgr/resource_quota.h +8 -25
- data/src/core/lib/iomgr/sockaddr_utils.cc +1 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +0 -8
- data/src/core/lib/iomgr/socket_factory_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_factory_posix.h +0 -8
- data/src/core/lib/iomgr/socket_mutator.cc +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +1 -9
- data/src/core/lib/iomgr/socket_utils.h +0 -8
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +0 -8
- data/src/core/lib/iomgr/socket_windows.cc +8 -11
- data/src/core/lib/iomgr/socket_windows.h +3 -14
- data/src/core/lib/iomgr/tcp_client.h +1 -10
- data/src/core/lib/iomgr/tcp_client_posix.cc +94 -78
- data/src/core/lib/iomgr/tcp_client_posix.h +36 -8
- data/src/core/lib/iomgr/tcp_client_uv.cc +16 -23
- data/src/core/lib/iomgr/tcp_client_windows.cc +22 -25
- data/src/core/lib/iomgr/tcp_posix.cc +131 -153
- data/src/core/lib/iomgr/tcp_posix.h +3 -12
- data/src/core/lib/iomgr/tcp_server.h +6 -17
- data/src/core/lib/iomgr/tcp_server_posix.cc +31 -35
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -8
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -1
- data/src/core/lib/iomgr/tcp_server_uv.cc +23 -34
- data/src/core/lib/iomgr/tcp_server_windows.cc +24 -34
- data/src/core/lib/iomgr/tcp_uv.cc +42 -56
- data/src/core/lib/iomgr/tcp_uv.h +0 -8
- data/src/core/lib/iomgr/tcp_windows.cc +43 -50
- data/src/core/lib/iomgr/tcp_windows.h +1 -9
- data/src/core/lib/iomgr/time_averaged_stats.h +0 -8
- data/src/core/lib/iomgr/timer.h +6 -15
- data/src/core/lib/iomgr/timer_generic.cc +22 -27
- data/src/core/lib/iomgr/timer_heap.h +0 -8
- data/src/core/lib/iomgr/timer_manager.cc +17 -19
- data/src/core/lib/iomgr/timer_manager.h +0 -8
- data/src/core/lib/iomgr/timer_uv.cc +12 -14
- data/src/core/lib/iomgr/udp_server.cc +148 -54
- data/src/core/lib/iomgr/udp_server.h +16 -21
- data/src/core/lib/iomgr/unix_sockets_posix.h +0 -8
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +4 -4
- data/src/core/lib/iomgr/wakeup_fd_cv.h +12 -20
- data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -1
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +0 -8
- data/src/core/lib/iomgr/wakeup_fd_posix.h +0 -8
- data/src/core/lib/json/json.h +0 -8
- data/src/core/lib/json/json_reader.h +0 -8
- data/src/core/lib/json/json_writer.h +0 -8
- data/src/core/lib/profiling/basic_timers.cc +3 -2
- data/src/core/lib/profiling/timers.h +0 -8
- data/src/core/lib/security/context/security_context.cc +9 -10
- data/src/core/lib/security/context/security_context.h +0 -8
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +23 -28
- data/src/core/lib/security/credentials/composite/composite_credentials.h +0 -8
- data/src/core/lib/security/credentials/credentials.cc +33 -42
- data/src/core/lib/security/credentials/credentials.h +24 -43
- data/src/core/lib/security/credentials/credentials_metadata.cc +2 -2
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +16 -22
- data/src/core/lib/security/credentials/fake/fake_credentials.h +0 -8
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +3 -3
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +28 -34
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +0 -8
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +9 -13
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/json_token.h +0 -8
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +14 -20
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +1 -10
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +56 -72
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +5 -17
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +47 -55
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +3 -12
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +23 -28
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +8 -13
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +0 -8
- data/src/core/lib/security/transport/auth_filters.h +0 -8
- data/src/core/lib/security/transport/client_auth_filter.cc +45 -54
- data/src/core/lib/security/transport/lb_targets_info.cc +2 -2
- data/src/core/lib/security/transport/lb_targets_info.h +0 -8
- data/src/core/lib/security/transport/secure_endpoint.cc +54 -68
- data/src/core/lib/security/transport/secure_endpoint.h +0 -8
- data/src/core/lib/security/transport/security_connector.cc +62 -86
- data/src/core/lib/security/transport/security_connector.h +22 -39
- data/src/core/lib/security/transport/security_handshaker.cc +83 -106
- data/src/core/lib/security/transport/security_handshaker.h +1 -10
- data/src/core/lib/security/transport/server_auth_filter.cc +31 -38
- data/src/core/lib/security/transport/tsi_error.h +0 -8
- data/src/core/lib/security/util/json_util.h +0 -8
- data/src/core/lib/slice/b64.cc +5 -6
- data/src/core/lib/slice/b64.h +3 -12
- data/src/core/lib/slice/percent_encoding.h +0 -8
- data/src/core/lib/slice/slice.cc +8 -9
- data/src/core/lib/slice/slice_buffer.cc +11 -16
- data/src/core/lib/slice/slice_hash_table.cc +5 -7
- data/src/core/lib/slice/slice_hash_table.h +2 -12
- data/src/core/lib/slice/slice_intern.cc +4 -5
- data/src/core/lib/slice/slice_internal.h +4 -15
- data/src/core/lib/slice/slice_string_helpers.cc +1 -1
- data/src/core/lib/slice/slice_string_helpers.h +1 -9
- data/src/core/lib/surface/alarm.cc +11 -14
- data/src/core/lib/surface/alarm_internal.h +0 -8
- data/src/core/lib/surface/byte_buffer.cc +2 -3
- data/src/core/lib/surface/byte_buffer_reader.cc +7 -9
- data/src/core/lib/surface/call.cc +198 -241
- data/src/core/lib/surface/call.h +9 -23
- data/src/core/lib/surface/call_details.cc +3 -4
- data/src/core/lib/surface/call_log_batch.cc +1 -1
- data/src/core/lib/surface/call_test_only.h +0 -8
- data/src/core/lib/surface/channel.cc +53 -64
- data/src/core/lib/surface/channel.h +12 -23
- data/src/core/lib/surface/channel_init.cc +2 -3
- data/src/core/lib/surface/channel_init.h +2 -12
- data/src/core/lib/surface/channel_ping.cc +7 -9
- data/src/core/lib/surface/channel_stack_type.h +0 -8
- data/src/core/lib/surface/completion_queue.cc +158 -176
- data/src/core/lib/surface/completion_queue.h +9 -20
- data/src/core/lib/surface/completion_queue_factory.h +0 -8
- data/src/core/lib/surface/event_string.cc +1 -1
- data/src/core/lib/surface/event_string.h +0 -8
- data/src/core/lib/surface/init.cc +27 -25
- data/src/core/lib/surface/init.h +0 -8
- data/src/core/lib/surface/init_secure.cc +2 -2
- data/src/core/lib/surface/lame_client.cc +30 -33
- data/src/core/lib/surface/lame_client.h +0 -8
- data/src/core/lib/surface/server.cc +151 -203
- data/src/core/lib/surface/server.h +7 -16
- data/src/core/lib/surface/validate_metadata.h +0 -8
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.h +1 -1
- data/src/core/lib/transport/byte_stream.cc +24 -38
- data/src/core/lib/transport/byte_stream.h +10 -25
- data/src/core/lib/transport/connectivity_state.cc +9 -13
- data/src/core/lib/transport/connectivity_state.h +4 -14
- data/src/core/lib/transport/error_utils.cc +6 -6
- data/src/core/lib/transport/error_utils.h +2 -11
- data/src/core/lib/transport/metadata.cc +21 -23
- data/src/core/lib/transport/metadata.h +8 -20
- data/src/core/lib/transport/metadata_batch.cc +34 -45
- data/src/core/lib/transport/metadata_batch.h +18 -32
- data/src/core/lib/transport/service_config.cc +11 -15
- data/src/core/lib/transport/service_config.h +3 -13
- data/src/core/lib/transport/static_metadata.cc +1 -1
- data/src/core/lib/transport/static_metadata.h +1 -7
- data/src/core/lib/transport/status_conversion.cc +2 -3
- data/src/core/lib/transport/status_conversion.h +1 -10
- data/src/core/lib/transport/timeout_encoding.cc +1 -1
- data/src/core/lib/transport/timeout_encoding.h +1 -9
- data/src/core/lib/transport/transport.cc +36 -50
- data/src/core/lib/transport/transport.h +28 -30
- data/src/core/lib/transport/transport_impl.h +12 -23
- data/src/core/lib/transport/transport_op_string.cc +2 -2
- data/src/core/plugin_registry/grpc_plugin_registry.cc +34 -34
- data/src/core/tsi/fake_transport_security.cc +7 -10
- data/src/core/tsi/fake_transport_security.h +0 -8
- data/src/core/tsi/gts_transport_security.cc +2 -2
- data/src/core/tsi/gts_transport_security.h +0 -8
- data/src/core/tsi/ssl_transport_security.cc +3 -0
- data/src/core/tsi/ssl_transport_security.h +0 -8
- data/src/core/tsi/ssl_types.h +0 -8
- data/src/core/tsi/transport_security.h +1 -9
- data/src/core/tsi/transport_security_adapter.h +0 -8
- data/src/core/tsi/transport_security_grpc.cc +11 -18
- data/src/core/tsi/transport_security_grpc.h +9 -21
- data/src/core/tsi/transport_security_interface.h +0 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +0 -30
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +2 -48
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_connection_spec.rb +2 -1
- data/src/ruby/spec/client_auth_spec.rb +1 -1
- data/src/ruby/spec/client_server_spec.rb +2 -2
- data/src/ruby/spec/generic/active_call_spec.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
- data/src/ruby/spec/generic/interceptor_registry_spec.rb +1 -1
- data/src/ruby/spec/generic/rpc_server_spec.rb +12 -12
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +3 -2
- data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
- data/src/ruby/spec/server_spec.rb +9 -9
- data/src/ruby/spec/support/helpers.rb +35 -1
- metadata +68 -66
- data/include/grpc/impl/codegen/exec_ctx_fwd.h +0 -26
- data/include/grpc/support/histogram.h +0 -64
- data/src/core/lib/support/histogram.cc +0 -227
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
|
38
38
|
grpc_server_credentials* creds) {
|
39
|
-
|
39
|
+
grpc_core::ExecCtx exec_ctx;
|
40
40
|
grpc_error* err = GRPC_ERROR_NONE;
|
41
41
|
grpc_server_security_connector* sc = nullptr;
|
42
42
|
int port_num = 0;
|
@@ -52,8 +52,7 @@ int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
|
|
52
52
|
"No credentials specified for secure server port (creds==NULL)");
|
53
53
|
goto done;
|
54
54
|
}
|
55
|
-
status =
|
56
|
-
grpc_server_credentials_create_security_connector(&exec_ctx, creds, &sc);
|
55
|
+
status = grpc_server_credentials_create_security_connector(creds, &sc);
|
57
56
|
if (status != GRPC_SECURITY_OK) {
|
58
57
|
char* msg;
|
59
58
|
gpr_asprintf(&msg,
|
@@ -72,12 +71,12 @@ int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
|
|
72
71
|
grpc_channel_args_copy_and_add(grpc_server_get_channel_args(server),
|
73
72
|
args_to_add, GPR_ARRAY_SIZE(args_to_add));
|
74
73
|
// Add server port.
|
75
|
-
err = grpc_chttp2_server_add_port(
|
74
|
+
err = grpc_chttp2_server_add_port(server, addr, args, &port_num);
|
76
75
|
done:
|
77
76
|
if (sc != nullptr) {
|
78
|
-
GRPC_SECURITY_CONNECTOR_UNREF(&
|
77
|
+
GRPC_SECURITY_CONNECTOR_UNREF(&sc->base, "server");
|
79
78
|
}
|
80
|
-
|
79
|
+
|
81
80
|
if (err != GRPC_ERROR_NONE) {
|
82
81
|
const char* msg = grpc_error_string(err);
|
83
82
|
gpr_log(GPR_ERROR, "%s", msg);
|
@@ -19,9 +19,9 @@
|
|
19
19
|
#include "src/core/ext/transport/chttp2/transport/bin_decoder.h"
|
20
20
|
#include <grpc/support/alloc.h>
|
21
21
|
#include <grpc/support/log.h>
|
22
|
+
#include "src/core/lib/gpr/string.h"
|
22
23
|
#include "src/core/lib/slice/slice_internal.h"
|
23
24
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
24
|
-
#include "src/core/lib/support/string.h"
|
25
25
|
|
26
26
|
static uint8_t decode_table[] = {
|
27
27
|
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
@@ -130,8 +130,7 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context* ctx) {
|
|
130
130
|
return true;
|
131
131
|
}
|
132
132
|
|
133
|
-
grpc_slice grpc_chttp2_base64_decode(
|
134
|
-
grpc_slice input) {
|
133
|
+
grpc_slice grpc_chttp2_base64_decode(grpc_slice input) {
|
135
134
|
size_t input_length = GRPC_SLICE_LENGTH(input);
|
136
135
|
size_t output_length = input_length / 4 * 3;
|
137
136
|
struct grpc_base64_decode_context ctx;
|
@@ -167,7 +166,7 @@ grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx* exec_ctx,
|
|
167
166
|
char* s = grpc_slice_to_c_string(input);
|
168
167
|
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
|
169
168
|
gpr_free(s);
|
170
|
-
grpc_slice_unref_internal(
|
169
|
+
grpc_slice_unref_internal(output);
|
171
170
|
return grpc_empty_slice();
|
172
171
|
}
|
173
172
|
GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));
|
@@ -175,8 +174,7 @@ grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx* exec_ctx,
|
|
175
174
|
return output;
|
176
175
|
}
|
177
176
|
|
178
|
-
grpc_slice grpc_chttp2_base64_decode_with_length(
|
179
|
-
grpc_slice input,
|
177
|
+
grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
|
180
178
|
size_t output_length) {
|
181
179
|
size_t input_length = GRPC_SLICE_LENGTH(input);
|
182
180
|
grpc_slice output = GRPC_SLICE_MALLOC(output_length);
|
@@ -189,7 +187,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx,
|
|
189
187
|
"grpc_chttp2_base64_decode_with_length has a length of %d, which "
|
190
188
|
"has a tail of 1 byte.\n",
|
191
189
|
(int)input_length);
|
192
|
-
grpc_slice_unref_internal(
|
190
|
+
grpc_slice_unref_internal(output);
|
193
191
|
return grpc_empty_slice();
|
194
192
|
}
|
195
193
|
|
@@ -199,7 +197,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx,
|
|
199
197
|
"than the max possible output length %d.\n",
|
200
198
|
(int)output_length,
|
201
199
|
(int)(input_length / 4 * 3 + tail_xtra[input_length % 4]));
|
202
|
-
grpc_slice_unref_internal(
|
200
|
+
grpc_slice_unref_internal(output);
|
203
201
|
return grpc_empty_slice();
|
204
202
|
}
|
205
203
|
|
@@ -213,7 +211,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx,
|
|
213
211
|
char* s = grpc_slice_to_c_string(input);
|
214
212
|
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
|
215
213
|
gpr_free(s);
|
216
|
-
grpc_slice_unref_internal(
|
214
|
+
grpc_slice_unref_internal(output);
|
217
215
|
return grpc_empty_slice();
|
218
216
|
}
|
219
217
|
GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));
|
@@ -22,10 +22,6 @@
|
|
22
22
|
#include <grpc/slice.h>
|
23
23
|
#include <stdbool.h>
|
24
24
|
|
25
|
-
#ifdef __cplusplus
|
26
|
-
extern "C" {
|
27
|
-
#endif
|
28
|
-
|
29
25
|
struct grpc_base64_decode_context {
|
30
26
|
/* input/output: */
|
31
27
|
uint8_t* input_cur;
|
@@ -44,17 +40,12 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context* ctx);
|
|
44
40
|
|
45
41
|
/* base64 decode a slice with pad chars. Returns a new slice, does not take
|
46
42
|
ownership of the input. Returns an empty slice if decoding is failed. */
|
47
|
-
grpc_slice grpc_chttp2_base64_decode(
|
43
|
+
grpc_slice grpc_chttp2_base64_decode(grpc_slice input);
|
48
44
|
|
49
45
|
/* base64 decode a slice without pad chars, data length is needed. Returns a new
|
50
46
|
slice, does not take ownership of the input. Returns an empty slice if
|
51
47
|
decoding is failed. */
|
52
|
-
grpc_slice grpc_chttp2_base64_decode_with_length(
|
53
|
-
grpc_slice input,
|
48
|
+
grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
|
54
49
|
size_t output_length);
|
55
50
|
|
56
|
-
#ifdef __cplusplus
|
57
|
-
}
|
58
|
-
#endif
|
59
|
-
|
60
51
|
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */
|
@@ -21,10 +21,6 @@
|
|
21
21
|
|
22
22
|
#include <grpc/slice.h>
|
23
23
|
|
24
|
-
#ifdef __cplusplus
|
25
|
-
extern "C" {
|
26
|
-
#endif
|
27
|
-
|
28
24
|
/* base64 encode a slice. Returns a new slice, does not take ownership of the
|
29
25
|
input */
|
30
26
|
grpc_slice grpc_chttp2_base64_encode(grpc_slice input);
|
@@ -36,12 +32,8 @@ grpc_slice grpc_chttp2_huffman_compress(grpc_slice input);
|
|
36
32
|
/* equivalent to:
|
37
33
|
grpc_slice x = grpc_chttp2_base64_encode(input);
|
38
34
|
grpc_slice y = grpc_chttp2_huffman_compress(x);
|
39
|
-
grpc_slice_unref_internal(
|
35
|
+
grpc_slice_unref_internal( x);
|
40
36
|
return y; */
|
41
37
|
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(grpc_slice input);
|
42
38
|
|
43
|
-
#ifdef __cplusplus
|
44
|
-
}
|
45
|
-
#endif
|
46
|
-
|
47
39
|
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */
|
@@ -18,8 +18,16 @@
|
|
18
18
|
|
19
19
|
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
|
20
20
|
#include "src/core/lib/debug/trace.h"
|
21
|
+
#include "src/core/lib/gpr/env.h"
|
21
22
|
#include "src/core/lib/transport/metadata.h"
|
22
23
|
|
23
|
-
|
24
|
+
void grpc_chttp2_plugin_init(void) {
|
25
|
+
g_flow_control_enabled = true;
|
26
|
+
char* env_variable = gpr_getenv("GRPC_EXPERIMENTAL_DISABLE_FLOW_CONTROL");
|
27
|
+
if (env_variable != nullptr) {
|
28
|
+
g_flow_control_enabled = false;
|
29
|
+
gpr_free(env_variable);
|
30
|
+
}
|
31
|
+
}
|
24
32
|
|
25
|
-
|
33
|
+
void grpc_chttp2_plugin_shutdown(void) {}
|
@@ -38,14 +38,14 @@
|
|
38
38
|
#include "src/core/lib/channel/channel_args.h"
|
39
39
|
#include "src/core/lib/compression/stream_compression.h"
|
40
40
|
#include "src/core/lib/debug/stats.h"
|
41
|
+
#include "src/core/lib/gpr/env.h"
|
42
|
+
#include "src/core/lib/gpr/string.h"
|
41
43
|
#include "src/core/lib/http/parser.h"
|
42
44
|
#include "src/core/lib/iomgr/executor.h"
|
43
45
|
#include "src/core/lib/iomgr/timer.h"
|
44
46
|
#include "src/core/lib/profiling/timers.h"
|
45
47
|
#include "src/core/lib/slice/slice_internal.h"
|
46
48
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
47
|
-
#include "src/core/lib/support/env.h"
|
48
|
-
#include "src/core/lib/support/string.h"
|
49
49
|
#include "src/core/lib/transport/error_utils.h"
|
50
50
|
#include "src/core/lib/transport/http2_errors.h"
|
51
51
|
#include "src/core/lib/transport/static_metadata.h"
|
@@ -79,7 +79,9 @@ static int g_default_server_keepalive_time_ms =
|
|
79
79
|
DEFAULT_SERVER_KEEPALIVE_TIME_MS;
|
80
80
|
static int g_default_server_keepalive_timeout_ms =
|
81
81
|
DEFAULT_SERVER_KEEPALIVE_TIMEOUT_MS;
|
82
|
-
static bool
|
82
|
+
static bool g_default_client_keepalive_permit_without_calls =
|
83
|
+
DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS;
|
84
|
+
static bool g_default_server_keepalive_permit_without_calls =
|
83
85
|
DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS;
|
84
86
|
|
85
87
|
static int g_default_min_sent_ping_interval_without_data_ms =
|
@@ -95,105 +97,81 @@ grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount(false,
|
|
95
97
|
"chttp2_refcount");
|
96
98
|
|
97
99
|
/* forward declarations of various callbacks that we'll build closures around */
|
98
|
-
static void write_action_begin_locked(
|
99
|
-
|
100
|
-
static void
|
101
|
-
static void write_action_end_locked(grpc_exec_ctx* exec_ctx, void* t,
|
102
|
-
grpc_error* error);
|
100
|
+
static void write_action_begin_locked(void* t, grpc_error* error);
|
101
|
+
static void write_action(void* t, grpc_error* error);
|
102
|
+
static void write_action_end_locked(void* t, grpc_error* error);
|
103
103
|
|
104
|
-
static void read_action_locked(
|
105
|
-
grpc_error* error);
|
104
|
+
static void read_action_locked(void* t, grpc_error* error);
|
106
105
|
|
107
|
-
static void complete_fetch_locked(
|
108
|
-
grpc_error* error);
|
106
|
+
static void complete_fetch_locked(void* gs, grpc_error* error);
|
109
107
|
/** Set a transport level setting, and push it to our peer */
|
110
|
-
static void queue_setting_update(
|
111
|
-
grpc_chttp2_transport* t,
|
108
|
+
static void queue_setting_update(grpc_chttp2_transport* t,
|
112
109
|
grpc_chttp2_setting_id id, uint32_t value);
|
113
110
|
|
114
|
-
static void close_from_api(
|
115
|
-
|
111
|
+
static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
112
|
+
grpc_error* error);
|
116
113
|
|
117
114
|
/** Start new streams that have been created if we can */
|
118
|
-
static void maybe_start_some_streams(
|
119
|
-
grpc_chttp2_transport* t);
|
115
|
+
static void maybe_start_some_streams(grpc_chttp2_transport* t);
|
120
116
|
|
121
|
-
static void connectivity_state_set(
|
122
|
-
grpc_chttp2_transport* t,
|
117
|
+
static void connectivity_state_set(grpc_chttp2_transport* t,
|
123
118
|
grpc_connectivity_state state,
|
124
119
|
grpc_error* error, const char* reason);
|
125
120
|
|
126
|
-
static void incoming_byte_stream_destroy_locked(
|
127
|
-
void* byte_stream,
|
121
|
+
static void incoming_byte_stream_destroy_locked(void* byte_stream,
|
128
122
|
grpc_error* error_ignored);
|
129
123
|
static void incoming_byte_stream_publish_error(
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
static void
|
138
|
-
|
139
|
-
|
140
|
-
static void
|
141
|
-
|
142
|
-
static void
|
143
|
-
|
144
|
-
|
145
|
-
static void
|
146
|
-
|
147
|
-
static void
|
148
|
-
|
149
|
-
|
150
|
-
static void schedule_bdp_ping_locked(grpc_exec_ctx* exec_ctx,
|
151
|
-
grpc_chttp2_transport* t);
|
152
|
-
static void start_bdp_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
|
153
|
-
grpc_error* error);
|
154
|
-
static void finish_bdp_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
|
155
|
-
grpc_error* error);
|
156
|
-
static void next_bdp_ping_timer_expired_locked(grpc_exec_ctx* exec_ctx,
|
157
|
-
void* tp, grpc_error* error);
|
158
|
-
|
159
|
-
static void cancel_pings(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
160
|
-
grpc_error* error);
|
161
|
-
static void send_ping_locked(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
124
|
+
grpc_chttp2_incoming_byte_stream* bs, grpc_error* error);
|
125
|
+
static void incoming_byte_stream_unref(grpc_chttp2_incoming_byte_stream* bs);
|
126
|
+
|
127
|
+
static void benign_reclaimer_locked(void* t, grpc_error* error);
|
128
|
+
static void destructive_reclaimer_locked(void* t, grpc_error* error);
|
129
|
+
|
130
|
+
static void post_benign_reclaimer(grpc_chttp2_transport* t);
|
131
|
+
static void post_destructive_reclaimer(grpc_chttp2_transport* t);
|
132
|
+
|
133
|
+
static void close_transport_locked(grpc_chttp2_transport* t, grpc_error* error);
|
134
|
+
static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error);
|
135
|
+
|
136
|
+
static void schedule_bdp_ping_locked(grpc_chttp2_transport* t);
|
137
|
+
static void start_bdp_ping_locked(void* tp, grpc_error* error);
|
138
|
+
static void finish_bdp_ping_locked(void* tp, grpc_error* error);
|
139
|
+
static void next_bdp_ping_timer_expired_locked(void* tp, grpc_error* error);
|
140
|
+
|
141
|
+
static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error);
|
142
|
+
static void send_ping_locked(grpc_chttp2_transport* t,
|
162
143
|
grpc_closure* on_initiate,
|
163
144
|
grpc_closure* on_complete);
|
164
|
-
static void retry_initiate_ping_locked(
|
165
|
-
grpc_error* error);
|
145
|
+
static void retry_initiate_ping_locked(void* tp, grpc_error* error);
|
166
146
|
|
167
147
|
/** keepalive-relevant functions */
|
168
|
-
static void init_keepalive_ping_locked(
|
169
|
-
|
170
|
-
static void
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
grpc_error* error);
|
148
|
+
static void init_keepalive_ping_locked(void* arg, grpc_error* error);
|
149
|
+
static void start_keepalive_ping_locked(void* arg, grpc_error* error);
|
150
|
+
static void finish_keepalive_ping_locked(void* arg, grpc_error* error);
|
151
|
+
static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error);
|
152
|
+
|
153
|
+
static void reset_byte_stream(void* arg, grpc_error* error);
|
154
|
+
|
155
|
+
// Flow control default enabled. Can be disabled by setting
|
156
|
+
// GRPC_EXPERIMENTAL_DISABLE_FLOW_CONTROL
|
157
|
+
bool g_flow_control_enabled = true;
|
179
158
|
|
180
159
|
/*******************************************************************************
|
181
160
|
* CONSTRUCTION/DESTRUCTION/REFCOUNTING
|
182
161
|
*/
|
183
162
|
|
184
|
-
static void destruct_transport(
|
185
|
-
grpc_chttp2_transport* t) {
|
163
|
+
static void destruct_transport(grpc_chttp2_transport* t) {
|
186
164
|
size_t i;
|
187
165
|
|
188
|
-
grpc_endpoint_destroy(
|
166
|
+
grpc_endpoint_destroy(t->ep);
|
189
167
|
|
190
|
-
grpc_slice_buffer_destroy_internal(
|
168
|
+
grpc_slice_buffer_destroy_internal(&t->qbuf);
|
191
169
|
|
192
|
-
grpc_slice_buffer_destroy_internal(
|
193
|
-
grpc_chttp2_hpack_compressor_destroy(
|
170
|
+
grpc_slice_buffer_destroy_internal(&t->outbuf);
|
171
|
+
grpc_chttp2_hpack_compressor_destroy(&t->hpack_compressor);
|
194
172
|
|
195
|
-
grpc_slice_buffer_destroy_internal(
|
196
|
-
grpc_chttp2_hpack_parser_destroy(
|
173
|
+
grpc_slice_buffer_destroy_internal(&t->read_buffer);
|
174
|
+
grpc_chttp2_hpack_parser_destroy(&t->hpack_parser);
|
197
175
|
grpc_chttp2_goaway_parser_destroy(&t->goaway_parser);
|
198
176
|
|
199
177
|
for (i = 0; i < STREAM_LIST_COUNT; i++) {
|
@@ -206,12 +184,11 @@ static void destruct_transport(grpc_exec_ctx* exec_ctx,
|
|
206
184
|
GPR_ASSERT(grpc_chttp2_stream_map_size(&t->stream_map) == 0);
|
207
185
|
|
208
186
|
grpc_chttp2_stream_map_destroy(&t->stream_map);
|
209
|
-
grpc_connectivity_state_destroy(
|
187
|
+
grpc_connectivity_state_destroy(&t->channel_callback.state_tracker);
|
210
188
|
|
211
|
-
GRPC_COMBINER_UNREF(
|
189
|
+
GRPC_COMBINER_UNREF(t->combiner, "chttp2_transport");
|
212
190
|
|
213
|
-
cancel_pings(
|
214
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"));
|
191
|
+
cancel_pings(t, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"));
|
215
192
|
|
216
193
|
while (t->write_cb_pool) {
|
217
194
|
grpc_chttp2_write_cb* next = t->write_cb_pool->next;
|
@@ -228,8 +205,7 @@ static void destruct_transport(grpc_exec_ctx* exec_ctx,
|
|
228
205
|
}
|
229
206
|
|
230
207
|
#ifndef NDEBUG
|
231
|
-
void grpc_chttp2_unref_transport(
|
232
|
-
grpc_chttp2_transport* t, const char* reason,
|
208
|
+
void grpc_chttp2_unref_transport(grpc_chttp2_transport* t, const char* reason,
|
233
209
|
const char* file, int line) {
|
234
210
|
if (grpc_trace_chttp2_refcount.enabled()) {
|
235
211
|
gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count);
|
@@ -237,7 +213,7 @@ void grpc_chttp2_unref_transport(grpc_exec_ctx* exec_ctx,
|
|
237
213
|
t, val, val - 1, reason, file, line);
|
238
214
|
}
|
239
215
|
if (!gpr_unref(&t->refs)) return;
|
240
|
-
destruct_transport(
|
216
|
+
destruct_transport(t);
|
241
217
|
}
|
242
218
|
|
243
219
|
void grpc_chttp2_ref_transport(grpc_chttp2_transport* t, const char* reason,
|
@@ -250,10 +226,9 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport* t, const char* reason,
|
|
250
226
|
gpr_ref(&t->refs);
|
251
227
|
}
|
252
228
|
#else
|
253
|
-
void grpc_chttp2_unref_transport(
|
254
|
-
grpc_chttp2_transport* t) {
|
229
|
+
void grpc_chttp2_unref_transport(grpc_chttp2_transport* t) {
|
255
230
|
if (!gpr_unref(&t->refs)) return;
|
256
|
-
destruct_transport(
|
231
|
+
destruct_transport(t);
|
257
232
|
}
|
258
233
|
|
259
234
|
void grpc_chttp2_ref_transport(grpc_chttp2_transport* t) { gpr_ref(&t->refs); }
|
@@ -261,7 +236,7 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport* t) { gpr_ref(&t->refs); }
|
|
261
236
|
|
262
237
|
static const grpc_transport_vtable* get_vtable(void);
|
263
238
|
|
264
|
-
static void init_transport(
|
239
|
+
static void init_transport(grpc_chttp2_transport* t,
|
265
240
|
const grpc_channel_args* channel_args,
|
266
241
|
grpc_endpoint* ep, bool is_client) {
|
267
242
|
size_t i;
|
@@ -320,7 +295,7 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
320
295
|
|
321
296
|
t->goaway_error = GRPC_ERROR_NONE;
|
322
297
|
grpc_chttp2_goaway_parser_init(&t->goaway_parser);
|
323
|
-
grpc_chttp2_hpack_parser_init(
|
298
|
+
grpc_chttp2_hpack_parser_init(&t->hpack_parser);
|
324
299
|
|
325
300
|
grpc_slice_buffer_init(&t->read_buffer);
|
326
301
|
|
@@ -351,14 +326,13 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
351
326
|
|
352
327
|
/* configure http2 the way we like it */
|
353
328
|
if (is_client) {
|
354
|
-
queue_setting_update(
|
355
|
-
queue_setting_update(
|
356
|
-
GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0);
|
329
|
+
queue_setting_update(t, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0);
|
330
|
+
queue_setting_update(t, GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0);
|
357
331
|
}
|
358
|
-
queue_setting_update(
|
332
|
+
queue_setting_update(t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE,
|
359
333
|
DEFAULT_MAX_HEADER_LIST_SIZE);
|
360
|
-
queue_setting_update(
|
361
|
-
|
334
|
+
queue_setting_update(t, GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA,
|
335
|
+
1);
|
362
336
|
|
363
337
|
t->ping_policy.max_pings_without_data = g_default_max_pings_without_data;
|
364
338
|
t->ping_policy.min_sent_ping_interval_without_data =
|
@@ -375,6 +349,8 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
375
349
|
t->keepalive_timeout = g_default_client_keepalive_timeout_ms == INT_MAX
|
376
350
|
? GRPC_MILLIS_INF_FUTURE
|
377
351
|
: g_default_client_keepalive_timeout_ms;
|
352
|
+
t->keepalive_permit_without_calls =
|
353
|
+
g_default_client_keepalive_permit_without_calls;
|
378
354
|
} else {
|
379
355
|
t->keepalive_time = g_default_server_keepalive_time_ms == INT_MAX
|
380
356
|
? GRPC_MILLIS_INF_FUTURE
|
@@ -382,8 +358,9 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
382
358
|
t->keepalive_timeout = g_default_server_keepalive_timeout_ms == INT_MAX
|
383
359
|
? GRPC_MILLIS_INF_FUTURE
|
384
360
|
: g_default_server_keepalive_timeout_ms;
|
361
|
+
t->keepalive_permit_without_calls =
|
362
|
+
g_default_server_keepalive_permit_without_calls;
|
385
363
|
}
|
386
|
-
t->keepalive_permit_without_calls = g_default_keepalive_permit_without_calls;
|
387
364
|
|
388
365
|
t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY;
|
389
366
|
|
@@ -533,7 +510,7 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
533
510
|
int value = grpc_channel_arg_get_integer(
|
534
511
|
&channel_args->args[i], settings_map[j].integer_options);
|
535
512
|
if (value >= 0) {
|
536
|
-
queue_setting_update(
|
513
|
+
queue_setting_update(t, settings_map[j].setting_id,
|
537
514
|
(uint32_t)value);
|
538
515
|
}
|
539
516
|
}
|
@@ -544,7 +521,13 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
544
521
|
}
|
545
522
|
}
|
546
523
|
|
547
|
-
|
524
|
+
if (g_flow_control_enabled) {
|
525
|
+
t->flow_control.Init<grpc_core::chttp2::TransportFlowControl>(t,
|
526
|
+
enable_bdp);
|
527
|
+
} else {
|
528
|
+
t->flow_control.Init<grpc_core::chttp2::TransportFlowControlDisabled>(t);
|
529
|
+
enable_bdp = false;
|
530
|
+
}
|
548
531
|
|
549
532
|
/* No pings allowed before receiving a header or data frame. */
|
550
533
|
t->ping_state.pings_before_data_required = 0;
|
@@ -558,8 +541,8 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
558
541
|
if (t->keepalive_time != GRPC_MILLIS_INF_FUTURE) {
|
559
542
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
|
560
543
|
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
|
561
|
-
grpc_timer_init(
|
562
|
-
|
544
|
+
grpc_timer_init(&t->keepalive_ping_timer,
|
545
|
+
grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
|
563
546
|
&t->init_keepalive_ping_locked);
|
564
547
|
} else {
|
565
548
|
/* Use GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED to indicate there are no
|
@@ -569,42 +552,37 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
569
552
|
|
570
553
|
if (enable_bdp) {
|
571
554
|
GRPC_CHTTP2_REF_TRANSPORT(t, "bdp_ping");
|
572
|
-
schedule_bdp_ping_locked(
|
555
|
+
schedule_bdp_ping_locked(t);
|
573
556
|
|
574
|
-
grpc_chttp2_act_on_flowctl_action(
|
575
|
-
|
557
|
+
grpc_chttp2_act_on_flowctl_action(t->flow_control->PeriodicUpdate(), t,
|
558
|
+
nullptr);
|
576
559
|
}
|
577
560
|
|
578
|
-
grpc_chttp2_initiate_write(
|
579
|
-
|
580
|
-
post_benign_reclaimer(exec_ctx, t);
|
561
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_INITIAL_WRITE);
|
562
|
+
post_benign_reclaimer(t);
|
581
563
|
}
|
582
564
|
|
583
|
-
static void destroy_transport_locked(
|
584
|
-
grpc_error* error) {
|
565
|
+
static void destroy_transport_locked(void* tp, grpc_error* error) {
|
585
566
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
|
586
567
|
t->destroying = 1;
|
587
568
|
close_transport_locked(
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "destroy");
|
569
|
+
t, grpc_error_set_int(
|
570
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"),
|
571
|
+
GRPC_ERROR_INT_OCCURRED_DURING_WRITE, t->write_state));
|
572
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "destroy");
|
593
573
|
}
|
594
574
|
|
595
|
-
static void destroy_transport(
|
575
|
+
static void destroy_transport(grpc_transport* gt) {
|
596
576
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
|
597
|
-
GRPC_CLOSURE_SCHED(
|
598
|
-
GRPC_CLOSURE_CREATE(destroy_transport_locked, t,
|
577
|
+
GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(destroy_transport_locked, t,
|
599
578
|
grpc_combiner_scheduler(t->combiner)),
|
600
579
|
GRPC_ERROR_NONE);
|
601
580
|
}
|
602
581
|
|
603
|
-
static void close_transport_locked(
|
604
|
-
grpc_chttp2_transport* t,
|
582
|
+
static void close_transport_locked(grpc_chttp2_transport* t,
|
605
583
|
grpc_error* error) {
|
606
|
-
end_all_the_calls(
|
607
|
-
cancel_pings(
|
584
|
+
end_all_the_calls(t, GRPC_ERROR_REF(error));
|
585
|
+
cancel_pings(t, GRPC_ERROR_REF(error));
|
608
586
|
if (t->closed_with_error == GRPC_ERROR_NONE) {
|
609
587
|
if (!grpc_error_has_clear_grpc_status(error)) {
|
610
588
|
error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS,
|
@@ -622,21 +600,21 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
|
|
622
600
|
}
|
623
601
|
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
624
602
|
t->closed_with_error = GRPC_ERROR_REF(error);
|
625
|
-
connectivity_state_set(
|
626
|
-
|
603
|
+
connectivity_state_set(t, GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error),
|
604
|
+
"close_transport");
|
627
605
|
if (t->ping_state.is_delayed_ping_timer_set) {
|
628
|
-
grpc_timer_cancel(
|
606
|
+
grpc_timer_cancel(&t->ping_state.delayed_ping_timer);
|
629
607
|
}
|
630
608
|
if (t->have_next_bdp_ping_timer) {
|
631
|
-
grpc_timer_cancel(
|
609
|
+
grpc_timer_cancel(&t->next_bdp_ping_timer);
|
632
610
|
}
|
633
611
|
switch (t->keepalive_state) {
|
634
612
|
case GRPC_CHTTP2_KEEPALIVE_STATE_WAITING:
|
635
|
-
grpc_timer_cancel(
|
613
|
+
grpc_timer_cancel(&t->keepalive_ping_timer);
|
636
614
|
break;
|
637
615
|
case GRPC_CHTTP2_KEEPALIVE_STATE_PINGING:
|
638
|
-
grpc_timer_cancel(
|
639
|
-
grpc_timer_cancel(
|
616
|
+
grpc_timer_cancel(&t->keepalive_ping_timer);
|
617
|
+
grpc_timer_cancel(&t->keepalive_watchdog_timer);
|
640
618
|
break;
|
641
619
|
case GRPC_CHTTP2_KEEPALIVE_STATE_DYING:
|
642
620
|
case GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED:
|
@@ -647,14 +625,13 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
|
|
647
625
|
/* flush writable stream list to avoid dangling references */
|
648
626
|
grpc_chttp2_stream* s;
|
649
627
|
while (grpc_chttp2_list_pop_writable_stream(t, &s)) {
|
650
|
-
GRPC_CHTTP2_STREAM_UNREF(
|
628
|
+
GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:close");
|
651
629
|
}
|
652
630
|
GPR_ASSERT(t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE);
|
653
|
-
grpc_endpoint_shutdown(
|
631
|
+
grpc_endpoint_shutdown(t->ep, GRPC_ERROR_REF(error));
|
654
632
|
}
|
655
633
|
if (t->notify_on_receive_settings != nullptr) {
|
656
|
-
GRPC_CLOSURE_SCHED(
|
657
|
-
GRPC_ERROR_CANCELLED);
|
634
|
+
GRPC_CLOSURE_SCHED(t->notify_on_receive_settings, GRPC_ERROR_CANCELLED);
|
658
635
|
t->notify_on_receive_settings = nullptr;
|
659
636
|
}
|
660
637
|
GRPC_ERROR_UNREF(error);
|
@@ -664,22 +641,21 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
|
|
664
641
|
void grpc_chttp2_stream_ref(grpc_chttp2_stream* s, const char* reason) {
|
665
642
|
grpc_stream_ref(s->refcount, reason);
|
666
643
|
}
|
667
|
-
void grpc_chttp2_stream_unref(
|
668
|
-
|
669
|
-
grpc_stream_unref(exec_ctx, s->refcount, reason);
|
644
|
+
void grpc_chttp2_stream_unref(grpc_chttp2_stream* s, const char* reason) {
|
645
|
+
grpc_stream_unref(s->refcount, reason);
|
670
646
|
}
|
671
647
|
#else
|
672
648
|
void grpc_chttp2_stream_ref(grpc_chttp2_stream* s) {
|
673
649
|
grpc_stream_ref(s->refcount);
|
674
650
|
}
|
675
|
-
void grpc_chttp2_stream_unref(
|
676
|
-
grpc_stream_unref(
|
651
|
+
void grpc_chttp2_stream_unref(grpc_chttp2_stream* s) {
|
652
|
+
grpc_stream_unref(s->refcount);
|
677
653
|
}
|
678
654
|
#endif
|
679
655
|
|
680
|
-
static int init_stream(
|
681
|
-
|
682
|
-
|
656
|
+
static int init_stream(grpc_transport* gt, grpc_stream* gs,
|
657
|
+
grpc_stream_refcount* refcount, const void* server_data,
|
658
|
+
gpr_arena* arena) {
|
683
659
|
GPR_TIMER_BEGIN("init_stream", 0);
|
684
660
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
|
685
661
|
grpc_chttp2_stream* s = (grpc_chttp2_stream*)gs;
|
@@ -713,17 +689,23 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
|
|
713
689
|
s->id = (uint32_t)(uintptr_t)server_data;
|
714
690
|
*t->accepting_stream = s;
|
715
691
|
grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
|
716
|
-
post_destructive_reclaimer(
|
692
|
+
post_destructive_reclaimer(t);
|
717
693
|
}
|
718
694
|
|
719
|
-
|
695
|
+
if (t->flow_control->flow_control_enabled()) {
|
696
|
+
s->flow_control.Init<grpc_core::chttp2::StreamFlowControl>(
|
697
|
+
static_cast<grpc_core::chttp2::TransportFlowControl*>(
|
698
|
+
t->flow_control.get()),
|
699
|
+
s);
|
700
|
+
} else {
|
701
|
+
s->flow_control.Init<grpc_core::chttp2::StreamFlowControlDisabled>();
|
702
|
+
}
|
720
703
|
GPR_TIMER_END("init_stream", 0);
|
721
704
|
|
722
705
|
return 0;
|
723
706
|
}
|
724
707
|
|
725
|
-
static void destroy_stream_locked(
|
726
|
-
grpc_error* error) {
|
708
|
+
static void destroy_stream_locked(void* sp, grpc_error* error) {
|
727
709
|
grpc_chttp2_stream* s = (grpc_chttp2_stream*)sp;
|
728
710
|
grpc_chttp2_transport* t = s->t;
|
729
711
|
|
@@ -734,11 +716,10 @@ static void destroy_stream_locked(grpc_exec_ctx* exec_ctx, void* sp,
|
|
734
716
|
GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == nullptr);
|
735
717
|
}
|
736
718
|
|
737
|
-
grpc_slice_buffer_destroy_internal(
|
738
|
-
|
739
|
-
grpc_slice_buffer_destroy_internal(
|
740
|
-
grpc_slice_buffer_destroy_internal(
|
741
|
-
grpc_slice_buffer_destroy_internal(exec_ctx, &s->decompressed_data_buffer);
|
719
|
+
grpc_slice_buffer_destroy_internal(&s->unprocessed_incoming_frames_buffer);
|
720
|
+
grpc_slice_buffer_destroy_internal(&s->frame_storage);
|
721
|
+
grpc_slice_buffer_destroy_internal(&s->compressed_data_buffer);
|
722
|
+
grpc_slice_buffer_destroy_internal(&s->decompressed_data_buffer);
|
742
723
|
|
743
724
|
grpc_chttp2_list_remove_stalled_by_transport(t, s);
|
744
725
|
grpc_chttp2_list_remove_stalled_by_stream(t, s);
|
@@ -757,27 +738,24 @@ static void destroy_stream_locked(grpc_exec_ctx* exec_ctx, void* sp,
|
|
757
738
|
GPR_ASSERT(s->recv_initial_metadata_ready == nullptr);
|
758
739
|
GPR_ASSERT(s->recv_message_ready == nullptr);
|
759
740
|
GPR_ASSERT(s->recv_trailing_metadata_finished == nullptr);
|
760
|
-
grpc_chttp2_data_parser_destroy(
|
761
|
-
grpc_chttp2_incoming_metadata_buffer_destroy(
|
762
|
-
|
763
|
-
|
764
|
-
&s->metadata_buffer[1]);
|
765
|
-
grpc_slice_buffer_destroy_internal(exec_ctx, &s->flow_controlled_buffer);
|
741
|
+
grpc_chttp2_data_parser_destroy(&s->data_parser);
|
742
|
+
grpc_chttp2_incoming_metadata_buffer_destroy(&s->metadata_buffer[0]);
|
743
|
+
grpc_chttp2_incoming_metadata_buffer_destroy(&s->metadata_buffer[1]);
|
744
|
+
grpc_slice_buffer_destroy_internal(&s->flow_controlled_buffer);
|
766
745
|
GRPC_ERROR_UNREF(s->read_closed_error);
|
767
746
|
GRPC_ERROR_UNREF(s->write_closed_error);
|
768
747
|
GRPC_ERROR_UNREF(s->byte_stream_error);
|
769
748
|
|
770
749
|
s->flow_control.Destroy();
|
771
750
|
|
772
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
751
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "stream");
|
773
752
|
|
774
753
|
GPR_TIMER_END("destroy_stream", 0);
|
775
754
|
|
776
|
-
GRPC_CLOSURE_SCHED(
|
755
|
+
GRPC_CLOSURE_SCHED(s->destroy_stream_arg, GRPC_ERROR_NONE);
|
777
756
|
}
|
778
757
|
|
779
|
-
static void destroy_stream(
|
780
|
-
grpc_stream* gs,
|
758
|
+
static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
|
781
759
|
grpc_closure* then_schedule_closure) {
|
782
760
|
GPR_TIMER_BEGIN("destroy_stream", 0);
|
783
761
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
|
@@ -794,7 +772,6 @@ static void destroy_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
|
|
794
772
|
|
795
773
|
s->destroy_stream_arg = then_schedule_closure;
|
796
774
|
GRPC_CLOSURE_SCHED(
|
797
|
-
exec_ctx,
|
798
775
|
GRPC_CLOSURE_INIT(&s->destroy_stream, destroy_stream_locked, s,
|
799
776
|
grpc_combiner_scheduler(t->combiner)),
|
800
777
|
GRPC_ERROR_NONE);
|
@@ -806,8 +783,7 @@ grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t,
|
|
806
783
|
return (grpc_chttp2_stream*)grpc_chttp2_stream_map_find(&t->stream_map, id);
|
807
784
|
}
|
808
785
|
|
809
|
-
grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(
|
810
|
-
grpc_chttp2_transport* t,
|
786
|
+
grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
|
811
787
|
uint32_t id) {
|
812
788
|
if (t->channel_callback.accept_stream == nullptr) {
|
813
789
|
return nullptr;
|
@@ -815,8 +791,7 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_exec_ctx* exec_ctx,
|
|
815
791
|
grpc_chttp2_stream* accepting;
|
816
792
|
GPR_ASSERT(t->accepting_stream == nullptr);
|
817
793
|
t->accepting_stream = &accepting;
|
818
|
-
t->channel_callback.accept_stream(
|
819
|
-
t->channel_callback.accept_stream_user_data,
|
794
|
+
t->channel_callback.accept_stream(t->channel_callback.accept_stream_user_data,
|
820
795
|
&t->base, (void*)(uintptr_t)id);
|
821
796
|
t->accepting_stream = nullptr;
|
822
797
|
return accepting;
|
@@ -838,7 +813,7 @@ static const char* write_state_name(grpc_chttp2_write_state st) {
|
|
838
813
|
GPR_UNREACHABLE_CODE(return "UNKNOWN");
|
839
814
|
}
|
840
815
|
|
841
|
-
static void set_write_state(
|
816
|
+
static void set_write_state(grpc_chttp2_transport* t,
|
842
817
|
grpc_chttp2_write_state st, const char* reason) {
|
843
818
|
GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_DEBUG, "W:%p %s state %s -> %s [%s]", t,
|
844
819
|
t->is_client ? "CLIENT" : "SERVER",
|
@@ -846,108 +821,100 @@ static void set_write_state(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
846
821
|
write_state_name(st), reason));
|
847
822
|
t->write_state = st;
|
848
823
|
if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
849
|
-
GRPC_CLOSURE_LIST_SCHED(
|
824
|
+
GRPC_CLOSURE_LIST_SCHED(&t->run_after_write);
|
850
825
|
if (t->close_transport_on_writes_finished != nullptr) {
|
851
826
|
grpc_error* err = t->close_transport_on_writes_finished;
|
852
827
|
t->close_transport_on_writes_finished = nullptr;
|
853
|
-
close_transport_locked(
|
828
|
+
close_transport_locked(t, err);
|
854
829
|
}
|
855
830
|
}
|
856
831
|
}
|
857
832
|
|
858
833
|
static void inc_initiate_write_reason(
|
859
|
-
|
834
|
+
grpc_chttp2_initiate_write_reason reason) {
|
860
835
|
switch (reason) {
|
861
836
|
case GRPC_CHTTP2_INITIATE_WRITE_INITIAL_WRITE:
|
862
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_INITIAL_WRITE(
|
837
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_INITIAL_WRITE();
|
863
838
|
break;
|
864
839
|
case GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM:
|
865
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_START_NEW_STREAM(
|
840
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_START_NEW_STREAM();
|
866
841
|
break;
|
867
842
|
case GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE:
|
868
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_MESSAGE(
|
843
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_MESSAGE();
|
869
844
|
break;
|
870
845
|
case GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA:
|
871
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_INITIAL_METADATA(
|
872
|
-
exec_ctx);
|
846
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_INITIAL_METADATA();
|
873
847
|
break;
|
874
848
|
case GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA:
|
875
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_TRAILING_METADATA(
|
876
|
-
exec_ctx);
|
849
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_TRAILING_METADATA();
|
877
850
|
break;
|
878
851
|
case GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING:
|
879
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RETRY_SEND_PING(
|
852
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RETRY_SEND_PING();
|
880
853
|
break;
|
881
854
|
case GRPC_CHTTP2_INITIATE_WRITE_CONTINUE_PINGS:
|
882
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CONTINUE_PINGS(
|
855
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CONTINUE_PINGS();
|
883
856
|
break;
|
884
857
|
case GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT:
|
885
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_GOAWAY_SENT(
|
858
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_GOAWAY_SENT();
|
886
859
|
break;
|
887
860
|
case GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM:
|
888
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RST_STREAM(
|
861
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RST_STREAM();
|
889
862
|
break;
|
890
863
|
case GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API:
|
891
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CLOSE_FROM_API(
|
864
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CLOSE_FROM_API();
|
892
865
|
break;
|
893
866
|
case GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL:
|
894
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_STREAM_FLOW_CONTROL(
|
867
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_STREAM_FLOW_CONTROL();
|
895
868
|
break;
|
896
869
|
case GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL:
|
897
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL(
|
898
|
-
exec_ctx);
|
870
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL();
|
899
871
|
break;
|
900
872
|
case GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS:
|
901
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_SETTINGS(
|
873
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_SETTINGS();
|
902
874
|
break;
|
903
875
|
case GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_SETTING:
|
904
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_SETTING(
|
905
|
-
exec_ctx);
|
876
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_SETTING();
|
906
877
|
break;
|
907
878
|
case GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_UPDATE:
|
908
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_UPDATE(
|
909
|
-
exec_ctx);
|
879
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_UPDATE();
|
910
880
|
break;
|
911
881
|
case GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING:
|
912
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_APPLICATION_PING(
|
882
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_APPLICATION_PING();
|
913
883
|
break;
|
914
884
|
case GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING:
|
915
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_KEEPALIVE_PING(
|
885
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_KEEPALIVE_PING();
|
916
886
|
break;
|
917
887
|
case GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL_UNSTALLED:
|
918
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL_UNSTALLED(
|
919
|
-
exec_ctx);
|
888
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL_UNSTALLED();
|
920
889
|
break;
|
921
890
|
case GRPC_CHTTP2_INITIATE_WRITE_PING_RESPONSE:
|
922
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_PING_RESPONSE(
|
891
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_PING_RESPONSE();
|
923
892
|
break;
|
924
893
|
case GRPC_CHTTP2_INITIATE_WRITE_FORCE_RST_STREAM:
|
925
|
-
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FORCE_RST_STREAM(
|
894
|
+
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FORCE_RST_STREAM();
|
926
895
|
break;
|
927
896
|
}
|
928
897
|
}
|
929
898
|
|
930
|
-
void grpc_chttp2_initiate_write(
|
931
|
-
grpc_chttp2_transport* t,
|
899
|
+
void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
|
932
900
|
grpc_chttp2_initiate_write_reason reason) {
|
933
901
|
GPR_TIMER_BEGIN("grpc_chttp2_initiate_write", 0);
|
934
902
|
|
935
903
|
switch (t->write_state) {
|
936
904
|
case GRPC_CHTTP2_WRITE_STATE_IDLE:
|
937
|
-
inc_initiate_write_reason(
|
938
|
-
set_write_state(
|
905
|
+
inc_initiate_write_reason(reason);
|
906
|
+
set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING,
|
939
907
|
grpc_chttp2_initiate_write_reason_string(reason));
|
940
908
|
t->is_first_write_in_batch = true;
|
941
909
|
GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
|
942
910
|
GRPC_CLOSURE_SCHED(
|
943
|
-
exec_ctx,
|
944
911
|
GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
|
945
912
|
write_action_begin_locked, t,
|
946
913
|
grpc_combiner_finally_scheduler(t->combiner)),
|
947
914
|
GRPC_ERROR_NONE);
|
948
915
|
break;
|
949
916
|
case GRPC_CHTTP2_WRITE_STATE_WRITING:
|
950
|
-
set_write_state(
|
917
|
+
set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE,
|
951
918
|
grpc_chttp2_initiate_write_reason_string(reason));
|
952
919
|
break;
|
953
920
|
case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE:
|
@@ -956,8 +923,7 @@ void grpc_chttp2_initiate_write(grpc_exec_ctx* exec_ctx,
|
|
956
923
|
GPR_TIMER_END("grpc_chttp2_initiate_write", 0);
|
957
924
|
}
|
958
925
|
|
959
|
-
void grpc_chttp2_mark_stream_writable(
|
960
|
-
grpc_chttp2_transport* t,
|
926
|
+
void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
|
961
927
|
grpc_chttp2_stream* s) {
|
962
928
|
if (t->closed_with_error == GRPC_ERROR_NONE &&
|
963
929
|
grpc_chttp2_list_add_writable_stream(t, s)) {
|
@@ -1007,8 +973,7 @@ static const char* begin_writing_desc(bool partial, bool inlined) {
|
|
1007
973
|
GPR_UNREACHABLE_CODE(return "bad state tuple");
|
1008
974
|
}
|
1009
975
|
|
1010
|
-
static void write_action_begin_locked(
|
1011
|
-
grpc_error* error_ignored) {
|
976
|
+
static void write_action_begin_locked(void* gt, grpc_error* error_ignored) {
|
1012
977
|
GPR_TIMER_BEGIN("write_action_begin_locked", 0);
|
1013
978
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
|
1014
979
|
GPR_ASSERT(t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE);
|
@@ -1016,62 +981,59 @@ static void write_action_begin_locked(grpc_exec_ctx* exec_ctx, void* gt,
|
|
1016
981
|
if (t->closed_with_error != GRPC_ERROR_NONE) {
|
1017
982
|
r.writing = false;
|
1018
983
|
} else {
|
1019
|
-
r = grpc_chttp2_begin_write(
|
984
|
+
r = grpc_chttp2_begin_write(t);
|
1020
985
|
}
|
1021
986
|
if (r.writing) {
|
1022
987
|
if (r.partial) {
|
1023
|
-
GRPC_STATS_INC_HTTP2_PARTIAL_WRITES(
|
988
|
+
GRPC_STATS_INC_HTTP2_PARTIAL_WRITES();
|
1024
989
|
}
|
1025
990
|
if (!t->is_first_write_in_batch) {
|
1026
|
-
GRPC_STATS_INC_HTTP2_WRITES_CONTINUED(
|
991
|
+
GRPC_STATS_INC_HTTP2_WRITES_CONTINUED();
|
1027
992
|
}
|
1028
993
|
grpc_closure_scheduler* scheduler =
|
1029
994
|
write_scheduler(t, r.early_results_scheduled, r.partial);
|
1030
995
|
if (scheduler != grpc_schedule_on_exec_ctx) {
|
1031
|
-
GRPC_STATS_INC_HTTP2_WRITES_OFFLOADED(
|
996
|
+
GRPC_STATS_INC_HTTP2_WRITES_OFFLOADED();
|
1032
997
|
}
|
1033
998
|
set_write_state(
|
1034
|
-
|
999
|
+
t,
|
1035
1000
|
r.partial ? GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE
|
1036
1001
|
: GRPC_CHTTP2_WRITE_STATE_WRITING,
|
1037
1002
|
begin_writing_desc(r.partial, scheduler == grpc_schedule_on_exec_ctx));
|
1038
1003
|
GRPC_CLOSURE_SCHED(
|
1039
|
-
exec_ctx,
|
1040
1004
|
GRPC_CLOSURE_INIT(&t->write_action, write_action, t, scheduler),
|
1041
1005
|
GRPC_ERROR_NONE);
|
1042
1006
|
} else {
|
1043
|
-
GRPC_STATS_INC_HTTP2_SPURIOUS_WRITES_BEGUN(
|
1044
|
-
set_write_state(
|
1045
|
-
|
1046
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "writing");
|
1007
|
+
GRPC_STATS_INC_HTTP2_SPURIOUS_WRITES_BEGUN();
|
1008
|
+
set_write_state(t, GRPC_CHTTP2_WRITE_STATE_IDLE, "begin writing nothing");
|
1009
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing");
|
1047
1010
|
}
|
1048
1011
|
GPR_TIMER_END("write_action_begin_locked", 0);
|
1049
1012
|
}
|
1050
1013
|
|
1051
|
-
static void write_action(
|
1014
|
+
static void write_action(void* gt, grpc_error* error) {
|
1052
1015
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
|
1053
1016
|
GPR_TIMER_BEGIN("write_action", 0);
|
1054
1017
|
grpc_endpoint_write(
|
1055
|
-
|
1018
|
+
t->ep, &t->outbuf,
|
1056
1019
|
GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end_locked, t,
|
1057
1020
|
grpc_combiner_scheduler(t->combiner)));
|
1058
1021
|
GPR_TIMER_END("write_action", 0);
|
1059
1022
|
}
|
1060
1023
|
|
1061
|
-
static void write_action_end_locked(
|
1062
|
-
grpc_error* error) {
|
1024
|
+
static void write_action_end_locked(void* tp, grpc_error* error) {
|
1063
1025
|
GPR_TIMER_BEGIN("terminate_writing_with_lock", 0);
|
1064
1026
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
|
1065
1027
|
|
1066
1028
|
if (error != GRPC_ERROR_NONE) {
|
1067
|
-
close_transport_locked(
|
1029
|
+
close_transport_locked(t, GRPC_ERROR_REF(error));
|
1068
1030
|
}
|
1069
1031
|
|
1070
1032
|
if (t->sent_goaway_state == GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED) {
|
1071
1033
|
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SENT;
|
1072
1034
|
if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
1073
1035
|
close_transport_locked(
|
1074
|
-
|
1036
|
+
t, GRPC_ERROR_CREATE_FROM_STATIC_STRING("goaway sent"));
|
1075
1037
|
}
|
1076
1038
|
}
|
1077
1039
|
|
@@ -1080,17 +1042,14 @@ static void write_action_end_locked(grpc_exec_ctx* exec_ctx, void* tp,
|
|
1080
1042
|
GPR_UNREACHABLE_CODE(break);
|
1081
1043
|
case GRPC_CHTTP2_WRITE_STATE_WRITING:
|
1082
1044
|
GPR_TIMER_MARK("state=writing", 0);
|
1083
|
-
set_write_state(
|
1084
|
-
"finish writing");
|
1045
|
+
set_write_state(t, GRPC_CHTTP2_WRITE_STATE_IDLE, "finish writing");
|
1085
1046
|
break;
|
1086
1047
|
case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE:
|
1087
1048
|
GPR_TIMER_MARK("state=writing_stale_no_poller", 0);
|
1088
|
-
set_write_state(
|
1089
|
-
"continue writing");
|
1049
|
+
set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING, "continue writing");
|
1090
1050
|
t->is_first_write_in_batch = false;
|
1091
1051
|
GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
|
1092
1052
|
GRPC_CLOSURE_RUN(
|
1093
|
-
exec_ctx,
|
1094
1053
|
GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
|
1095
1054
|
write_action_begin_locked, t,
|
1096
1055
|
grpc_combiner_finally_scheduler(t->combiner)),
|
@@ -1098,16 +1057,15 @@ static void write_action_end_locked(grpc_exec_ctx* exec_ctx, void* tp,
|
|
1098
1057
|
break;
|
1099
1058
|
}
|
1100
1059
|
|
1101
|
-
grpc_chttp2_end_write(
|
1060
|
+
grpc_chttp2_end_write(t, GRPC_ERROR_REF(error));
|
1102
1061
|
|
1103
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
1062
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing");
|
1104
1063
|
GPR_TIMER_END("terminate_writing_with_lock", 0);
|
1105
1064
|
}
|
1106
1065
|
|
1107
1066
|
// Dirties an HTTP2 setting to be sent out next time a writing path occurs.
|
1108
1067
|
// If the change needs to occur immediately, manually initiate a write.
|
1109
|
-
static void queue_setting_update(
|
1110
|
-
grpc_chttp2_transport* t,
|
1068
|
+
static void queue_setting_update(grpc_chttp2_transport* t,
|
1111
1069
|
grpc_chttp2_setting_id id, uint32_t value) {
|
1112
1070
|
const grpc_chttp2_setting_parameters* sp =
|
1113
1071
|
&grpc_chttp2_settings_parameters[id];
|
@@ -1122,8 +1080,7 @@ static void queue_setting_update(grpc_exec_ctx* exec_ctx,
|
|
1122
1080
|
}
|
1123
1081
|
}
|
1124
1082
|
|
1125
|
-
void grpc_chttp2_add_incoming_goaway(
|
1126
|
-
grpc_chttp2_transport* t,
|
1083
|
+
void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
1127
1084
|
uint32_t goaway_error,
|
1128
1085
|
grpc_slice goaway_text) {
|
1129
1086
|
// GRPC_CHTTP2_IF_TRACING(
|
@@ -1158,12 +1115,11 @@ void grpc_chttp2_add_incoming_goaway(grpc_exec_ctx* exec_ctx,
|
|
1158
1115
|
|
1159
1116
|
/* lie: use transient failure from the transport to indicate goaway has been
|
1160
1117
|
* received */
|
1161
|
-
connectivity_state_set(
|
1118
|
+
connectivity_state_set(t, GRPC_CHANNEL_TRANSIENT_FAILURE,
|
1162
1119
|
GRPC_ERROR_REF(t->goaway_error), "got_goaway");
|
1163
1120
|
}
|
1164
1121
|
|
1165
|
-
static void maybe_start_some_streams(
|
1166
|
-
grpc_chttp2_transport* t) {
|
1122
|
+
static void maybe_start_some_streams(grpc_chttp2_transport* t) {
|
1167
1123
|
grpc_chttp2_stream* s;
|
1168
1124
|
/* start streams where we have free grpc_chttp2_stream ids and free
|
1169
1125
|
* concurrency */
|
@@ -1183,22 +1139,21 @@ static void maybe_start_some_streams(grpc_exec_ctx* exec_ctx,
|
|
1183
1139
|
|
1184
1140
|
if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) {
|
1185
1141
|
connectivity_state_set(
|
1186
|
-
|
1142
|
+
t, GRPC_CHANNEL_TRANSIENT_FAILURE,
|
1187
1143
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
|
1188
1144
|
"no_more_stream_ids");
|
1189
1145
|
}
|
1190
1146
|
|
1191
1147
|
grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
|
1192
|
-
post_destructive_reclaimer(
|
1193
|
-
grpc_chttp2_mark_stream_writable(
|
1194
|
-
grpc_chttp2_initiate_write(
|
1195
|
-
GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM);
|
1148
|
+
post_destructive_reclaimer(t);
|
1149
|
+
grpc_chttp2_mark_stream_writable(t, s);
|
1150
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM);
|
1196
1151
|
}
|
1197
1152
|
/* cancel out streams that will never be started */
|
1198
1153
|
while (t->next_stream_id >= MAX_CLIENT_STREAM_ID &&
|
1199
1154
|
grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
|
1200
1155
|
grpc_chttp2_cancel_stream(
|
1201
|
-
|
1156
|
+
t, s,
|
1202
1157
|
grpc_error_set_int(
|
1203
1158
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
|
1204
1159
|
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
|
@@ -1220,15 +1175,13 @@ static grpc_closure* add_closure_barrier(grpc_closure* closure) {
|
|
1220
1175
|
return closure;
|
1221
1176
|
}
|
1222
1177
|
|
1223
|
-
static void null_then_run_closure(
|
1224
|
-
grpc_closure** closure, grpc_error* error) {
|
1178
|
+
static void null_then_run_closure(grpc_closure** closure, grpc_error* error) {
|
1225
1179
|
grpc_closure* c = *closure;
|
1226
1180
|
*closure = nullptr;
|
1227
|
-
GRPC_CLOSURE_RUN(
|
1181
|
+
GRPC_CLOSURE_RUN(c, error);
|
1228
1182
|
}
|
1229
1183
|
|
1230
|
-
void grpc_chttp2_complete_closure_step(
|
1231
|
-
grpc_chttp2_transport* t,
|
1184
|
+
void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
1232
1185
|
grpc_chttp2_stream* s,
|
1233
1186
|
grpc_closure** pclosure,
|
1234
1187
|
grpc_error* error, const char* desc) {
|
@@ -1268,7 +1221,7 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx* exec_ctx,
|
|
1268
1221
|
}
|
1269
1222
|
if ((t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE) ||
|
1270
1223
|
!(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) {
|
1271
|
-
GRPC_CLOSURE_RUN(
|
1224
|
+
GRPC_CLOSURE_RUN(closure, closure->error_data.error);
|
1272
1225
|
} else {
|
1273
1226
|
grpc_closure_list_append(&t->run_after_write, closure,
|
1274
1227
|
closure->error_data.error);
|
@@ -1284,28 +1237,24 @@ static bool contains_non_ok_status(grpc_metadata_batch* batch) {
|
|
1284
1237
|
return false;
|
1285
1238
|
}
|
1286
1239
|
|
1287
|
-
static void maybe_become_writable_due_to_send_msg(
|
1288
|
-
grpc_chttp2_transport* t,
|
1240
|
+
static void maybe_become_writable_due_to_send_msg(grpc_chttp2_transport* t,
|
1289
1241
|
grpc_chttp2_stream* s) {
|
1290
1242
|
if (s->id != 0 && (!s->write_buffering ||
|
1291
1243
|
s->flow_controlled_buffer.length > t->write_buffer_size)) {
|
1292
|
-
grpc_chttp2_mark_stream_writable(
|
1293
|
-
grpc_chttp2_initiate_write(
|
1294
|
-
GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE);
|
1244
|
+
grpc_chttp2_mark_stream_writable(t, s);
|
1245
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE);
|
1295
1246
|
}
|
1296
1247
|
}
|
1297
1248
|
|
1298
|
-
static void add_fetched_slice_locked(
|
1299
|
-
grpc_chttp2_transport* t,
|
1249
|
+
static void add_fetched_slice_locked(grpc_chttp2_transport* t,
|
1300
1250
|
grpc_chttp2_stream* s) {
|
1301
1251
|
s->fetched_send_message_length +=
|
1302
1252
|
(uint32_t)GRPC_SLICE_LENGTH(s->fetching_slice);
|
1303
1253
|
grpc_slice_buffer_add(&s->flow_controlled_buffer, s->fetching_slice);
|
1304
|
-
maybe_become_writable_due_to_send_msg(
|
1254
|
+
maybe_become_writable_due_to_send_msg(t, s);
|
1305
1255
|
}
|
1306
1256
|
|
1307
|
-
static void continue_fetching_send_locked(
|
1308
|
-
grpc_chttp2_transport* t,
|
1257
|
+
static void continue_fetching_send_locked(grpc_chttp2_transport* t,
|
1309
1258
|
grpc_chttp2_stream* s) {
|
1310
1259
|
for (;;) {
|
1311
1260
|
if (s->fetching_send_message == nullptr) {
|
@@ -1314,11 +1263,11 @@ static void continue_fetching_send_locked(grpc_exec_ctx* exec_ctx,
|
|
1314
1263
|
return; /* early out */
|
1315
1264
|
}
|
1316
1265
|
if (s->fetched_send_message_length == s->fetching_send_message->length) {
|
1317
|
-
grpc_byte_stream_destroy(
|
1266
|
+
grpc_byte_stream_destroy(s->fetching_send_message);
|
1318
1267
|
int64_t notify_offset = s->next_message_end_offset;
|
1319
1268
|
if (notify_offset <= s->flow_controlled_bytes_written) {
|
1320
1269
|
grpc_chttp2_complete_closure_step(
|
1321
|
-
|
1270
|
+
t, s, &s->fetching_send_message_finished, GRPC_ERROR_NONE,
|
1322
1271
|
"fetching_send_message_finished");
|
1323
1272
|
} else {
|
1324
1273
|
grpc_chttp2_write_cb* cb = t->write_cb_pool;
|
@@ -1339,39 +1288,37 @@ static void continue_fetching_send_locked(grpc_exec_ctx* exec_ctx,
|
|
1339
1288
|
}
|
1340
1289
|
s->fetching_send_message = nullptr;
|
1341
1290
|
return; /* early out */
|
1342
|
-
} else if (grpc_byte_stream_next(
|
1343
|
-
|
1344
|
-
grpc_error* error =
|
1345
|
-
|
1291
|
+
} else if (grpc_byte_stream_next(s->fetching_send_message, UINT32_MAX,
|
1292
|
+
&s->complete_fetch_locked)) {
|
1293
|
+
grpc_error* error =
|
1294
|
+
grpc_byte_stream_pull(s->fetching_send_message, &s->fetching_slice);
|
1346
1295
|
if (error != GRPC_ERROR_NONE) {
|
1347
|
-
grpc_byte_stream_destroy(
|
1348
|
-
grpc_chttp2_cancel_stream(
|
1296
|
+
grpc_byte_stream_destroy(s->fetching_send_message);
|
1297
|
+
grpc_chttp2_cancel_stream(t, s, error);
|
1349
1298
|
} else {
|
1350
|
-
add_fetched_slice_locked(
|
1299
|
+
add_fetched_slice_locked(t, s);
|
1351
1300
|
}
|
1352
1301
|
}
|
1353
1302
|
}
|
1354
1303
|
}
|
1355
1304
|
|
1356
|
-
static void complete_fetch_locked(
|
1357
|
-
grpc_error* error) {
|
1305
|
+
static void complete_fetch_locked(void* gs, grpc_error* error) {
|
1358
1306
|
grpc_chttp2_stream* s = (grpc_chttp2_stream*)gs;
|
1359
1307
|
grpc_chttp2_transport* t = s->t;
|
1360
1308
|
if (error == GRPC_ERROR_NONE) {
|
1361
|
-
error = grpc_byte_stream_pull(
|
1362
|
-
&s->fetching_slice);
|
1309
|
+
error = grpc_byte_stream_pull(s->fetching_send_message, &s->fetching_slice);
|
1363
1310
|
if (error == GRPC_ERROR_NONE) {
|
1364
|
-
add_fetched_slice_locked(
|
1365
|
-
continue_fetching_send_locked(
|
1311
|
+
add_fetched_slice_locked(t, s);
|
1312
|
+
continue_fetching_send_locked(t, s);
|
1366
1313
|
}
|
1367
1314
|
}
|
1368
1315
|
if (error != GRPC_ERROR_NONE) {
|
1369
|
-
grpc_byte_stream_destroy(
|
1370
|
-
grpc_chttp2_cancel_stream(
|
1316
|
+
grpc_byte_stream_destroy(s->fetching_send_message);
|
1317
|
+
grpc_chttp2_cancel_stream(t, s, error);
|
1371
1318
|
}
|
1372
1319
|
}
|
1373
1320
|
|
1374
|
-
static void do_nothing(
|
1321
|
+
static void do_nothing(void* arg, grpc_error* error) {}
|
1375
1322
|
|
1376
1323
|
static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
|
1377
1324
|
bool is_client, bool is_initial) {
|
@@ -1386,7 +1333,7 @@ static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
|
|
1386
1333
|
}
|
1387
1334
|
}
|
1388
1335
|
|
1389
|
-
static void perform_stream_op_locked(
|
1336
|
+
static void perform_stream_op_locked(void* stream_op,
|
1390
1337
|
grpc_error* error_ignored) {
|
1391
1338
|
GPR_TIMER_BEGIN("perform_stream_op_locked", 0);
|
1392
1339
|
|
@@ -1396,7 +1343,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1396
1343
|
grpc_transport_stream_op_batch_payload* op_payload = op->payload;
|
1397
1344
|
grpc_chttp2_transport* t = s->t;
|
1398
1345
|
|
1399
|
-
GRPC_STATS_INC_HTTP2_OP_BATCHES(
|
1346
|
+
GRPC_STATS_INC_HTTP2_OP_BATCHES();
|
1400
1347
|
|
1401
1348
|
if (grpc_http_trace.enabled()) {
|
1402
1349
|
char* str = grpc_transport_stream_op_batch_string(op);
|
@@ -1431,13 +1378,12 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1431
1378
|
}
|
1432
1379
|
|
1433
1380
|
if (op->cancel_stream) {
|
1434
|
-
GRPC_STATS_INC_HTTP2_OP_CANCEL(
|
1435
|
-
grpc_chttp2_cancel_stream(
|
1436
|
-
op_payload->cancel_stream.cancel_error);
|
1381
|
+
GRPC_STATS_INC_HTTP2_OP_CANCEL();
|
1382
|
+
grpc_chttp2_cancel_stream(t, s, op_payload->cancel_stream.cancel_error);
|
1437
1383
|
}
|
1438
1384
|
|
1439
1385
|
if (op->send_initial_metadata) {
|
1440
|
-
GRPC_STATS_INC_HTTP2_OP_SEND_INITIAL_METADATA(
|
1386
|
+
GRPC_STATS_INC_HTTP2_OP_SEND_INITIAL_METADATA();
|
1441
1387
|
GPR_ASSERT(s->send_initial_metadata_finished == nullptr);
|
1442
1388
|
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
|
1443
1389
|
|
@@ -1465,7 +1411,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1465
1411
|
}
|
1466
1412
|
if (metadata_size > metadata_peer_limit) {
|
1467
1413
|
grpc_chttp2_cancel_stream(
|
1468
|
-
|
1414
|
+
t, s,
|
1469
1415
|
grpc_error_set_int(
|
1470
1416
|
grpc_error_set_int(
|
1471
1417
|
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
@@ -1484,10 +1430,10 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1484
1430
|
if (t->closed_with_error == GRPC_ERROR_NONE) {
|
1485
1431
|
GPR_ASSERT(s->id == 0);
|
1486
1432
|
grpc_chttp2_list_add_waiting_for_concurrency(t, s);
|
1487
|
-
maybe_start_some_streams(
|
1433
|
+
maybe_start_some_streams(t);
|
1488
1434
|
} else {
|
1489
1435
|
grpc_chttp2_cancel_stream(
|
1490
|
-
|
1436
|
+
t, s,
|
1491
1437
|
grpc_error_set_int(
|
1492
1438
|
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
1493
1439
|
"Transport closed", &t->closed_with_error, 1),
|
@@ -1495,18 +1441,18 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1495
1441
|
}
|
1496
1442
|
} else {
|
1497
1443
|
GPR_ASSERT(s->id != 0);
|
1498
|
-
grpc_chttp2_mark_stream_writable(
|
1444
|
+
grpc_chttp2_mark_stream_writable(t, s);
|
1499
1445
|
if (!(op->send_message &&
|
1500
1446
|
(op->payload->send_message.send_message->flags &
|
1501
1447
|
GRPC_WRITE_BUFFER_HINT))) {
|
1502
1448
|
grpc_chttp2_initiate_write(
|
1503
|
-
|
1449
|
+
t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA);
|
1504
1450
|
}
|
1505
1451
|
}
|
1506
1452
|
} else {
|
1507
1453
|
s->send_initial_metadata = nullptr;
|
1508
1454
|
grpc_chttp2_complete_closure_step(
|
1509
|
-
|
1455
|
+
t, s, &s->send_initial_metadata_finished,
|
1510
1456
|
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
1511
1457
|
"Attempt to send initial metadata after stream was closed",
|
1512
1458
|
&s->write_closed_error, 1),
|
@@ -1520,9 +1466,9 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1520
1466
|
}
|
1521
1467
|
|
1522
1468
|
if (op->send_message) {
|
1523
|
-
GRPC_STATS_INC_HTTP2_OP_SEND_MESSAGE(
|
1469
|
+
GRPC_STATS_INC_HTTP2_OP_SEND_MESSAGE();
|
1524
1470
|
GRPC_STATS_INC_HTTP2_SEND_MESSAGE_SIZE(
|
1525
|
-
|
1471
|
+
op->payload->send_message.send_message->length);
|
1526
1472
|
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
|
1527
1473
|
s->fetching_send_message_finished = add_closure_barrier(op->on_complete);
|
1528
1474
|
if (s->write_closed) {
|
@@ -1532,7 +1478,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1532
1478
|
// recv_message failure, breaking out of its loop, and then
|
1533
1479
|
// starting recv_trailing_metadata.
|
1534
1480
|
grpc_chttp2_complete_closure_step(
|
1535
|
-
|
1481
|
+
t, s, &s->fetching_send_message_finished,
|
1536
1482
|
t->is_client && s->received_trailing_metadata
|
1537
1483
|
? GRPC_ERROR_NONE
|
1538
1484
|
: GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
@@ -1561,13 +1507,13 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1561
1507
|
} else {
|
1562
1508
|
s->write_buffering = false;
|
1563
1509
|
}
|
1564
|
-
continue_fetching_send_locked(
|
1565
|
-
maybe_become_writable_due_to_send_msg(
|
1510
|
+
continue_fetching_send_locked(t, s);
|
1511
|
+
maybe_become_writable_due_to_send_msg(t, s);
|
1566
1512
|
}
|
1567
1513
|
}
|
1568
1514
|
|
1569
1515
|
if (op->send_trailing_metadata) {
|
1570
|
-
GRPC_STATS_INC_HTTP2_OP_SEND_TRAILING_METADATA(
|
1516
|
+
GRPC_STATS_INC_HTTP2_OP_SEND_TRAILING_METADATA();
|
1571
1517
|
GPR_ASSERT(s->send_trailing_metadata_finished == nullptr);
|
1572
1518
|
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
|
1573
1519
|
s->send_trailing_metadata_finished = add_closure_barrier(on_complete);
|
@@ -1581,7 +1527,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1581
1527
|
[GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE];
|
1582
1528
|
if (metadata_size > metadata_peer_limit) {
|
1583
1529
|
grpc_chttp2_cancel_stream(
|
1584
|
-
|
1530
|
+
t, s,
|
1585
1531
|
grpc_error_set_int(
|
1586
1532
|
grpc_error_set_int(
|
1587
1533
|
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
@@ -1598,7 +1544,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1598
1544
|
if (s->write_closed) {
|
1599
1545
|
s->send_trailing_metadata = nullptr;
|
1600
1546
|
grpc_chttp2_complete_closure_step(
|
1601
|
-
|
1547
|
+
t, s, &s->send_trailing_metadata_finished,
|
1602
1548
|
grpc_metadata_batch_is_empty(
|
1603
1549
|
op->payload->send_trailing_metadata.send_trailing_metadata)
|
1604
1550
|
? GRPC_ERROR_NONE
|
@@ -1609,15 +1555,15 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1609
1555
|
} else if (s->id != 0) {
|
1610
1556
|
/* TODO(ctiller): check if there's flow control for any outstanding
|
1611
1557
|
bytes before going writable */
|
1612
|
-
grpc_chttp2_mark_stream_writable(
|
1558
|
+
grpc_chttp2_mark_stream_writable(t, s);
|
1613
1559
|
grpc_chttp2_initiate_write(
|
1614
|
-
|
1560
|
+
t, GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA);
|
1615
1561
|
}
|
1616
1562
|
}
|
1617
1563
|
}
|
1618
1564
|
|
1619
1565
|
if (op->recv_initial_metadata) {
|
1620
|
-
GRPC_STATS_INC_HTTP2_OP_RECV_INITIAL_METADATA(
|
1566
|
+
GRPC_STATS_INC_HTTP2_OP_RECV_INITIAL_METADATA();
|
1621
1567
|
GPR_ASSERT(s->recv_initial_metadata_ready == nullptr);
|
1622
1568
|
s->recv_initial_metadata_ready =
|
1623
1569
|
op_payload->recv_initial_metadata.recv_initial_metadata_ready;
|
@@ -1629,11 +1575,11 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1629
1575
|
gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string,
|
1630
1576
|
(gpr_atm)gpr_strdup(t->peer_string));
|
1631
1577
|
}
|
1632
|
-
grpc_chttp2_maybe_complete_recv_initial_metadata(
|
1578
|
+
grpc_chttp2_maybe_complete_recv_initial_metadata(t, s);
|
1633
1579
|
}
|
1634
1580
|
|
1635
1581
|
if (op->recv_message) {
|
1636
|
-
GRPC_STATS_INC_HTTP2_OP_RECV_MESSAGE(
|
1582
|
+
GRPC_STATS_INC_HTTP2_OP_RECV_MESSAGE();
|
1637
1583
|
size_t already_received;
|
1638
1584
|
GPR_ASSERT(s->recv_message_ready == nullptr);
|
1639
1585
|
GPR_ASSERT(!s->pending_byte_stream);
|
@@ -1644,32 +1590,30 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
|
|
1644
1590
|
already_received = s->frame_storage.length;
|
1645
1591
|
s->flow_control->IncomingByteStreamUpdate(GRPC_HEADER_SIZE_IN_BYTES,
|
1646
1592
|
already_received);
|
1647
|
-
grpc_chttp2_act_on_flowctl_action(
|
1648
|
-
s->flow_control->MakeAction(), t, s);
|
1593
|
+
grpc_chttp2_act_on_flowctl_action(s->flow_control->MakeAction(), t, s);
|
1649
1594
|
}
|
1650
1595
|
}
|
1651
|
-
grpc_chttp2_maybe_complete_recv_message(
|
1596
|
+
grpc_chttp2_maybe_complete_recv_message(t, s);
|
1652
1597
|
}
|
1653
1598
|
|
1654
1599
|
if (op->recv_trailing_metadata) {
|
1655
|
-
GRPC_STATS_INC_HTTP2_OP_RECV_TRAILING_METADATA(
|
1600
|
+
GRPC_STATS_INC_HTTP2_OP_RECV_TRAILING_METADATA();
|
1656
1601
|
GPR_ASSERT(s->recv_trailing_metadata_finished == nullptr);
|
1657
1602
|
s->recv_trailing_metadata_finished = add_closure_barrier(on_complete);
|
1658
1603
|
s->recv_trailing_metadata =
|
1659
1604
|
op_payload->recv_trailing_metadata.recv_trailing_metadata;
|
1660
1605
|
s->final_metadata_requested = true;
|
1661
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(
|
1606
|
+
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
1662
1607
|
}
|
1663
1608
|
|
1664
|
-
grpc_chttp2_complete_closure_step(
|
1665
|
-
|
1609
|
+
grpc_chttp2_complete_closure_step(t, s, &on_complete, GRPC_ERROR_NONE,
|
1610
|
+
"op->on_complete");
|
1666
1611
|
|
1667
1612
|
GPR_TIMER_END("perform_stream_op_locked", 0);
|
1668
|
-
GRPC_CHTTP2_STREAM_UNREF(
|
1613
|
+
GRPC_CHTTP2_STREAM_UNREF(s, "perform_stream_op");
|
1669
1614
|
}
|
1670
1615
|
|
1671
|
-
static void perform_stream_op(
|
1672
|
-
grpc_stream* gs,
|
1616
|
+
static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
|
1673
1617
|
grpc_transport_stream_op_batch* op) {
|
1674
1618
|
GPR_TIMER_BEGIN("perform_stream_op", 0);
|
1675
1619
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
|
@@ -1697,32 +1641,29 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
|
|
1697
1641
|
op->handler_private.extra_arg = gs;
|
1698
1642
|
GRPC_CHTTP2_STREAM_REF(s, "perform_stream_op");
|
1699
1643
|
GRPC_CLOSURE_SCHED(
|
1700
|
-
exec_ctx,
|
1701
1644
|
GRPC_CLOSURE_INIT(&op->handler_private.closure, perform_stream_op_locked,
|
1702
1645
|
op, grpc_combiner_scheduler(t->combiner)),
|
1703
1646
|
GRPC_ERROR_NONE);
|
1704
1647
|
GPR_TIMER_END("perform_stream_op", 0);
|
1705
1648
|
}
|
1706
1649
|
|
1707
|
-
static void cancel_pings(
|
1708
|
-
grpc_error* error) {
|
1650
|
+
static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error) {
|
1709
1651
|
/* callback remaining pings: they're not allowed to call into the transpot,
|
1710
1652
|
and maybe they hold resources that need to be freed */
|
1711
1653
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
1712
1654
|
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
1713
1655
|
for (size_t j = 0; j < GRPC_CHTTP2_PCL_COUNT; j++) {
|
1714
1656
|
grpc_closure_list_fail_all(&pq->lists[j], GRPC_ERROR_REF(error));
|
1715
|
-
GRPC_CLOSURE_LIST_SCHED(
|
1657
|
+
GRPC_CLOSURE_LIST_SCHED(&pq->lists[j]);
|
1716
1658
|
}
|
1717
1659
|
GRPC_ERROR_UNREF(error);
|
1718
1660
|
}
|
1719
1661
|
|
1720
|
-
static void send_ping_locked(
|
1662
|
+
static void send_ping_locked(grpc_chttp2_transport* t,
|
1721
1663
|
grpc_closure* on_initiate, grpc_closure* on_ack) {
|
1722
1664
|
if (t->closed_with_error != GRPC_ERROR_NONE) {
|
1723
|
-
GRPC_CLOSURE_SCHED(
|
1724
|
-
|
1725
|
-
GRPC_CLOSURE_SCHED(exec_ctx, on_ack, GRPC_ERROR_REF(t->closed_with_error));
|
1665
|
+
GRPC_CLOSURE_SCHED(on_initiate, GRPC_ERROR_REF(t->closed_with_error));
|
1666
|
+
GRPC_CLOSURE_SCHED(on_ack, GRPC_ERROR_REF(t->closed_with_error));
|
1726
1667
|
return;
|
1727
1668
|
}
|
1728
1669
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
@@ -1732,18 +1673,15 @@ static void send_ping_locked(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
1732
1673
|
GRPC_ERROR_NONE);
|
1733
1674
|
}
|
1734
1675
|
|
1735
|
-
static void retry_initiate_ping_locked(
|
1736
|
-
grpc_error* error) {
|
1676
|
+
static void retry_initiate_ping_locked(void* tp, grpc_error* error) {
|
1737
1677
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
|
1738
1678
|
t->ping_state.is_delayed_ping_timer_set = false;
|
1739
1679
|
if (error == GRPC_ERROR_NONE) {
|
1740
|
-
grpc_chttp2_initiate_write(
|
1741
|
-
GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING);
|
1680
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING);
|
1742
1681
|
}
|
1743
1682
|
}
|
1744
1683
|
|
1745
|
-
void grpc_chttp2_ack_ping(
|
1746
|
-
uint64_t id) {
|
1684
|
+
void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
|
1747
1685
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
1748
1686
|
if (pq->inflight_id != id) {
|
1749
1687
|
char* from = grpc_endpoint_get_peer(t->ep);
|
@@ -1751,54 +1689,48 @@ void grpc_chttp2_ack_ping(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
1751
1689
|
gpr_free(from);
|
1752
1690
|
return;
|
1753
1691
|
}
|
1754
|
-
GRPC_CLOSURE_LIST_SCHED(
|
1692
|
+
GRPC_CLOSURE_LIST_SCHED(&pq->lists[GRPC_CHTTP2_PCL_INFLIGHT]);
|
1755
1693
|
if (!grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_NEXT])) {
|
1756
|
-
grpc_chttp2_initiate_write(
|
1757
|
-
GRPC_CHTTP2_INITIATE_WRITE_CONTINUE_PINGS);
|
1694
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_CONTINUE_PINGS);
|
1758
1695
|
}
|
1759
1696
|
}
|
1760
1697
|
|
1761
|
-
static void send_goaway(
|
1762
|
-
grpc_error* error) {
|
1698
|
+
static void send_goaway(grpc_chttp2_transport* t, grpc_error* error) {
|
1763
1699
|
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED;
|
1764
1700
|
grpc_http2_error_code http_error;
|
1765
1701
|
grpc_slice slice;
|
1766
|
-
grpc_error_get_status(
|
1767
|
-
&
|
1702
|
+
grpc_error_get_status(error, GRPC_MILLIS_INF_FUTURE, nullptr, &slice,
|
1703
|
+
&http_error, nullptr);
|
1768
1704
|
grpc_chttp2_goaway_append(t->last_new_stream_id, (uint32_t)http_error,
|
1769
1705
|
grpc_slice_ref_internal(slice), &t->qbuf);
|
1770
|
-
grpc_chttp2_initiate_write(
|
1771
|
-
GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT);
|
1706
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT);
|
1772
1707
|
GRPC_ERROR_UNREF(error);
|
1773
1708
|
}
|
1774
1709
|
|
1775
|
-
void grpc_chttp2_add_ping_strike(
|
1776
|
-
grpc_chttp2_transport* t) {
|
1710
|
+
void grpc_chttp2_add_ping_strike(grpc_chttp2_transport* t) {
|
1777
1711
|
t->ping_recv_state.ping_strikes++;
|
1778
1712
|
if (++t->ping_recv_state.ping_strikes > t->ping_policy.max_ping_strikes &&
|
1779
1713
|
t->ping_policy.max_ping_strikes != 0) {
|
1780
|
-
send_goaway(
|
1714
|
+
send_goaway(t,
|
1781
1715
|
grpc_error_set_int(
|
1782
1716
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("too_many_pings"),
|
1783
1717
|
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM));
|
1784
1718
|
/*The transport will be closed after the write is done */
|
1785
1719
|
close_transport_locked(
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
|
1720
|
+
t, grpc_error_set_int(
|
1721
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many pings"),
|
1722
|
+
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
|
1790
1723
|
}
|
1791
1724
|
}
|
1792
1725
|
|
1793
|
-
static void perform_transport_op_locked(
|
1794
|
-
void* stream_op,
|
1726
|
+
static void perform_transport_op_locked(void* stream_op,
|
1795
1727
|
grpc_error* error_ignored) {
|
1796
1728
|
grpc_transport_op* op = (grpc_transport_op*)stream_op;
|
1797
1729
|
grpc_chttp2_transport* t =
|
1798
1730
|
(grpc_chttp2_transport*)op->handler_private.extra_arg;
|
1799
1731
|
|
1800
1732
|
if (op->goaway_error) {
|
1801
|
-
send_goaway(
|
1733
|
+
send_goaway(t, op->goaway_error);
|
1802
1734
|
}
|
1803
1735
|
|
1804
1736
|
if (op->set_accept_stream) {
|
@@ -1808,43 +1740,40 @@ static void perform_transport_op_locked(grpc_exec_ctx* exec_ctx,
|
|
1808
1740
|
}
|
1809
1741
|
|
1810
1742
|
if (op->bind_pollset) {
|
1811
|
-
grpc_endpoint_add_to_pollset(
|
1743
|
+
grpc_endpoint_add_to_pollset(t->ep, op->bind_pollset);
|
1812
1744
|
}
|
1813
1745
|
|
1814
1746
|
if (op->bind_pollset_set) {
|
1815
|
-
grpc_endpoint_add_to_pollset_set(
|
1747
|
+
grpc_endpoint_add_to_pollset_set(t->ep, op->bind_pollset_set);
|
1816
1748
|
}
|
1817
1749
|
|
1818
|
-
if (op->send_ping) {
|
1819
|
-
send_ping_locked(
|
1820
|
-
grpc_chttp2_initiate_write(
|
1821
|
-
GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING);
|
1750
|
+
if (op->send_ping.on_initiate != nullptr || op->send_ping.on_ack != nullptr) {
|
1751
|
+
send_ping_locked(t, op->send_ping.on_initiate, op->send_ping.on_ack);
|
1752
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING);
|
1822
1753
|
}
|
1823
1754
|
|
1824
1755
|
if (op->on_connectivity_state_change != nullptr) {
|
1825
1756
|
grpc_connectivity_state_notify_on_state_change(
|
1826
|
-
|
1757
|
+
&t->channel_callback.state_tracker, op->connectivity_state,
|
1827
1758
|
op->on_connectivity_state_change);
|
1828
1759
|
}
|
1829
1760
|
|
1830
1761
|
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
|
1831
|
-
close_transport_locked(
|
1762
|
+
close_transport_locked(t, op->disconnect_with_error);
|
1832
1763
|
}
|
1833
1764
|
|
1834
|
-
GRPC_CLOSURE_RUN(
|
1765
|
+
GRPC_CLOSURE_RUN(op->on_consumed, GRPC_ERROR_NONE);
|
1835
1766
|
|
1836
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
1767
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "transport_op");
|
1837
1768
|
}
|
1838
1769
|
|
1839
|
-
static void perform_transport_op(
|
1840
|
-
grpc_transport_op* op) {
|
1770
|
+
static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
|
1841
1771
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
|
1842
1772
|
char* msg = grpc_transport_op_string(op);
|
1843
1773
|
gpr_free(msg);
|
1844
1774
|
op->handler_private.extra_arg = gt;
|
1845
1775
|
GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op");
|
1846
|
-
GRPC_CLOSURE_SCHED(
|
1847
|
-
GRPC_CLOSURE_INIT(&op->handler_private.closure,
|
1776
|
+
GRPC_CLOSURE_SCHED(GRPC_CLOSURE_INIT(&op->handler_private.closure,
|
1848
1777
|
perform_transport_op_locked, op,
|
1849
1778
|
grpc_combiner_scheduler(t->combiner)),
|
1850
1779
|
GRPC_ERROR_NONE);
|
@@ -1854,36 +1783,33 @@ static void perform_transport_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
|
|
1854
1783
|
* INPUT PROCESSING - GENERAL
|
1855
1784
|
*/
|
1856
1785
|
|
1857
|
-
void grpc_chttp2_maybe_complete_recv_initial_metadata(
|
1858
|
-
grpc_chttp2_transport* t,
|
1786
|
+
void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
|
1859
1787
|
grpc_chttp2_stream* s) {
|
1860
1788
|
if (s->recv_initial_metadata_ready != nullptr &&
|
1861
1789
|
s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) {
|
1862
1790
|
if (s->seen_error) {
|
1863
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
1791
|
+
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1864
1792
|
if (!s->pending_byte_stream) {
|
1865
1793
|
grpc_slice_buffer_reset_and_unref_internal(
|
1866
|
-
|
1794
|
+
&s->unprocessed_incoming_frames_buffer);
|
1867
1795
|
}
|
1868
1796
|
}
|
1869
|
-
grpc_chttp2_incoming_metadata_buffer_publish(
|
1870
|
-
|
1871
|
-
null_then_run_closure(
|
1872
|
-
GRPC_ERROR_NONE);
|
1797
|
+
grpc_chttp2_incoming_metadata_buffer_publish(&s->metadata_buffer[0],
|
1798
|
+
s->recv_initial_metadata);
|
1799
|
+
null_then_run_closure(&s->recv_initial_metadata_ready, GRPC_ERROR_NONE);
|
1873
1800
|
}
|
1874
1801
|
}
|
1875
1802
|
|
1876
|
-
void grpc_chttp2_maybe_complete_recv_message(
|
1877
|
-
grpc_chttp2_transport* t,
|
1803
|
+
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
|
1878
1804
|
grpc_chttp2_stream* s) {
|
1879
1805
|
grpc_error* error = GRPC_ERROR_NONE;
|
1880
1806
|
if (s->recv_message_ready != nullptr) {
|
1881
1807
|
*s->recv_message = nullptr;
|
1882
1808
|
if (s->final_metadata_requested && s->seen_error) {
|
1883
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
1809
|
+
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1884
1810
|
if (!s->pending_byte_stream) {
|
1885
1811
|
grpc_slice_buffer_reset_and_unref_internal(
|
1886
|
-
|
1812
|
+
&s->unprocessed_incoming_frames_buffer);
|
1887
1813
|
}
|
1888
1814
|
}
|
1889
1815
|
if (!s->pending_byte_stream) {
|
@@ -1910,10 +1836,9 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
|
|
1910
1836
|
&s->decompressed_data_buffer, nullptr,
|
1911
1837
|
GRPC_HEADER_SIZE_IN_BYTES - s->decompressed_header_bytes,
|
1912
1838
|
&end_of_context)) {
|
1913
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
1914
|
-
&s->frame_storage);
|
1839
|
+
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1915
1840
|
grpc_slice_buffer_reset_and_unref_internal(
|
1916
|
-
|
1841
|
+
&s->unprocessed_incoming_frames_buffer);
|
1917
1842
|
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1918
1843
|
"Stream decompression error.");
|
1919
1844
|
} else {
|
@@ -1922,8 +1847,8 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
|
|
1922
1847
|
s->decompressed_header_bytes = 0;
|
1923
1848
|
}
|
1924
1849
|
error = grpc_deframe_unprocessed_incoming_frames(
|
1925
|
-
|
1926
|
-
|
1850
|
+
&s->data_parser, s, &s->decompressed_data_buffer, nullptr,
|
1851
|
+
s->recv_message);
|
1927
1852
|
if (end_of_context) {
|
1928
1853
|
grpc_stream_compression_context_destroy(
|
1929
1854
|
s->stream_decompression_ctx);
|
@@ -1932,15 +1857,14 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
|
|
1932
1857
|
}
|
1933
1858
|
} else {
|
1934
1859
|
error = grpc_deframe_unprocessed_incoming_frames(
|
1935
|
-
|
1936
|
-
|
1860
|
+
&s->data_parser, s, &s->unprocessed_incoming_frames_buffer,
|
1861
|
+
nullptr, s->recv_message);
|
1937
1862
|
}
|
1938
1863
|
if (error != GRPC_ERROR_NONE) {
|
1939
1864
|
s->seen_error = true;
|
1940
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
1941
|
-
&s->frame_storage);
|
1865
|
+
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1942
1866
|
grpc_slice_buffer_reset_and_unref_internal(
|
1943
|
-
|
1867
|
+
&s->unprocessed_incoming_frames_buffer);
|
1944
1868
|
break;
|
1945
1869
|
} else if (*s->recv_message != nullptr) {
|
1946
1870
|
break;
|
@@ -1948,26 +1872,25 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
|
|
1948
1872
|
}
|
1949
1873
|
}
|
1950
1874
|
if (error == GRPC_ERROR_NONE && *s->recv_message != nullptr) {
|
1951
|
-
null_then_run_closure(
|
1875
|
+
null_then_run_closure(&s->recv_message_ready, GRPC_ERROR_NONE);
|
1952
1876
|
} else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) {
|
1953
1877
|
*s->recv_message = nullptr;
|
1954
|
-
null_then_run_closure(
|
1878
|
+
null_then_run_closure(&s->recv_message_ready, GRPC_ERROR_NONE);
|
1955
1879
|
}
|
1956
1880
|
GRPC_ERROR_UNREF(error);
|
1957
1881
|
}
|
1958
1882
|
}
|
1959
1883
|
|
1960
|
-
void grpc_chttp2_maybe_complete_recv_trailing_metadata(
|
1961
|
-
grpc_chttp2_transport* t,
|
1884
|
+
void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
|
1962
1885
|
grpc_chttp2_stream* s) {
|
1963
|
-
grpc_chttp2_maybe_complete_recv_message(
|
1886
|
+
grpc_chttp2_maybe_complete_recv_message(t, s);
|
1964
1887
|
if (s->recv_trailing_metadata_finished != nullptr && s->read_closed &&
|
1965
1888
|
s->write_closed) {
|
1966
1889
|
if (s->seen_error) {
|
1967
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
1890
|
+
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1968
1891
|
if (!s->pending_byte_stream) {
|
1969
1892
|
grpc_slice_buffer_reset_and_unref_internal(
|
1970
|
-
|
1893
|
+
&s->unprocessed_incoming_frames_buffer);
|
1971
1894
|
}
|
1972
1895
|
}
|
1973
1896
|
bool pending_data = s->pending_byte_stream ||
|
@@ -1985,9 +1908,9 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
|
|
1985
1908
|
s->stream_decompression_ctx, &s->frame_storage,
|
1986
1909
|
&s->unprocessed_incoming_frames_buffer, nullptr,
|
1987
1910
|
GRPC_HEADER_SIZE_IN_BYTES, &end_of_context)) {
|
1988
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
1911
|
+
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1989
1912
|
grpc_slice_buffer_reset_and_unref_internal(
|
1990
|
-
|
1913
|
+
&s->unprocessed_incoming_frames_buffer);
|
1991
1914
|
s->seen_error = true;
|
1992
1915
|
} else {
|
1993
1916
|
if (s->unprocessed_incoming_frames_buffer.length > 0) {
|
@@ -2002,23 +1925,23 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
|
|
2002
1925
|
}
|
2003
1926
|
if (s->read_closed && s->frame_storage.length == 0 && !pending_data &&
|
2004
1927
|
s->recv_trailing_metadata_finished != nullptr) {
|
2005
|
-
grpc_chttp2_incoming_metadata_buffer_publish(
|
2006
|
-
|
1928
|
+
grpc_chttp2_incoming_metadata_buffer_publish(&s->metadata_buffer[1],
|
1929
|
+
s->recv_trailing_metadata);
|
2007
1930
|
grpc_chttp2_complete_closure_step(
|
2008
|
-
|
1931
|
+
t, s, &s->recv_trailing_metadata_finished, GRPC_ERROR_NONE,
|
2009
1932
|
"recv_trailing_metadata_finished");
|
2010
1933
|
}
|
2011
1934
|
}
|
2012
1935
|
}
|
2013
1936
|
|
2014
|
-
static void remove_stream(
|
2015
|
-
|
1937
|
+
static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
|
1938
|
+
grpc_error* error) {
|
2016
1939
|
grpc_chttp2_stream* s =
|
2017
1940
|
(grpc_chttp2_stream*)grpc_chttp2_stream_map_delete(&t->stream_map, id);
|
2018
1941
|
GPR_ASSERT(s);
|
2019
1942
|
if (t->incoming_stream == s) {
|
2020
1943
|
t->incoming_stream = nullptr;
|
2021
|
-
grpc_chttp2_parsing_become_skip_parser(
|
1944
|
+
grpc_chttp2_parsing_become_skip_parser(t);
|
2022
1945
|
}
|
2023
1946
|
if (s->pending_byte_stream) {
|
2024
1947
|
if (s->on_next != nullptr) {
|
@@ -2026,8 +1949,8 @@ static void remove_stream(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
2026
1949
|
if (error == GRPC_ERROR_NONE) {
|
2027
1950
|
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
2028
1951
|
}
|
2029
|
-
incoming_byte_stream_publish_error(
|
2030
|
-
incoming_byte_stream_unref(
|
1952
|
+
incoming_byte_stream_publish_error(bs, error);
|
1953
|
+
incoming_byte_stream_unref(bs);
|
2031
1954
|
s->data_parser.parsing_frame = nullptr;
|
2032
1955
|
} else {
|
2033
1956
|
GRPC_ERROR_UNREF(s->byte_stream_error);
|
@@ -2036,56 +1959,52 @@ static void remove_stream(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
2036
1959
|
}
|
2037
1960
|
|
2038
1961
|
if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
2039
|
-
post_benign_reclaimer(
|
1962
|
+
post_benign_reclaimer(t);
|
2040
1963
|
if (t->sent_goaway_state == GRPC_CHTTP2_GOAWAY_SENT) {
|
2041
1964
|
close_transport_locked(
|
2042
|
-
|
2043
|
-
|
2044
|
-
"Last stream closed after sending GOAWAY", &error, 1));
|
1965
|
+
t, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
1966
|
+
"Last stream closed after sending GOAWAY", &error, 1));
|
2045
1967
|
}
|
2046
1968
|
}
|
2047
1969
|
if (grpc_chttp2_list_remove_writable_stream(t, s)) {
|
2048
|
-
GRPC_CHTTP2_STREAM_UNREF(
|
1970
|
+
GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:remove_stream");
|
2049
1971
|
}
|
2050
1972
|
|
2051
1973
|
GRPC_ERROR_UNREF(error);
|
2052
1974
|
|
2053
|
-
maybe_start_some_streams(
|
1975
|
+
maybe_start_some_streams(t);
|
2054
1976
|
}
|
2055
1977
|
|
2056
|
-
void grpc_chttp2_cancel_stream(
|
2057
|
-
grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
1978
|
+
void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
2058
1979
|
grpc_error* due_to_error) {
|
2059
1980
|
if (!t->is_client && !s->sent_trailing_metadata &&
|
2060
1981
|
grpc_error_has_clear_grpc_status(due_to_error)) {
|
2061
|
-
close_from_api(
|
1982
|
+
close_from_api(t, s, due_to_error);
|
2062
1983
|
return;
|
2063
1984
|
}
|
2064
1985
|
|
2065
1986
|
if (!s->read_closed || !s->write_closed) {
|
2066
1987
|
if (s->id != 0) {
|
2067
1988
|
grpc_http2_error_code http_error;
|
2068
|
-
grpc_error_get_status(
|
2069
|
-
|
1989
|
+
grpc_error_get_status(due_to_error, s->deadline, nullptr, nullptr,
|
1990
|
+
&http_error, nullptr);
|
2070
1991
|
grpc_slice_buffer_add(
|
2071
1992
|
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, (uint32_t)http_error,
|
2072
1993
|
&s->stats.outgoing));
|
2073
|
-
grpc_chttp2_initiate_write(
|
2074
|
-
GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
|
1994
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
|
2075
1995
|
}
|
2076
1996
|
}
|
2077
1997
|
if (due_to_error != GRPC_ERROR_NONE && !s->seen_error) {
|
2078
1998
|
s->seen_error = true;
|
2079
1999
|
}
|
2080
|
-
grpc_chttp2_mark_stream_closed(
|
2000
|
+
grpc_chttp2_mark_stream_closed(t, s, 1, 1, due_to_error);
|
2081
2001
|
}
|
2082
2002
|
|
2083
|
-
void grpc_chttp2_fake_status(
|
2084
|
-
|
2003
|
+
void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
2004
|
+
grpc_error* error) {
|
2085
2005
|
grpc_status_code status;
|
2086
2006
|
grpc_slice slice;
|
2087
|
-
grpc_error_get_status(
|
2088
|
-
nullptr);
|
2007
|
+
grpc_error_get_status(error, s->deadline, &status, &slice, nullptr, nullptr);
|
2089
2008
|
if (status != GRPC_STATUS_OK) {
|
2090
2009
|
s->seen_error = true;
|
2091
2010
|
}
|
@@ -2101,20 +2020,20 @@ void grpc_chttp2_fake_status(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
2101
2020
|
gpr_ltoa(status, status_string);
|
2102
2021
|
GRPC_LOG_IF_ERROR("add_status",
|
2103
2022
|
grpc_chttp2_incoming_metadata_buffer_replace_or_add(
|
2104
|
-
|
2023
|
+
&s->metadata_buffer[1],
|
2105
2024
|
grpc_mdelem_from_slices(
|
2106
|
-
|
2025
|
+
GRPC_MDSTR_GRPC_STATUS,
|
2107
2026
|
grpc_slice_from_copied_string(status_string))));
|
2108
2027
|
if (!GRPC_SLICE_IS_EMPTY(slice)) {
|
2109
2028
|
GRPC_LOG_IF_ERROR(
|
2110
2029
|
"add_status_message",
|
2111
2030
|
grpc_chttp2_incoming_metadata_buffer_replace_or_add(
|
2112
|
-
|
2113
|
-
grpc_mdelem_from_slices(
|
2031
|
+
&s->metadata_buffer[1],
|
2032
|
+
grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_MESSAGE,
|
2114
2033
|
grpc_slice_ref_internal(slice))));
|
2115
2034
|
}
|
2116
2035
|
s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE;
|
2117
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(
|
2036
|
+
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
2118
2037
|
}
|
2119
2038
|
|
2120
2039
|
GRPC_ERROR_UNREF(error);
|
@@ -2147,14 +2066,12 @@ static grpc_error* removal_error(grpc_error* extra_error, grpc_chttp2_stream* s,
|
|
2147
2066
|
return error;
|
2148
2067
|
}
|
2149
2068
|
|
2150
|
-
static void flush_write_list(
|
2151
|
-
|
2152
|
-
grpc_error* error) {
|
2069
|
+
static void flush_write_list(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
2070
|
+
grpc_chttp2_write_cb** list, grpc_error* error) {
|
2153
2071
|
while (*list) {
|
2154
2072
|
grpc_chttp2_write_cb* cb = *list;
|
2155
2073
|
*list = cb->next;
|
2156
|
-
grpc_chttp2_complete_closure_step(
|
2157
|
-
GRPC_ERROR_REF(error),
|
2074
|
+
grpc_chttp2_complete_closure_step(t, s, &cb->closure, GRPC_ERROR_REF(error),
|
2158
2075
|
"on_write_finished_cb");
|
2159
2076
|
cb->next = t->write_cb_pool;
|
2160
2077
|
t->write_cb_pool = cb;
|
@@ -2162,37 +2079,34 @@ static void flush_write_list(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
2162
2079
|
GRPC_ERROR_UNREF(error);
|
2163
2080
|
}
|
2164
2081
|
|
2165
|
-
void grpc_chttp2_fail_pending_writes(
|
2166
|
-
grpc_chttp2_transport* t,
|
2082
|
+
void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
|
2167
2083
|
grpc_chttp2_stream* s, grpc_error* error) {
|
2168
2084
|
error =
|
2169
2085
|
removal_error(error, s, "Pending writes failed due to stream closure");
|
2170
2086
|
s->send_initial_metadata = nullptr;
|
2171
|
-
grpc_chttp2_complete_closure_step(
|
2172
|
-
|
2173
|
-
|
2087
|
+
grpc_chttp2_complete_closure_step(t, s, &s->send_initial_metadata_finished,
|
2088
|
+
GRPC_ERROR_REF(error),
|
2089
|
+
"send_initial_metadata_finished");
|
2174
2090
|
|
2175
2091
|
s->send_trailing_metadata = nullptr;
|
2176
|
-
grpc_chttp2_complete_closure_step(
|
2177
|
-
|
2178
|
-
|
2092
|
+
grpc_chttp2_complete_closure_step(t, s, &s->send_trailing_metadata_finished,
|
2093
|
+
GRPC_ERROR_REF(error),
|
2094
|
+
"send_trailing_metadata_finished");
|
2179
2095
|
|
2180
2096
|
s->fetching_send_message = nullptr;
|
2181
|
-
grpc_chttp2_complete_closure_step(
|
2182
|
-
|
2183
|
-
|
2184
|
-
flush_write_list(
|
2185
|
-
|
2186
|
-
flush_write_list(exec_ctx, t, s, &s->on_flow_controlled_cbs, error);
|
2097
|
+
grpc_chttp2_complete_closure_step(t, s, &s->fetching_send_message_finished,
|
2098
|
+
GRPC_ERROR_REF(error),
|
2099
|
+
"fetching_send_message_finished");
|
2100
|
+
flush_write_list(t, s, &s->on_write_finished_cbs, GRPC_ERROR_REF(error));
|
2101
|
+
flush_write_list(t, s, &s->on_flow_controlled_cbs, error);
|
2187
2102
|
}
|
2188
2103
|
|
2189
|
-
void grpc_chttp2_mark_stream_closed(
|
2190
|
-
grpc_chttp2_transport* t,
|
2104
|
+
void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
2191
2105
|
grpc_chttp2_stream* s, int close_reads,
|
2192
2106
|
int close_writes, grpc_error* error) {
|
2193
2107
|
if (s->read_closed && s->write_closed) {
|
2194
2108
|
/* already closed */
|
2195
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(
|
2109
|
+
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
2196
2110
|
GRPC_ERROR_UNREF(error);
|
2197
2111
|
return;
|
2198
2112
|
}
|
@@ -2206,20 +2120,20 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx* exec_ctx,
|
|
2206
2120
|
if (close_writes && !s->write_closed) {
|
2207
2121
|
s->write_closed_error = GRPC_ERROR_REF(error);
|
2208
2122
|
s->write_closed = true;
|
2209
|
-
grpc_chttp2_fail_pending_writes(
|
2123
|
+
grpc_chttp2_fail_pending_writes(t, s, GRPC_ERROR_REF(error));
|
2210
2124
|
}
|
2211
2125
|
if (s->read_closed && s->write_closed) {
|
2212
2126
|
became_closed = true;
|
2213
2127
|
grpc_error* overall_error =
|
2214
2128
|
removal_error(GRPC_ERROR_REF(error), s, "Stream removed");
|
2215
2129
|
if (s->id != 0) {
|
2216
|
-
remove_stream(
|
2130
|
+
remove_stream(t, s->id, GRPC_ERROR_REF(overall_error));
|
2217
2131
|
} else {
|
2218
2132
|
/* Purge streams waiting on concurrency still waiting for id assignment */
|
2219
2133
|
grpc_chttp2_list_remove_waiting_for_concurrency(t, s);
|
2220
2134
|
}
|
2221
2135
|
if (overall_error != GRPC_ERROR_NONE) {
|
2222
|
-
grpc_chttp2_fake_status(
|
2136
|
+
grpc_chttp2_fake_status(t, s, overall_error);
|
2223
2137
|
}
|
2224
2138
|
}
|
2225
2139
|
if (closed_read) {
|
@@ -2228,18 +2142,18 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx* exec_ctx,
|
|
2228
2142
|
s->published_metadata[i] = GPRC_METADATA_PUBLISHED_AT_CLOSE;
|
2229
2143
|
}
|
2230
2144
|
}
|
2231
|
-
grpc_chttp2_maybe_complete_recv_initial_metadata(
|
2232
|
-
grpc_chttp2_maybe_complete_recv_message(
|
2145
|
+
grpc_chttp2_maybe_complete_recv_initial_metadata(t, s);
|
2146
|
+
grpc_chttp2_maybe_complete_recv_message(t, s);
|
2233
2147
|
}
|
2234
2148
|
if (became_closed) {
|
2235
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(
|
2236
|
-
GRPC_CHTTP2_STREAM_UNREF(
|
2149
|
+
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
2150
|
+
GRPC_CHTTP2_STREAM_UNREF(s, "chttp2");
|
2237
2151
|
}
|
2238
2152
|
GRPC_ERROR_UNREF(error);
|
2239
2153
|
}
|
2240
2154
|
|
2241
|
-
static void close_from_api(
|
2242
|
-
|
2155
|
+
static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
2156
|
+
grpc_error* error) {
|
2243
2157
|
grpc_slice hdr;
|
2244
2158
|
grpc_slice status_hdr;
|
2245
2159
|
grpc_slice http_status_hdr;
|
@@ -2249,8 +2163,8 @@ static void close_from_api(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
2249
2163
|
uint32_t len = 0;
|
2250
2164
|
grpc_status_code grpc_status;
|
2251
2165
|
grpc_slice slice;
|
2252
|
-
grpc_error_get_status(
|
2253
|
-
nullptr
|
2166
|
+
grpc_error_get_status(error, s->deadline, &grpc_status, &slice, nullptr,
|
2167
|
+
nullptr);
|
2254
2168
|
|
2255
2169
|
GPR_ASSERT(grpc_status >= 0 && (int)grpc_status < 100);
|
2256
2170
|
|
@@ -2392,13 +2306,11 @@ static void close_from_api(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
2392
2306
|
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR,
|
2393
2307
|
&s->stats.outgoing));
|
2394
2308
|
|
2395
|
-
grpc_chttp2_mark_stream_closed(
|
2396
|
-
grpc_chttp2_initiate_write(
|
2397
|
-
GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API);
|
2309
|
+
grpc_chttp2_mark_stream_closed(t, s, 1, 1, error);
|
2310
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API);
|
2398
2311
|
}
|
2399
2312
|
|
2400
2313
|
typedef struct {
|
2401
|
-
grpc_exec_ctx* exec_ctx;
|
2402
2314
|
grpc_error* error;
|
2403
2315
|
grpc_chttp2_transport* t;
|
2404
2316
|
} cancel_stream_cb_args;
|
@@ -2406,13 +2318,11 @@ typedef struct {
|
|
2406
2318
|
static void cancel_stream_cb(void* user_data, uint32_t key, void* stream) {
|
2407
2319
|
cancel_stream_cb_args* args = (cancel_stream_cb_args*)user_data;
|
2408
2320
|
grpc_chttp2_stream* s = (grpc_chttp2_stream*)stream;
|
2409
|
-
grpc_chttp2_cancel_stream(args->
|
2410
|
-
GRPC_ERROR_REF(args->error));
|
2321
|
+
grpc_chttp2_cancel_stream(args->t, s, GRPC_ERROR_REF(args->error));
|
2411
2322
|
}
|
2412
2323
|
|
2413
|
-
static void end_all_the_calls(
|
2414
|
-
|
2415
|
-
cancel_stream_cb_args args = {exec_ctx, error, t};
|
2324
|
+
static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error) {
|
2325
|
+
cancel_stream_cb_args args = {error, t};
|
2416
2326
|
grpc_chttp2_stream_map_for_each(&t->stream_map, cancel_stream_cb, &args);
|
2417
2327
|
GRPC_ERROR_UNREF(error);
|
2418
2328
|
}
|
@@ -2422,14 +2332,14 @@ static void end_all_the_calls(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
2422
2332
|
*/
|
2423
2333
|
|
2424
2334
|
template <class F>
|
2425
|
-
static void WithUrgency(
|
2335
|
+
static void WithUrgency(grpc_chttp2_transport* t,
|
2426
2336
|
grpc_core::chttp2::FlowControlAction::Urgency urgency,
|
2427
2337
|
grpc_chttp2_initiate_write_reason reason, F action) {
|
2428
2338
|
switch (urgency) {
|
2429
2339
|
case grpc_core::chttp2::FlowControlAction::Urgency::NO_ACTION_NEEDED:
|
2430
2340
|
break;
|
2431
2341
|
case grpc_core::chttp2::FlowControlAction::Urgency::UPDATE_IMMEDIATELY:
|
2432
|
-
grpc_chttp2_initiate_write(
|
2342
|
+
grpc_chttp2_initiate_write(t, reason);
|
2433
2343
|
// fallthrough
|
2434
2344
|
case grpc_core::chttp2::FlowControlAction::Urgency::QUEUE_UPDATE:
|
2435
2345
|
action();
|
@@ -2438,31 +2348,27 @@ static void WithUrgency(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
|
|
2438
2348
|
}
|
2439
2349
|
|
2440
2350
|
void grpc_chttp2_act_on_flowctl_action(
|
2441
|
-
|
2351
|
+
const grpc_core::chttp2::FlowControlAction& action,
|
2442
2352
|
grpc_chttp2_transport* t, grpc_chttp2_stream* s) {
|
2443
|
-
WithUrgency(
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
WithUrgency(exec_ctx, t, action.send_transport_update(),
|
2353
|
+
WithUrgency(t, action.send_stream_update(),
|
2354
|
+
GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL,
|
2355
|
+
[t, s]() { grpc_chttp2_mark_stream_writable(t, s); });
|
2356
|
+
WithUrgency(t, action.send_transport_update(),
|
2448
2357
|
GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL, []() {});
|
2449
|
-
WithUrgency(
|
2450
|
-
GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS,
|
2451
|
-
|
2452
|
-
queue_setting_update(exec_ctx, t,
|
2358
|
+
WithUrgency(t, action.send_initial_window_update(),
|
2359
|
+
GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS, [t, &action]() {
|
2360
|
+
queue_setting_update(t,
|
2453
2361
|
GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
|
2454
2362
|
action.initial_window_size());
|
2455
2363
|
});
|
2456
|
-
WithUrgency(
|
2457
|
-
|
2458
|
-
|
2459
|
-
|
2460
|
-
|
2461
|
-
});
|
2364
|
+
WithUrgency(t, action.send_max_frame_size_update(),
|
2365
|
+
GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS, [t, &action]() {
|
2366
|
+
queue_setting_update(t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE,
|
2367
|
+
action.max_frame_size());
|
2368
|
+
});
|
2462
2369
|
}
|
2463
2370
|
|
2464
|
-
static grpc_error* try_http_parsing(
|
2465
|
-
grpc_chttp2_transport* t) {
|
2371
|
+
static grpc_error* try_http_parsing(grpc_chttp2_transport* t) {
|
2466
2372
|
grpc_http_parser parser;
|
2467
2373
|
size_t i = 0;
|
2468
2374
|
grpc_error* error = GRPC_ERROR_NONE;
|
@@ -2491,8 +2397,7 @@ static grpc_error* try_http_parsing(grpc_exec_ctx* exec_ctx,
|
|
2491
2397
|
return error;
|
2492
2398
|
}
|
2493
2399
|
|
2494
|
-
static void read_action_locked(
|
2495
|
-
grpc_error* error) {
|
2400
|
+
static void read_action_locked(void* tp, grpc_error* error) {
|
2496
2401
|
GPR_TIMER_BEGIN("reading_action_locked", 0);
|
2497
2402
|
|
2498
2403
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
|
@@ -2514,13 +2419,15 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
|
|
2514
2419
|
grpc_error* errors[3] = {GRPC_ERROR_REF(error), GRPC_ERROR_NONE,
|
2515
2420
|
GRPC_ERROR_NONE};
|
2516
2421
|
for (; i < t->read_buffer.count && errors[1] == GRPC_ERROR_NONE; i++) {
|
2517
|
-
t->flow_control->bdp_estimator()
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2422
|
+
grpc_core::BdpEstimator* bdp_est = t->flow_control->bdp_estimator();
|
2423
|
+
if (bdp_est) {
|
2424
|
+
bdp_est->AddIncomingBytes(
|
2425
|
+
(int64_t)GRPC_SLICE_LENGTH(t->read_buffer.slices[i]));
|
2426
|
+
}
|
2427
|
+
errors[1] = grpc_chttp2_perform_read(t, t->read_buffer.slices[i]);
|
2521
2428
|
}
|
2522
2429
|
if (errors[1] != GRPC_ERROR_NONE) {
|
2523
|
-
errors[2] = try_http_parsing(
|
2430
|
+
errors[2] = try_http_parsing(t);
|
2524
2431
|
GRPC_ERROR_UNREF(error);
|
2525
2432
|
error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
2526
2433
|
"Failed parsing HTTP/2", errors, GPR_ARRAY_SIZE(errors));
|
@@ -2535,10 +2442,9 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
|
|
2535
2442
|
if (t->initial_window_update > 0) {
|
2536
2443
|
grpc_chttp2_stream* s;
|
2537
2444
|
while (grpc_chttp2_list_pop_stalled_by_stream(t, &s)) {
|
2538
|
-
grpc_chttp2_mark_stream_writable(
|
2445
|
+
grpc_chttp2_mark_stream_writable(t, s);
|
2539
2446
|
grpc_chttp2_initiate_write(
|
2540
|
-
|
2541
|
-
GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_SETTING);
|
2447
|
+
t, GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_SETTING);
|
2542
2448
|
}
|
2543
2449
|
}
|
2544
2450
|
t->initial_window_update = 0;
|
@@ -2559,22 +2465,21 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
|
|
2559
2465
|
error = grpc_error_add_child(error, GRPC_ERROR_REF(t->goaway_error));
|
2560
2466
|
}
|
2561
2467
|
|
2562
|
-
close_transport_locked(
|
2468
|
+
close_transport_locked(t, GRPC_ERROR_REF(error));
|
2563
2469
|
t->endpoint_reading = 0;
|
2564
2470
|
} else if (t->closed_with_error == GRPC_ERROR_NONE) {
|
2565
2471
|
keep_reading = true;
|
2566
2472
|
GRPC_CHTTP2_REF_TRANSPORT(t, "keep_reading");
|
2567
2473
|
}
|
2568
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
2474
|
+
grpc_slice_buffer_reset_and_unref_internal(&t->read_buffer);
|
2569
2475
|
|
2570
2476
|
if (keep_reading) {
|
2571
|
-
grpc_endpoint_read(
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "keep_reading");
|
2477
|
+
grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked);
|
2478
|
+
grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t,
|
2479
|
+
nullptr);
|
2480
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "keep_reading");
|
2576
2481
|
} else {
|
2577
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
2482
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "reading_action");
|
2578
2483
|
}
|
2579
2484
|
|
2580
2485
|
GPR_TIMER_END("post_reading_action_locked", 0);
|
@@ -2586,15 +2491,12 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
|
|
2586
2491
|
|
2587
2492
|
// t is reffed prior to calling the first time, and once the callback chain
|
2588
2493
|
// that kicks off finishes, it's unreffed
|
2589
|
-
static void schedule_bdp_ping_locked(
|
2590
|
-
grpc_chttp2_transport* t) {
|
2494
|
+
static void schedule_bdp_ping_locked(grpc_chttp2_transport* t) {
|
2591
2495
|
t->flow_control->bdp_estimator()->SchedulePing();
|
2592
|
-
send_ping_locked(
|
2593
|
-
&t->finish_bdp_ping_locked);
|
2496
|
+
send_ping_locked(t, &t->start_bdp_ping_locked, &t->finish_bdp_ping_locked);
|
2594
2497
|
}
|
2595
2498
|
|
2596
|
-
static void start_bdp_ping_locked(
|
2597
|
-
grpc_error* error) {
|
2499
|
+
static void start_bdp_ping_locked(void* tp, grpc_error* error) {
|
2598
2500
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
|
2599
2501
|
if (grpc_http_trace.enabled()) {
|
2600
2502
|
gpr_log(GPR_DEBUG, "%s: Start BDP ping err=%s", t->peer_string,
|
@@ -2602,42 +2504,39 @@ static void start_bdp_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
|
|
2602
2504
|
}
|
2603
2505
|
/* Reset the keepalive ping timer */
|
2604
2506
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
|
2605
|
-
grpc_timer_cancel(
|
2507
|
+
grpc_timer_cancel(&t->keepalive_ping_timer);
|
2606
2508
|
}
|
2607
2509
|
t->flow_control->bdp_estimator()->StartPing();
|
2608
2510
|
}
|
2609
2511
|
|
2610
|
-
static void finish_bdp_ping_locked(
|
2611
|
-
grpc_error* error) {
|
2512
|
+
static void finish_bdp_ping_locked(void* tp, grpc_error* error) {
|
2612
2513
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
|
2613
2514
|
if (grpc_http_trace.enabled()) {
|
2614
2515
|
gpr_log(GPR_DEBUG, "%s: Complete BDP ping err=%s", t->peer_string,
|
2615
2516
|
grpc_error_string(error));
|
2616
2517
|
}
|
2617
2518
|
if (error != GRPC_ERROR_NONE) {
|
2618
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
2519
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
2619
2520
|
return;
|
2620
2521
|
}
|
2621
|
-
grpc_millis next_ping =
|
2622
|
-
|
2623
|
-
|
2624
|
-
exec_ctx, t->flow_control->PeriodicUpdate(exec_ctx), t, nullptr);
|
2522
|
+
grpc_millis next_ping = t->flow_control->bdp_estimator()->CompletePing();
|
2523
|
+
grpc_chttp2_act_on_flowctl_action(t->flow_control->PeriodicUpdate(), t,
|
2524
|
+
nullptr);
|
2625
2525
|
GPR_ASSERT(!t->have_next_bdp_ping_timer);
|
2626
2526
|
t->have_next_bdp_ping_timer = true;
|
2627
|
-
grpc_timer_init(
|
2527
|
+
grpc_timer_init(&t->next_bdp_ping_timer, next_ping,
|
2628
2528
|
&t->next_bdp_ping_timer_expired_locked);
|
2629
2529
|
}
|
2630
2530
|
|
2631
|
-
static void next_bdp_ping_timer_expired_locked(
|
2632
|
-
void* tp, grpc_error* error) {
|
2531
|
+
static void next_bdp_ping_timer_expired_locked(void* tp, grpc_error* error) {
|
2633
2532
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
|
2634
2533
|
GPR_ASSERT(t->have_next_bdp_ping_timer);
|
2635
2534
|
t->have_next_bdp_ping_timer = false;
|
2636
2535
|
if (error != GRPC_ERROR_NONE) {
|
2637
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
2536
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
2638
2537
|
return;
|
2639
2538
|
}
|
2640
|
-
schedule_bdp_ping_locked(
|
2539
|
+
schedule_bdp_ping_locked(t);
|
2641
2540
|
}
|
2642
2541
|
|
2643
2542
|
void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
|
@@ -2647,7 +2546,9 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
|
|
2647
2546
|
for (i = 0; i < args->num_args; i++) {
|
2648
2547
|
if (0 == strcmp(args->args[i].key, GRPC_ARG_KEEPALIVE_TIME_MS)) {
|
2649
2548
|
const int value = grpc_channel_arg_get_integer(
|
2650
|
-
&args->args[i], {
|
2549
|
+
&args->args[i], {is_client ? g_default_client_keepalive_time_ms
|
2550
|
+
: g_default_server_keepalive_time_ms,
|
2551
|
+
1, INT_MAX});
|
2651
2552
|
if (is_client) {
|
2652
2553
|
g_default_client_keepalive_time_ms = value;
|
2653
2554
|
} else {
|
@@ -2656,8 +2557,9 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
|
|
2656
2557
|
} else if (0 ==
|
2657
2558
|
strcmp(args->args[i].key, GRPC_ARG_KEEPALIVE_TIMEOUT_MS)) {
|
2658
2559
|
const int value = grpc_channel_arg_get_integer(
|
2659
|
-
&args->args[i],
|
2660
|
-
|
2560
|
+
&args->args[i], {is_client ? g_default_client_keepalive_timeout_ms
|
2561
|
+
: g_default_server_keepalive_timeout_ms,
|
2562
|
+
0, INT_MAX});
|
2661
2563
|
if (is_client) {
|
2662
2564
|
g_default_client_keepalive_timeout_ms = value;
|
2663
2565
|
} else {
|
@@ -2665,10 +2567,16 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
|
|
2665
2567
|
}
|
2666
2568
|
} else if (0 == strcmp(args->args[i].key,
|
2667
2569
|
GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS)) {
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2570
|
+
const bool value = (uint32_t)grpc_channel_arg_get_integer(
|
2571
|
+
&args->args[i],
|
2572
|
+
{is_client ? g_default_client_keepalive_permit_without_calls
|
2573
|
+
: g_default_server_keepalive_timeout_ms,
|
2574
|
+
0, 1});
|
2575
|
+
if (is_client) {
|
2576
|
+
g_default_client_keepalive_permit_without_calls = value;
|
2577
|
+
} else {
|
2578
|
+
g_default_server_keepalive_permit_without_calls = value;
|
2579
|
+
}
|
2672
2580
|
} else if (0 ==
|
2673
2581
|
strcmp(args->args[i].key, GRPC_ARG_HTTP2_MAX_PING_STRIKES)) {
|
2674
2582
|
g_default_max_ping_strikes = grpc_channel_arg_get_integer(
|
@@ -2698,8 +2606,7 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
|
|
2698
2606
|
}
|
2699
2607
|
}
|
2700
2608
|
|
2701
|
-
static void init_keepalive_ping_locked(
|
2702
|
-
grpc_error* error) {
|
2609
|
+
static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
|
2703
2610
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
|
2704
2611
|
GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING);
|
2705
2612
|
if (t->destroying || t->closed_with_error != GRPC_ERROR_NONE) {
|
@@ -2709,59 +2616,55 @@ static void init_keepalive_ping_locked(grpc_exec_ctx* exec_ctx, void* arg,
|
|
2709
2616
|
grpc_chttp2_stream_map_size(&t->stream_map) > 0) {
|
2710
2617
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_PINGING;
|
2711
2618
|
GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive ping end");
|
2712
|
-
send_ping_locked(
|
2619
|
+
send_ping_locked(t, &t->start_keepalive_ping_locked,
|
2713
2620
|
&t->finish_keepalive_ping_locked);
|
2714
|
-
grpc_chttp2_initiate_write(
|
2715
|
-
GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING);
|
2621
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING);
|
2716
2622
|
} else {
|
2717
2623
|
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
|
2718
|
-
grpc_timer_init(
|
2719
|
-
|
2624
|
+
grpc_timer_init(&t->keepalive_ping_timer,
|
2625
|
+
grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
|
2720
2626
|
&t->init_keepalive_ping_locked);
|
2721
2627
|
}
|
2722
2628
|
} else if (error == GRPC_ERROR_CANCELLED) {
|
2723
2629
|
/* The keepalive ping timer may be cancelled by bdp */
|
2724
2630
|
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
|
2725
|
-
grpc_timer_init(
|
2726
|
-
|
2631
|
+
grpc_timer_init(&t->keepalive_ping_timer,
|
2632
|
+
grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
|
2727
2633
|
&t->init_keepalive_ping_locked);
|
2728
2634
|
}
|
2729
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
2635
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "init keepalive ping");
|
2730
2636
|
}
|
2731
2637
|
|
2732
|
-
static void start_keepalive_ping_locked(
|
2733
|
-
grpc_error* error) {
|
2638
|
+
static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
|
2734
2639
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
|
2735
2640
|
GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog");
|
2736
|
-
grpc_timer_init(
|
2737
|
-
|
2641
|
+
grpc_timer_init(&t->keepalive_watchdog_timer,
|
2642
|
+
grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
|
2738
2643
|
&t->keepalive_watchdog_fired_locked);
|
2739
2644
|
}
|
2740
2645
|
|
2741
|
-
static void finish_keepalive_ping_locked(
|
2742
|
-
grpc_error* error) {
|
2646
|
+
static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
|
2743
2647
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
|
2744
2648
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2745
2649
|
if (error == GRPC_ERROR_NONE) {
|
2746
2650
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
|
2747
|
-
grpc_timer_cancel(
|
2651
|
+
grpc_timer_cancel(&t->keepalive_watchdog_timer);
|
2748
2652
|
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
|
2749
|
-
grpc_timer_init(
|
2750
|
-
|
2653
|
+
grpc_timer_init(&t->keepalive_ping_timer,
|
2654
|
+
grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
|
2751
2655
|
&t->init_keepalive_ping_locked);
|
2752
2656
|
}
|
2753
2657
|
}
|
2754
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
2658
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "keepalive ping end");
|
2755
2659
|
}
|
2756
2660
|
|
2757
|
-
static void keepalive_watchdog_fired_locked(
|
2758
|
-
grpc_error* error) {
|
2661
|
+
static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
|
2759
2662
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
|
2760
2663
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2761
2664
|
if (error == GRPC_ERROR_NONE) {
|
2762
2665
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
|
2763
2666
|
close_transport_locked(
|
2764
|
-
|
2667
|
+
t,
|
2765
2668
|
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2766
2669
|
"keepalive watchdog timeout"),
|
2767
2670
|
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_INTERNAL));
|
@@ -2774,71 +2677,67 @@ static void keepalive_watchdog_fired_locked(grpc_exec_ctx* exec_ctx, void* arg,
|
|
2774
2677
|
t->keepalive_state, GRPC_CHTTP2_KEEPALIVE_STATE_PINGING);
|
2775
2678
|
}
|
2776
2679
|
}
|
2777
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
2680
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "keepalive watchdog");
|
2778
2681
|
}
|
2779
2682
|
|
2780
2683
|
/*******************************************************************************
|
2781
2684
|
* CALLBACK LOOP
|
2782
2685
|
*/
|
2783
2686
|
|
2784
|
-
static void connectivity_state_set(
|
2785
|
-
grpc_chttp2_transport* t,
|
2687
|
+
static void connectivity_state_set(grpc_chttp2_transport* t,
|
2786
2688
|
grpc_connectivity_state state,
|
2787
2689
|
grpc_error* error, const char* reason) {
|
2788
2690
|
GRPC_CHTTP2_IF_TRACING(
|
2789
2691
|
gpr_log(GPR_DEBUG, "set connectivity_state=%d", state));
|
2790
|
-
grpc_connectivity_state_set(
|
2791
|
-
|
2692
|
+
grpc_connectivity_state_set(&t->channel_callback.state_tracker, state, error,
|
2693
|
+
reason);
|
2792
2694
|
}
|
2793
2695
|
|
2794
2696
|
/*******************************************************************************
|
2795
2697
|
* POLLSET STUFF
|
2796
2698
|
*/
|
2797
2699
|
|
2798
|
-
static void set_pollset(
|
2799
|
-
|
2700
|
+
static void set_pollset(grpc_transport* gt, grpc_stream* gs,
|
2701
|
+
grpc_pollset* pollset) {
|
2800
2702
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
|
2801
|
-
grpc_endpoint_add_to_pollset(
|
2703
|
+
grpc_endpoint_add_to_pollset(t->ep, pollset);
|
2802
2704
|
}
|
2803
2705
|
|
2804
|
-
static void set_pollset_set(
|
2805
|
-
|
2706
|
+
static void set_pollset_set(grpc_transport* gt, grpc_stream* gs,
|
2707
|
+
grpc_pollset_set* pollset_set) {
|
2806
2708
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
|
2807
|
-
grpc_endpoint_add_to_pollset_set(
|
2709
|
+
grpc_endpoint_add_to_pollset_set(t->ep, pollset_set);
|
2808
2710
|
}
|
2809
2711
|
|
2810
2712
|
/*******************************************************************************
|
2811
2713
|
* BYTE STREAM
|
2812
2714
|
*/
|
2813
2715
|
|
2814
|
-
static void reset_byte_stream(
|
2815
|
-
grpc_error* error) {
|
2716
|
+
static void reset_byte_stream(void* arg, grpc_error* error) {
|
2816
2717
|
grpc_chttp2_stream* s = (grpc_chttp2_stream*)arg;
|
2817
2718
|
|
2818
2719
|
s->pending_byte_stream = false;
|
2819
2720
|
if (error == GRPC_ERROR_NONE) {
|
2820
|
-
grpc_chttp2_maybe_complete_recv_message(
|
2821
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(
|
2721
|
+
grpc_chttp2_maybe_complete_recv_message(s->t, s);
|
2722
|
+
grpc_chttp2_maybe_complete_recv_trailing_metadata(s->t, s);
|
2822
2723
|
} else {
|
2823
2724
|
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
2824
|
-
GRPC_CLOSURE_SCHED(
|
2725
|
+
GRPC_CLOSURE_SCHED(s->on_next, GRPC_ERROR_REF(error));
|
2825
2726
|
s->on_next = nullptr;
|
2826
2727
|
GRPC_ERROR_UNREF(s->byte_stream_error);
|
2827
2728
|
s->byte_stream_error = GRPC_ERROR_NONE;
|
2828
|
-
grpc_chttp2_cancel_stream(
|
2729
|
+
grpc_chttp2_cancel_stream(s->t, s, GRPC_ERROR_REF(error));
|
2829
2730
|
s->byte_stream_error = GRPC_ERROR_REF(error);
|
2830
2731
|
}
|
2831
2732
|
}
|
2832
2733
|
|
2833
|
-
static void incoming_byte_stream_unref(
|
2834
|
-
grpc_chttp2_incoming_byte_stream* bs) {
|
2734
|
+
static void incoming_byte_stream_unref(grpc_chttp2_incoming_byte_stream* bs) {
|
2835
2735
|
if (gpr_unref(&bs->refs)) {
|
2836
2736
|
gpr_free(bs);
|
2837
2737
|
}
|
2838
2738
|
}
|
2839
2739
|
|
2840
|
-
static void incoming_byte_stream_next_locked(
|
2841
|
-
void* argp,
|
2740
|
+
static void incoming_byte_stream_next_locked(void* argp,
|
2842
2741
|
grpc_error* error_ignored) {
|
2843
2742
|
grpc_chttp2_incoming_byte_stream* bs =
|
2844
2743
|
(grpc_chttp2_incoming_byte_stream*)argp;
|
@@ -2849,30 +2748,29 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx* exec_ctx,
|
|
2849
2748
|
if (!s->read_closed) {
|
2850
2749
|
s->flow_control->IncomingByteStreamUpdate(bs->next_action.max_size_hint,
|
2851
2750
|
cur_length);
|
2852
|
-
grpc_chttp2_act_on_flowctl_action(
|
2853
|
-
t, s);
|
2751
|
+
grpc_chttp2_act_on_flowctl_action(s->flow_control->MakeAction(), t, s);
|
2854
2752
|
}
|
2855
2753
|
GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0);
|
2856
2754
|
if (s->frame_storage.length > 0) {
|
2857
2755
|
grpc_slice_buffer_swap(&s->frame_storage,
|
2858
2756
|
&s->unprocessed_incoming_frames_buffer);
|
2859
2757
|
s->unprocessed_incoming_frames_decompressed = false;
|
2860
|
-
GRPC_CLOSURE_SCHED(
|
2758
|
+
GRPC_CLOSURE_SCHED(bs->next_action.on_complete, GRPC_ERROR_NONE);
|
2861
2759
|
} else if (s->byte_stream_error != GRPC_ERROR_NONE) {
|
2862
|
-
GRPC_CLOSURE_SCHED(
|
2760
|
+
GRPC_CLOSURE_SCHED(bs->next_action.on_complete,
|
2863
2761
|
GRPC_ERROR_REF(s->byte_stream_error));
|
2864
2762
|
if (s->data_parser.parsing_frame != nullptr) {
|
2865
|
-
incoming_byte_stream_unref(
|
2763
|
+
incoming_byte_stream_unref(s->data_parser.parsing_frame);
|
2866
2764
|
s->data_parser.parsing_frame = nullptr;
|
2867
2765
|
}
|
2868
2766
|
} else if (s->read_closed) {
|
2869
2767
|
if (bs->remaining_bytes != 0) {
|
2870
2768
|
s->byte_stream_error =
|
2871
2769
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
2872
|
-
GRPC_CLOSURE_SCHED(
|
2770
|
+
GRPC_CLOSURE_SCHED(bs->next_action.on_complete,
|
2873
2771
|
GRPC_ERROR_REF(s->byte_stream_error));
|
2874
2772
|
if (s->data_parser.parsing_frame != nullptr) {
|
2875
|
-
incoming_byte_stream_unref(
|
2773
|
+
incoming_byte_stream_unref(s->data_parser.parsing_frame);
|
2876
2774
|
s->data_parser.parsing_frame = nullptr;
|
2877
2775
|
}
|
2878
2776
|
} else {
|
@@ -2882,11 +2780,10 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx* exec_ctx,
|
|
2882
2780
|
} else {
|
2883
2781
|
s->on_next = bs->next_action.on_complete;
|
2884
2782
|
}
|
2885
|
-
incoming_byte_stream_unref(
|
2783
|
+
incoming_byte_stream_unref(bs);
|
2886
2784
|
}
|
2887
2785
|
|
2888
|
-
static bool incoming_byte_stream_next(
|
2889
|
-
grpc_byte_stream* byte_stream,
|
2786
|
+
static bool incoming_byte_stream_next(grpc_byte_stream* byte_stream,
|
2890
2787
|
size_t max_size_hint,
|
2891
2788
|
grpc_closure* on_complete) {
|
2892
2789
|
GPR_TIMER_BEGIN("incoming_byte_stream_next", 0);
|
@@ -2901,7 +2798,6 @@ static bool incoming_byte_stream_next(grpc_exec_ctx* exec_ctx,
|
|
2901
2798
|
bs->next_action.max_size_hint = max_size_hint;
|
2902
2799
|
bs->next_action.on_complete = on_complete;
|
2903
2800
|
GRPC_CLOSURE_SCHED(
|
2904
|
-
exec_ctx,
|
2905
2801
|
GRPC_CLOSURE_INIT(&bs->next_action.closure,
|
2906
2802
|
incoming_byte_stream_next_locked, bs,
|
2907
2803
|
grpc_combiner_scheduler(bs->transport->combiner)),
|
@@ -2911,8 +2807,7 @@ static bool incoming_byte_stream_next(grpc_exec_ctx* exec_ctx,
|
|
2911
2807
|
}
|
2912
2808
|
}
|
2913
2809
|
|
2914
|
-
static grpc_error* incoming_byte_stream_pull(
|
2915
|
-
grpc_byte_stream* byte_stream,
|
2810
|
+
static grpc_error* incoming_byte_stream_pull(grpc_byte_stream* byte_stream,
|
2916
2811
|
grpc_slice* slice) {
|
2917
2812
|
GPR_TIMER_BEGIN("incoming_byte_stream_pull", 0);
|
2918
2813
|
grpc_chttp2_incoming_byte_stream* bs =
|
@@ -2948,31 +2843,28 @@ static grpc_error* incoming_byte_stream_pull(grpc_exec_ctx* exec_ctx,
|
|
2948
2843
|
}
|
2949
2844
|
}
|
2950
2845
|
error = grpc_deframe_unprocessed_incoming_frames(
|
2951
|
-
|
2952
|
-
|
2846
|
+
&s->data_parser, s, &s->unprocessed_incoming_frames_buffer, slice,
|
2847
|
+
nullptr);
|
2953
2848
|
if (error != GRPC_ERROR_NONE) {
|
2954
2849
|
return error;
|
2955
2850
|
}
|
2956
2851
|
} else {
|
2957
2852
|
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
2958
|
-
GRPC_CLOSURE_SCHED(
|
2853
|
+
GRPC_CLOSURE_SCHED(&s->reset_byte_stream, GRPC_ERROR_REF(error));
|
2959
2854
|
return error;
|
2960
2855
|
}
|
2961
2856
|
GPR_TIMER_END("incoming_byte_stream_pull", 0);
|
2962
2857
|
return GRPC_ERROR_NONE;
|
2963
2858
|
}
|
2964
2859
|
|
2965
|
-
static void incoming_byte_stream_destroy_locked(
|
2966
|
-
void* byte_stream,
|
2860
|
+
static void incoming_byte_stream_destroy_locked(void* byte_stream,
|
2967
2861
|
grpc_error* error_ignored);
|
2968
2862
|
|
2969
|
-
static void incoming_byte_stream_destroy(
|
2970
|
-
grpc_byte_stream* byte_stream) {
|
2863
|
+
static void incoming_byte_stream_destroy(grpc_byte_stream* byte_stream) {
|
2971
2864
|
GPR_TIMER_BEGIN("incoming_byte_stream_destroy", 0);
|
2972
2865
|
grpc_chttp2_incoming_byte_stream* bs =
|
2973
2866
|
(grpc_chttp2_incoming_byte_stream*)byte_stream;
|
2974
2867
|
GRPC_CLOSURE_SCHED(
|
2975
|
-
exec_ctx,
|
2976
2868
|
GRPC_CLOSURE_INIT(&bs->destroy_action,
|
2977
2869
|
incoming_byte_stream_destroy_locked, bs,
|
2978
2870
|
grpc_combiner_scheduler(bs->transport->combiner)),
|
@@ -2981,30 +2873,28 @@ static void incoming_byte_stream_destroy(grpc_exec_ctx* exec_ctx,
|
|
2981
2873
|
}
|
2982
2874
|
|
2983
2875
|
static void incoming_byte_stream_publish_error(
|
2984
|
-
|
2985
|
-
grpc_error* error) {
|
2876
|
+
grpc_chttp2_incoming_byte_stream* bs, grpc_error* error) {
|
2986
2877
|
grpc_chttp2_stream* s = bs->stream;
|
2987
2878
|
|
2988
2879
|
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
2989
|
-
GRPC_CLOSURE_SCHED(
|
2880
|
+
GRPC_CLOSURE_SCHED(s->on_next, GRPC_ERROR_REF(error));
|
2990
2881
|
s->on_next = nullptr;
|
2991
2882
|
GRPC_ERROR_UNREF(s->byte_stream_error);
|
2992
2883
|
s->byte_stream_error = GRPC_ERROR_REF(error);
|
2993
|
-
grpc_chttp2_cancel_stream(
|
2994
|
-
GRPC_ERROR_REF(error));
|
2884
|
+
grpc_chttp2_cancel_stream(bs->transport, bs->stream, GRPC_ERROR_REF(error));
|
2995
2885
|
}
|
2996
2886
|
|
2997
2887
|
grpc_error* grpc_chttp2_incoming_byte_stream_push(
|
2998
|
-
|
2999
|
-
grpc_slice
|
2888
|
+
grpc_chttp2_incoming_byte_stream* bs, grpc_slice slice,
|
2889
|
+
grpc_slice* slice_out) {
|
3000
2890
|
grpc_chttp2_stream* s = bs->stream;
|
3001
2891
|
|
3002
2892
|
if (bs->remaining_bytes < GRPC_SLICE_LENGTH(slice)) {
|
3003
2893
|
grpc_error* error =
|
3004
2894
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream");
|
3005
2895
|
|
3006
|
-
GRPC_CLOSURE_SCHED(
|
3007
|
-
grpc_slice_unref_internal(
|
2896
|
+
GRPC_CLOSURE_SCHED(&s->reset_byte_stream, GRPC_ERROR_REF(error));
|
2897
|
+
grpc_slice_unref_internal(slice);
|
3008
2898
|
return error;
|
3009
2899
|
} else {
|
3010
2900
|
bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice);
|
@@ -3016,8 +2906,8 @@ grpc_error* grpc_chttp2_incoming_byte_stream_push(
|
|
3016
2906
|
}
|
3017
2907
|
|
3018
2908
|
grpc_error* grpc_chttp2_incoming_byte_stream_finished(
|
3019
|
-
|
3020
|
-
|
2909
|
+
grpc_chttp2_incoming_byte_stream* bs, grpc_error* error,
|
2910
|
+
bool reset_on_error) {
|
3021
2911
|
grpc_chttp2_stream* s = bs->stream;
|
3022
2912
|
|
3023
2913
|
if (error == GRPC_ERROR_NONE) {
|
@@ -3026,27 +2916,25 @@ grpc_error* grpc_chttp2_incoming_byte_stream_finished(
|
|
3026
2916
|
}
|
3027
2917
|
}
|
3028
2918
|
if (error != GRPC_ERROR_NONE && reset_on_error) {
|
3029
|
-
GRPC_CLOSURE_SCHED(
|
2919
|
+
GRPC_CLOSURE_SCHED(&s->reset_byte_stream, GRPC_ERROR_REF(error));
|
3030
2920
|
}
|
3031
|
-
incoming_byte_stream_unref(
|
2921
|
+
incoming_byte_stream_unref(bs);
|
3032
2922
|
return error;
|
3033
2923
|
}
|
3034
2924
|
|
3035
|
-
static void incoming_byte_stream_shutdown(
|
3036
|
-
grpc_byte_stream* byte_stream,
|
2925
|
+
static void incoming_byte_stream_shutdown(grpc_byte_stream* byte_stream,
|
3037
2926
|
grpc_error* error) {
|
3038
2927
|
grpc_chttp2_incoming_byte_stream* bs =
|
3039
2928
|
(grpc_chttp2_incoming_byte_stream*)byte_stream;
|
3040
2929
|
GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished(
|
3041
|
-
|
2930
|
+
bs, error, true /* reset_on_error */));
|
3042
2931
|
}
|
3043
2932
|
|
3044
2933
|
static const grpc_byte_stream_vtable grpc_chttp2_incoming_byte_stream_vtable = {
|
3045
2934
|
incoming_byte_stream_next, incoming_byte_stream_pull,
|
3046
2935
|
incoming_byte_stream_shutdown, incoming_byte_stream_destroy};
|
3047
2936
|
|
3048
|
-
static void incoming_byte_stream_destroy_locked(
|
3049
|
-
void* byte_stream,
|
2937
|
+
static void incoming_byte_stream_destroy_locked(void* byte_stream,
|
3050
2938
|
grpc_error* error_ignored) {
|
3051
2939
|
grpc_chttp2_incoming_byte_stream* bs =
|
3052
2940
|
(grpc_chttp2_incoming_byte_stream*)byte_stream;
|
@@ -3054,15 +2942,15 @@ static void incoming_byte_stream_destroy_locked(grpc_exec_ctx* exec_ctx,
|
|
3054
2942
|
grpc_chttp2_transport* t = s->t;
|
3055
2943
|
|
3056
2944
|
GPR_ASSERT(bs->base.vtable == &grpc_chttp2_incoming_byte_stream_vtable);
|
3057
|
-
incoming_byte_stream_unref(
|
2945
|
+
incoming_byte_stream_unref(bs);
|
3058
2946
|
s->pending_byte_stream = false;
|
3059
|
-
grpc_chttp2_maybe_complete_recv_message(
|
3060
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(
|
2947
|
+
grpc_chttp2_maybe_complete_recv_message(t, s);
|
2948
|
+
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
3061
2949
|
}
|
3062
2950
|
|
3063
2951
|
grpc_chttp2_incoming_byte_stream* grpc_chttp2_incoming_byte_stream_create(
|
3064
|
-
|
3065
|
-
uint32_t
|
2952
|
+
grpc_chttp2_transport* t, grpc_chttp2_stream* s, uint32_t frame_size,
|
2953
|
+
uint32_t flags) {
|
3066
2954
|
grpc_chttp2_incoming_byte_stream* incoming_byte_stream =
|
3067
2955
|
(grpc_chttp2_incoming_byte_stream*)gpr_malloc(
|
3068
2956
|
sizeof(*incoming_byte_stream));
|
@@ -3082,30 +2970,25 @@ grpc_chttp2_incoming_byte_stream* grpc_chttp2_incoming_byte_stream_create(
|
|
3082
2970
|
* RESOURCE QUOTAS
|
3083
2971
|
*/
|
3084
2972
|
|
3085
|
-
static void post_benign_reclaimer(
|
3086
|
-
grpc_chttp2_transport* t) {
|
2973
|
+
static void post_benign_reclaimer(grpc_chttp2_transport* t) {
|
3087
2974
|
if (!t->benign_reclaimer_registered) {
|
3088
2975
|
t->benign_reclaimer_registered = true;
|
3089
2976
|
GRPC_CHTTP2_REF_TRANSPORT(t, "benign_reclaimer");
|
3090
|
-
grpc_resource_user_post_reclaimer(
|
3091
|
-
grpc_endpoint_get_resource_user(t->ep),
|
2977
|
+
grpc_resource_user_post_reclaimer(grpc_endpoint_get_resource_user(t->ep),
|
3092
2978
|
false, &t->benign_reclaimer_locked);
|
3093
2979
|
}
|
3094
2980
|
}
|
3095
2981
|
|
3096
|
-
static void post_destructive_reclaimer(
|
3097
|
-
grpc_chttp2_transport* t) {
|
2982
|
+
static void post_destructive_reclaimer(grpc_chttp2_transport* t) {
|
3098
2983
|
if (!t->destructive_reclaimer_registered) {
|
3099
2984
|
t->destructive_reclaimer_registered = true;
|
3100
2985
|
GRPC_CHTTP2_REF_TRANSPORT(t, "destructive_reclaimer");
|
3101
|
-
grpc_resource_user_post_reclaimer(
|
3102
|
-
grpc_endpoint_get_resource_user(t->ep),
|
2986
|
+
grpc_resource_user_post_reclaimer(grpc_endpoint_get_resource_user(t->ep),
|
3103
2987
|
true, &t->destructive_reclaimer_locked);
|
3104
2988
|
}
|
3105
2989
|
}
|
3106
2990
|
|
3107
|
-
static void benign_reclaimer_locked(
|
3108
|
-
grpc_error* error) {
|
2991
|
+
static void benign_reclaimer_locked(void* arg, grpc_error* error) {
|
3109
2992
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
|
3110
2993
|
if (error == GRPC_ERROR_NONE &&
|
3111
2994
|
grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
@@ -3115,7 +2998,7 @@ static void benign_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
|
|
3115
2998
|
gpr_log(GPR_DEBUG, "HTTP2: %s - send goaway to free memory",
|
3116
2999
|
t->peer_string);
|
3117
3000
|
}
|
3118
|
-
send_goaway(
|
3001
|
+
send_goaway(t,
|
3119
3002
|
grpc_error_set_int(
|
3120
3003
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Buffers full"),
|
3121
3004
|
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM));
|
@@ -3128,13 +3011,12 @@ static void benign_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
|
|
3128
3011
|
t->benign_reclaimer_registered = false;
|
3129
3012
|
if (error != GRPC_ERROR_CANCELLED) {
|
3130
3013
|
grpc_resource_user_finish_reclamation(
|
3131
|
-
|
3014
|
+
grpc_endpoint_get_resource_user(t->ep));
|
3132
3015
|
}
|
3133
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
3016
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
|
3134
3017
|
}
|
3135
3018
|
|
3136
|
-
static void destructive_reclaimer_locked(
|
3137
|
-
grpc_error* error) {
|
3019
|
+
static void destructive_reclaimer_locked(void* arg, grpc_error* error) {
|
3138
3020
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
|
3139
3021
|
size_t n = grpc_chttp2_stream_map_size(&t->stream_map);
|
3140
3022
|
t->destructive_reclaimer_registered = false;
|
@@ -3146,7 +3028,7 @@ static void destructive_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
|
|
3146
3028
|
s->id);
|
3147
3029
|
}
|
3148
3030
|
grpc_chttp2_cancel_stream(
|
3149
|
-
|
3031
|
+
t, s,
|
3150
3032
|
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Buffers full"),
|
3151
3033
|
GRPC_ERROR_INT_HTTP2_ERROR,
|
3152
3034
|
GRPC_HTTP2_ENHANCE_YOUR_CALM));
|
@@ -3155,14 +3037,14 @@ static void destructive_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
|
|
3155
3037
|
there are more streams left, we can immediately post a new
|
3156
3038
|
reclaimer in case the resource quota needs to free more
|
3157
3039
|
memory */
|
3158
|
-
post_destructive_reclaimer(
|
3040
|
+
post_destructive_reclaimer(t);
|
3159
3041
|
}
|
3160
3042
|
}
|
3161
3043
|
if (error != GRPC_ERROR_CANCELLED) {
|
3162
3044
|
grpc_resource_user_finish_reclamation(
|
3163
|
-
|
3045
|
+
grpc_endpoint_get_resource_user(t->ep));
|
3164
3046
|
}
|
3165
|
-
GRPC_CHTTP2_UNREF_TRANSPORT(
|
3047
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(t, "destructive_reclaimer");
|
3166
3048
|
}
|
3167
3049
|
|
3168
3050
|
/*******************************************************************************
|
@@ -3216,8 +3098,7 @@ const char* grpc_chttp2_initiate_write_reason_string(
|
|
3216
3098
|
GPR_UNREACHABLE_CODE(return "unknown");
|
3217
3099
|
}
|
3218
3100
|
|
3219
|
-
static grpc_endpoint* chttp2_get_endpoint(
|
3220
|
-
grpc_transport* t) {
|
3101
|
+
static grpc_endpoint* chttp2_get_endpoint(grpc_transport* t) {
|
3221
3102
|
return ((grpc_chttp2_transport*)t)->ep;
|
3222
3103
|
}
|
3223
3104
|
|
@@ -3235,17 +3116,16 @@ static const grpc_transport_vtable vtable = {sizeof(grpc_chttp2_stream),
|
|
3235
3116
|
static const grpc_transport_vtable* get_vtable(void) { return &vtable; }
|
3236
3117
|
|
3237
3118
|
grpc_transport* grpc_create_chttp2_transport(
|
3238
|
-
|
3239
|
-
grpc_endpoint* ep, bool is_client) {
|
3119
|
+
const grpc_channel_args* channel_args, grpc_endpoint* ep, bool is_client) {
|
3240
3120
|
grpc_chttp2_transport* t =
|
3241
3121
|
(grpc_chttp2_transport*)gpr_zalloc(sizeof(grpc_chttp2_transport));
|
3242
|
-
init_transport(
|
3122
|
+
init_transport(t, channel_args, ep, is_client);
|
3243
3123
|
return &t->base;
|
3244
3124
|
}
|
3245
3125
|
|
3246
3126
|
void grpc_chttp2_transport_start_reading(
|
3247
|
-
|
3248
|
-
|
3127
|
+
grpc_transport* transport, grpc_slice_buffer* read_buffer,
|
3128
|
+
grpc_closure* notify_on_receive_settings) {
|
3249
3129
|
grpc_chttp2_transport* t = (grpc_chttp2_transport*)transport;
|
3250
3130
|
GRPC_CHTTP2_REF_TRANSPORT(
|
3251
3131
|
t, "reading_action"); /* matches unref inside reading_action */
|
@@ -3254,5 +3134,5 @@ void grpc_chttp2_transport_start_reading(
|
|
3254
3134
|
gpr_free(read_buffer);
|
3255
3135
|
}
|
3256
3136
|
t->notify_on_receive_settings = notify_on_receive_settings;
|
3257
|
-
GRPC_CLOSURE_SCHED(
|
3137
|
+
GRPC_CLOSURE_SCHED(&t->read_action_locked, GRPC_ERROR_NONE);
|
3258
3138
|
}
|