grpc 1.18.0 → 1.22.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +4731 -7404
- data/etc/roots.pem +146 -0
- data/include/grpc/grpc.h +11 -6
- data/include/grpc/grpc_security.h +297 -4
- data/include/grpc/grpc_security_constants.h +1 -1
- data/include/grpc/impl/codegen/byte_buffer.h +13 -0
- data/include/grpc/impl/codegen/gpr_types.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +30 -7
- data/include/grpc/impl/codegen/port_platform.h +88 -7
- data/include/grpc/impl/codegen/slice.h +2 -22
- data/include/grpc/impl/codegen/status.h +2 -1
- data/include/grpc/impl/codegen/sync_posix.h +18 -0
- data/include/grpc/slice.h +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +21 -16
- data/src/core/ext/filters/client_channel/backup_poller.h +8 -2
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +3 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +2435 -1557
- data/src/core/ext/filters/client_channel/client_channel.h +2 -10
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +6 -89
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +8 -33
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +22 -34
- data/src/core/ext/filters/client_channel/client_channel_factory.h +19 -38
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +9 -11
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +179 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +68 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +59 -55
- data/src/core/ext/filters/client_channel/health/health_check_client.h +20 -9
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +146 -157
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +29 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +844 -859
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +2 -6
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +14 -12
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +16 -12
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +185 -312
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +143 -375
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +192 -245
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +1554 -955
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +0 -43
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +14 -10
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +2 -2
- data/src/core/ext/filters/client_channel/lb_policy.cc +115 -22
- data/src/core/ext/filters/client_channel/lb_policy.h +260 -129
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +5 -2
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +107 -4
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +10 -3
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +96 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +56 -0
- data/src/core/ext/filters/client_channel/parse_address.cc +24 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +121 -122
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +84 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +179 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +24 -10
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +111 -47
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +7 -13
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +39 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc +0 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +2 -64
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc +28 -0
- data/src/core/{lib/iomgr/network_status_tracker.cc → ext/filters/client_channel/resolver/dns/dns_resolver_selection.h} +8 -15
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +36 -82
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +111 -72
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +13 -8
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +28 -63
- data/src/core/ext/filters/client_channel/resolver.cc +54 -1
- data/src/core/ext/filters/client_channel/resolver.h +52 -23
- data/src/core/ext/filters/client_channel/resolver_factory.h +3 -1
- data/src/core/ext/filters/client_channel/resolver_registry.cc +5 -2
- data/src/core/ext/filters/client_channel/resolver_registry.h +5 -4
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +368 -241
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +58 -76
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +543 -0
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +139 -0
- data/src/core/ext/filters/client_channel/server_address.cc +4 -54
- data/src/core/ext/filters/client_channel/server_address.h +1 -13
- data/src/core/ext/filters/client_channel/service_config.cc +329 -0
- data/src/core/ext/filters/client_channel/service_config.h +205 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +803 -838
- data/src/core/ext/filters/client_channel/subchannel.h +295 -128
- data/src/core/ext/filters/client_channel/subchannel_interface.h +113 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +97 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +94 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +3 -4
- data/src/core/ext/filters/deadline/deadline_filter.h +3 -2
- data/src/core/ext/filters/http/client/http_client_filter.cc +7 -5
- data/src/core/ext/filters/http/client/http_client_filter.h +1 -1
- data/src/core/ext/filters/http/client_authority_filter.cc +6 -3
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +4 -3
- data/src/core/ext/filters/http/server/http_server_filter.cc +18 -12
- data/src/core/ext/filters/max_age/max_age_filter.cc +5 -2
- data/src/core/ext/filters/message_size/message_size_filter.cc +119 -77
- data/src/core/ext/filters/message_size/message_size_filter.h +33 -0
- data/src/core/ext/transport/chttp2/alpn/alpn.h +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +13 -12
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +45 -47
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +134 -143
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +68 -21
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +4 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +9 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +156 -94
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +33 -37
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +6 -5
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -4
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +8 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -4
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +74 -55
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +33 -11
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -2
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +7 -14
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +10 -1
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +9 -5
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +9 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +43 -30
- data/src/core/ext/transport/chttp2/transport/parsing.cc +52 -70
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +70 -33
- data/src/core/ext/transport/inproc/inproc_transport.cc +26 -18
- data/src/core/lib/channel/channel_args.cc +2 -101
- data/src/core/lib/channel/channel_args.h +3 -37
- data/src/core/lib/channel/channel_stack.h +10 -6
- data/src/core/lib/channel/channel_trace.cc +4 -4
- data/src/core/lib/channel/channel_trace.h +4 -4
- data/src/core/lib/channel/channelz.cc +168 -38
- data/src/core/lib/channel/channelz.h +40 -44
- data/src/core/lib/channel/channelz_registry.cc +75 -107
- data/src/core/lib/channel/channelz_registry.h +10 -28
- data/src/core/lib/channel/connected_channel.cc +2 -2
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/channel/handshaker.cc +151 -218
- data/src/core/lib/channel/handshaker.h +110 -101
- data/src/core/lib/channel/handshaker_factory.h +11 -19
- data/src/core/lib/channel/handshaker_registry.cc +67 -51
- data/src/core/lib/channel/handshaker_registry.h +21 -16
- data/src/core/lib/compression/algorithm_metadata.h +3 -3
- data/src/core/lib/compression/compression.cc +14 -9
- data/src/core/lib/compression/compression_args.cc +127 -0
- data/src/core/lib/compression/compression_args.h +55 -0
- data/src/core/lib/compression/compression_internal.cc +16 -12
- data/src/core/lib/compression/compression_internal.h +1 -1
- data/src/core/lib/compression/stream_compression.cc +3 -2
- data/src/core/lib/compression/stream_compression.h +2 -2
- data/src/core/lib/compression/stream_compression_gzip.cc +9 -9
- data/src/core/lib/debug/trace.cc +13 -7
- data/src/core/lib/debug/trace.h +14 -1
- data/src/core/lib/gpr/arena.h +13 -9
- data/src/core/lib/gpr/cpu_posix.cc +5 -3
- data/src/core/lib/gpr/env.h +3 -6
- data/src/core/lib/gpr/env_linux.cc +6 -1
- data/src/core/lib/gpr/env_posix.cc +5 -0
- data/src/core/lib/gpr/env_windows.cc +7 -5
- data/src/core/lib/gpr/log.cc +9 -13
- data/src/core/lib/gpr/log_posix.cc +2 -1
- data/src/core/lib/gpr/string.cc +20 -7
- data/src/core/lib/gpr/string.h +10 -3
- data/src/core/lib/gpr/sync_posix.cc +65 -4
- data/src/core/lib/gpr/time.cc +8 -0
- data/src/core/lib/gpr/time_posix.cc +21 -2
- data/src/core/lib/gprpp/arena.cc +103 -0
- data/src/core/lib/gprpp/arena.h +121 -0
- data/src/core/lib/gprpp/atomic.h +75 -5
- data/src/core/lib/gprpp/fork.cc +13 -32
- data/src/core/lib/gprpp/fork.h +5 -1
- data/src/core/lib/gprpp/global_config.h +96 -0
- data/src/core/lib/gprpp/global_config_custom.h +29 -0
- data/src/core/lib/gprpp/global_config_env.cc +135 -0
- data/src/core/lib/gprpp/global_config_env.h +131 -0
- data/src/core/lib/gprpp/global_config_generic.h +44 -0
- data/src/core/lib/gprpp/inlined_vector.h +8 -0
- data/src/core/lib/gprpp/map.h +436 -0
- data/src/core/lib/gprpp/memory.h +2 -2
- data/src/core/lib/gprpp/optional.h +48 -0
- data/src/core/lib/gprpp/orphanable.h +6 -5
- data/src/core/lib/gprpp/{mutex_lock.h → pair.h} +15 -19
- data/src/core/lib/gprpp/ref_counted.h +36 -17
- data/src/core/lib/gprpp/sync.h +126 -0
- data/src/core/lib/gprpp/thd.h +42 -7
- data/src/core/lib/gprpp/thd_posix.cc +31 -13
- data/src/core/lib/gprpp/thd_windows.cc +47 -34
- data/src/core/lib/http/httpcli.cc +6 -5
- data/src/core/lib/http/httpcli_security_connector.cc +13 -15
- data/src/core/lib/http/parser.cc +3 -2
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/buffer_list.cc +182 -24
- data/src/core/lib/iomgr/buffer_list.h +72 -10
- data/src/core/lib/iomgr/call_combiner.cc +84 -90
- data/src/core/lib/iomgr/call_combiner.h +75 -82
- data/src/core/lib/iomgr/cfstream_handle.cc +203 -0
- data/src/core/lib/iomgr/cfstream_handle.h +86 -0
- data/src/core/lib/iomgr/combiner.cc +11 -3
- data/src/core/lib/iomgr/combiner.h +1 -1
- data/src/core/lib/iomgr/endpoint.cc +2 -2
- data/src/core/lib/iomgr/endpoint.h +3 -2
- data/src/core/lib/iomgr/endpoint_cfstream.cc +375 -0
- data/src/core/lib/iomgr/endpoint_cfstream.h +49 -0
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/error.cc +21 -17
- data/src/core/lib/iomgr/error.h +36 -6
- data/src/core/lib/iomgr/error_cfstream.cc +52 -0
- data/src/core/lib/iomgr/error_cfstream.h +31 -0
- data/src/core/lib/iomgr/error_internal.h +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +44 -28
- data/src/core/lib/iomgr/ev_epollex_linux.cc +173 -194
- data/src/core/lib/iomgr/ev_poll_posix.cc +16 -487
- data/src/core/lib/iomgr/ev_posix.cc +29 -19
- data/src/core/lib/iomgr/ev_posix.h +19 -3
- data/src/core/lib/iomgr/ev_windows.cc +2 -2
- data/src/core/lib/iomgr/exec_ctx.cc +1 -0
- data/src/core/lib/iomgr/exec_ctx.h +137 -8
- data/src/core/lib/iomgr/executor.cc +147 -95
- data/src/core/lib/iomgr/executor.h +55 -49
- data/src/core/lib/iomgr/fork_posix.cc +6 -5
- data/src/core/lib/{gprpp/atomic_with_std.h → iomgr/grpc_if_nametoindex.h} +8 -13
- data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +42 -0
- data/src/core/lib/iomgr/{network_status_tracker.h → grpc_if_nametoindex_unsupported.cc} +15 -9
- data/src/core/lib/iomgr/internal_errqueue.cc +3 -5
- data/src/core/lib/iomgr/internal_errqueue.h +105 -3
- data/src/core/lib/iomgr/iomgr.cc +20 -13
- data/src/core/lib/iomgr/iomgr.h +15 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +17 -3
- data/src/core/lib/iomgr/iomgr_custom.h +2 -0
- data/src/core/lib/iomgr/iomgr_internal.cc +10 -0
- data/src/core/lib/iomgr/iomgr_internal.h +12 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +19 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +93 -0
- data/src/core/lib/iomgr/iomgr_windows.cc +18 -2
- data/src/core/lib/iomgr/lockfree_event.cc +4 -4
- data/src/core/lib/iomgr/port.h +35 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +4 -3
- data/src/core/lib/iomgr/resolve_address_windows.cc +2 -1
- data/src/core/lib/iomgr/resource_quota.cc +40 -37
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +6 -2
- data/src/core/lib/iomgr/socket_windows.cc +19 -0
- data/src/core/lib/iomgr/socket_windows.h +8 -0
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +216 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_windows.cc +7 -5
- data/src/core/lib/iomgr/tcp_custom.cc +10 -14
- data/src/core/lib/iomgr/tcp_posix.cc +256 -140
- data/src/core/lib/iomgr/tcp_server.cc +5 -0
- data/src/core/lib/iomgr/tcp_server.h +24 -0
- data/src/core/lib/iomgr/tcp_server_custom.cc +14 -12
- data/src/core/lib/iomgr/tcp_server_posix.cc +86 -12
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_windows.cc +13 -11
- data/src/core/lib/iomgr/tcp_uv.cc +5 -7
- data/src/core/lib/iomgr/tcp_windows.cc +8 -14
- data/src/core/lib/iomgr/timer.h +2 -1
- data/src/core/lib/iomgr/timer_generic.cc +16 -16
- data/src/core/lib/iomgr/timer_manager.cc +20 -11
- data/src/core/lib/iomgr/udp_server.cc +8 -6
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +1 -19
- data/src/core/lib/json/json.cc +1 -4
- data/src/core/lib/profiling/basic_timers.cc +10 -4
- data/src/core/lib/security/context/security_context.cc +6 -7
- data/src/core/lib/security/context/security_context.h +3 -4
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +1 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
- data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -0
- data/src/core/lib/security/credentials/credentials.h +9 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +15 -3
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +2 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +10 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +3 -3
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +9 -8
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +20 -2
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +2 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +192 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +210 -0
- data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +129 -0
- data/src/core/lib/security/credentials/tls/spiffe_credentials.h +62 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +13 -12
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +7 -5
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/security_connector.cc +0 -1
- data/src/core/lib/security/security_connector/security_connector.h +3 -3
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +39 -38
- data/src/core/lib/security/security_connector/ssl_utils.cc +164 -26
- data/src/core/lib/security/security_connector/ssl_utils.h +70 -1
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +426 -0
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +122 -0
- data/src/core/lib/security/transport/auth_filters.h +5 -2
- data/src/core/lib/security/transport/client_auth_filter.cc +55 -50
- data/src/core/lib/security/transport/secure_endpoint.cc +6 -6
- data/src/core/lib/security/transport/security_handshaker.cc +271 -303
- data/src/core/lib/security/transport/security_handshaker.h +11 -2
- data/src/core/lib/security/transport/server_auth_filter.cc +3 -3
- data/src/core/lib/slice/b64.h +2 -2
- data/src/core/lib/slice/percent_encoding.cc +3 -3
- data/src/core/lib/slice/percent_encoding.h +3 -3
- data/src/core/lib/slice/slice.cc +174 -122
- data/src/core/lib/slice/slice_buffer.cc +54 -21
- data/src/core/lib/slice/slice_hash_table.h +4 -4
- data/src/core/lib/slice/slice_intern.cc +49 -107
- data/src/core/lib/slice/slice_internal.h +264 -3
- data/src/core/lib/slice/slice_string_helpers.cc +10 -1
- data/src/core/lib/slice/slice_string_helpers.h +3 -1
- data/src/core/lib/slice/slice_utils.h +50 -0
- data/src/core/lib/slice/slice_weak_hash_table.h +6 -6
- data/src/core/lib/surface/api_trace.h +1 -1
- data/src/core/lib/surface/byte_buffer_reader.cc +17 -0
- data/src/core/lib/surface/call.cc +67 -46
- data/src/core/lib/surface/call.h +7 -2
- data/src/core/lib/surface/call_details.cc +0 -1
- data/src/core/lib/surface/channel.cc +89 -97
- data/src/core/lib/surface/channel.h +60 -6
- data/src/core/lib/surface/channel_init.h +5 -0
- data/src/core/lib/surface/completion_queue.cc +221 -216
- data/src/core/lib/surface/completion_queue.h +2 -1
- data/src/core/lib/surface/init.cc +82 -33
- data/src/core/lib/surface/init.h +1 -0
- data/src/core/lib/surface/init_secure.cc +1 -1
- data/src/core/lib/surface/lame_client.cc +5 -7
- data/src/core/lib/surface/server.cc +42 -47
- data/src/core/lib/surface/validate_metadata.cc +14 -8
- data/src/core/lib/surface/validate_metadata.h +13 -2
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/bdp_estimator.cc +3 -3
- data/src/core/lib/transport/bdp_estimator.h +2 -2
- data/src/core/lib/transport/connectivity_state.cc +10 -40
- data/src/core/lib/transport/connectivity_state.h +0 -8
- data/src/core/lib/transport/error_utils.cc +12 -0
- data/src/core/lib/transport/metadata.cc +258 -267
- data/src/core/lib/transport/metadata.h +227 -16
- data/src/core/lib/transport/metadata_batch.cc +1 -1
- data/src/core/lib/transport/metadata_batch.h +1 -1
- data/src/core/lib/transport/static_metadata.cc +477 -399
- data/src/core/lib/transport/static_metadata.h +273 -182
- data/src/core/lib/transport/status_metadata.cc +3 -3
- data/src/core/lib/transport/timeout_encoding.cc +1 -1
- data/src/core/lib/transport/timeout_encoding.h +1 -1
- data/src/core/lib/transport/transport.cc +39 -72
- data/src/core/lib/transport/transport.h +59 -24
- data/src/core/lib/transport/transport_impl.h +1 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -1
- data/src/core/tsi/alts/handshaker/alts_shared_resource.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +4 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +1 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -1
- data/src/core/tsi/fake_transport_security.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +12 -10
- data/src/core/tsi/ssl_transport_security.h +24 -4
- data/src/ruby/bin/math_pb.rb +18 -16
- data/src/ruby/ext/grpc/extconf.rb +12 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +8 -5
- data/src/ruby/ext/grpc/rb_channel.c +14 -10
- data/src/ruby/ext/grpc/rb_channel_credentials.c +8 -4
- data/src/ruby/ext/grpc/rb_compression_options.c +9 -7
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc.c +23 -24
- data/src/ruby/ext/grpc/rb_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +24 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +36 -0
- data/src/ruby/ext/grpc/rb_server.c +8 -4
- data/src/ruby/lib/grpc/errors.rb +22 -3
- data/src/ruby/lib/grpc/generic/bidi_call.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/README.md +1 -1
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +13 -10
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +18 -0
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +3 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +58 -56
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -0
- data/src/ruby/spec/errors_spec.rb +141 -0
- data/third_party/cares/cares/ares.h +12 -0
- data/third_party/cares/cares/ares_create_query.c +5 -1
- data/third_party/cares/cares/ares_data.c +74 -73
- data/third_party/cares/cares/ares_destroy.c +6 -1
- data/third_party/cares/cares/ares_gethostbyaddr.c +5 -5
- data/third_party/cares/cares/ares_gethostbyname.c +15 -4
- data/third_party/cares/cares/ares_getnameinfo.c +11 -0
- data/third_party/cares/cares/ares_init.c +274 -173
- data/third_party/cares/cares/ares_library_init.c +21 -3
- data/third_party/cares/cares/ares_options.c +6 -2
- data/third_party/cares/cares/ares_parse_naptr_reply.c +7 -6
- data/third_party/cares/cares/ares_parse_ptr_reply.c +4 -2
- data/third_party/cares/cares/ares_platform.c +7 -0
- data/third_party/cares/cares/ares_private.h +19 -11
- data/third_party/cares/cares/ares_process.c +27 -2
- data/third_party/cares/cares/ares_rules.h +1 -1
- data/third_party/cares/cares/ares_search.c +7 -0
- data/third_party/cares/cares/ares_send.c +6 -0
- data/third_party/cares/cares/ares_strsplit.c +174 -0
- data/third_party/cares/cares/ares_strsplit.h +43 -0
- data/third_party/cares/cares/ares_version.h +4 -4
- data/third_party/cares/cares/config-win32.h +1 -1
- data/third_party/cares/cares/inet_ntop.c +2 -3
- data/third_party/cares/config_darwin/ares_config.h +3 -0
- data/third_party/cares/config_freebsd/ares_config.h +3 -0
- data/third_party/cares/config_linux/ares_config.h +3 -0
- data/third_party/cares/config_openbsd/ares_config.h +3 -0
- metadata +83 -48
- data/src/core/ext/filters/client_channel/request_routing.cc +0 -936
- data/src/core/ext/filters/client_channel/request_routing.h +0 -177
- data/src/core/ext/filters/client_channel/subchannel_index.cc +0 -248
- data/src/core/ext/filters/client_channel/subchannel_index.h +0 -76
- data/src/core/lib/channel/handshaker_factory.cc +0 -42
- data/src/core/lib/gpr/arena.cc +0 -192
- data/src/core/lib/gprpp/atomic_with_atm.h +0 -57
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +0 -107
- data/src/core/lib/iomgr/wakeup_fd_cv.h +0 -69
- data/src/core/lib/transport/service_config.cc +0 -106
- data/src/core/lib/transport/service_config.h +0 -249
@@ -59,7 +59,6 @@ class grpc_httpcli_ssl_channel_security_connector final
|
|
59
59
|
tsi_result InitHandshakerFactory(const char* pem_root_certs,
|
60
60
|
const tsi_ssl_root_certs_store* root_store) {
|
61
61
|
tsi_ssl_client_handshaker_options options;
|
62
|
-
memset(&options, 0, sizeof(options));
|
63
62
|
options.pem_root_certs = pem_root_certs;
|
64
63
|
options.root_store = root_store;
|
65
64
|
return tsi_create_ssl_client_handshaker_factory_with_options(
|
@@ -67,7 +66,7 @@ class grpc_httpcli_ssl_channel_security_connector final
|
|
67
66
|
}
|
68
67
|
|
69
68
|
void add_handshakers(grpc_pollset_set* interested_parties,
|
70
|
-
|
69
|
+
grpc_core::HandshakeManager* handshake_mgr) override {
|
71
70
|
tsi_handshaker* handshaker = nullptr;
|
72
71
|
if (handshaker_factory_ != nullptr) {
|
73
72
|
tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker(
|
@@ -77,8 +76,7 @@ class grpc_httpcli_ssl_channel_security_connector final
|
|
77
76
|
tsi_result_to_string(result));
|
78
77
|
}
|
79
78
|
}
|
80
|
-
|
81
|
-
handshake_mgr, grpc_security_handshaker_create(handshaker, this));
|
79
|
+
handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(handshaker, this));
|
82
80
|
}
|
83
81
|
|
84
82
|
tsi_ssl_client_handshaker_factory* handshaker_factory() const {
|
@@ -155,11 +153,11 @@ httpcli_ssl_channel_security_connector_create(
|
|
155
153
|
typedef struct {
|
156
154
|
void (*func)(void* arg, grpc_endpoint* endpoint);
|
157
155
|
void* arg;
|
158
|
-
|
156
|
+
grpc_core::RefCountedPtr<grpc_core::HandshakeManager> handshake_mgr;
|
159
157
|
} on_done_closure;
|
160
158
|
|
161
159
|
static void on_handshake_done(void* arg, grpc_error* error) {
|
162
|
-
|
160
|
+
auto* args = static_cast<grpc_core::HandshakerArgs*>(arg);
|
163
161
|
on_done_closure* c = static_cast<on_done_closure*>(args->user_data);
|
164
162
|
if (error != GRPC_ERROR_NONE) {
|
165
163
|
const char* msg = grpc_error_string(error);
|
@@ -172,14 +170,13 @@ static void on_handshake_done(void* arg, grpc_error* error) {
|
|
172
170
|
gpr_free(args->read_buffer);
|
173
171
|
c->func(c->arg, args->endpoint);
|
174
172
|
}
|
175
|
-
|
176
|
-
gpr_free(c);
|
173
|
+
grpc_core::Delete<on_done_closure>(c);
|
177
174
|
}
|
178
175
|
|
179
176
|
static void ssl_handshake(void* arg, grpc_endpoint* tcp, const char* host,
|
180
177
|
grpc_millis deadline,
|
181
178
|
void (*on_done)(void* arg, grpc_endpoint* endpoint)) {
|
182
|
-
|
179
|
+
auto* c = grpc_core::New<on_done_closure>();
|
183
180
|
const char* pem_root_certs =
|
184
181
|
grpc_core::DefaultSslRootStore::GetPemRootCerts();
|
185
182
|
const tsi_ssl_root_certs_store* root_store =
|
@@ -198,12 +195,13 @@ static void ssl_handshake(void* arg, grpc_endpoint* tcp, const char* host,
|
|
198
195
|
GPR_ASSERT(sc != nullptr);
|
199
196
|
grpc_arg channel_arg = grpc_security_connector_to_arg(sc.get());
|
200
197
|
grpc_channel_args args = {1, &channel_arg};
|
201
|
-
c->handshake_mgr =
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
198
|
+
c->handshake_mgr = grpc_core::MakeRefCounted<grpc_core::HandshakeManager>();
|
199
|
+
grpc_core::HandshakerRegistry::AddHandshakers(
|
200
|
+
grpc_core::HANDSHAKER_CLIENT, &args, /*interested_parties=*/nullptr,
|
201
|
+
c->handshake_mgr.get());
|
202
|
+
c->handshake_mgr->DoHandshake(tcp, /*channel_args=*/nullptr, deadline,
|
203
|
+
/*acceptor=*/nullptr, on_handshake_done,
|
204
|
+
/*user_data=*/c);
|
207
205
|
sc.reset(DEBUG_LOCATION, "httpcli");
|
208
206
|
}
|
209
207
|
|
data/src/core/lib/http/parser.cc
CHANGED
@@ -300,7 +300,7 @@ static grpc_error* addbyte(grpc_http_parser* parser, uint8_t byte,
|
|
300
300
|
case GRPC_HTTP_FIRST_LINE:
|
301
301
|
case GRPC_HTTP_HEADERS:
|
302
302
|
if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) {
|
303
|
-
if (grpc_http1_trace
|
303
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http1_trace))
|
304
304
|
gpr_log(GPR_ERROR, "HTTP header max line length (%d) exceeded",
|
305
305
|
GRPC_HTTP_PARSER_MAX_HEADER_LENGTH);
|
306
306
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
@@ -351,7 +351,8 @@ void grpc_http_response_destroy(grpc_http_response* response) {
|
|
351
351
|
gpr_free(response->hdrs);
|
352
352
|
}
|
353
353
|
|
354
|
-
grpc_error* grpc_http_parser_parse(grpc_http_parser* parser,
|
354
|
+
grpc_error* grpc_http_parser_parse(grpc_http_parser* parser,
|
355
|
+
const grpc_slice& slice,
|
355
356
|
size_t* start_of_body) {
|
356
357
|
for (size_t i = 0; i < GRPC_SLICE_LENGTH(slice); i++) {
|
357
358
|
bool found_body_start = false;
|
data/src/core/lib/http/parser.h
CHANGED
@@ -101,7 +101,8 @@ void grpc_http_parser_init(grpc_http_parser* parser, grpc_http_type type,
|
|
101
101
|
void grpc_http_parser_destroy(grpc_http_parser* parser);
|
102
102
|
|
103
103
|
/* Sets \a start_of_body to the offset in \a slice of the start of the body. */
|
104
|
-
grpc_error* grpc_http_parser_parse(grpc_http_parser* parser,
|
104
|
+
grpc_error* grpc_http_parser_parse(grpc_http_parser* parser,
|
105
|
+
const grpc_slice& slice,
|
105
106
|
size_t* start_of_body);
|
106
107
|
grpc_error* grpc_http_parser_eof(grpc_http_parser* parser);
|
107
108
|
|
@@ -24,32 +24,13 @@
|
|
24
24
|
#include <grpc/support/log.h>
|
25
25
|
|
26
26
|
#ifdef GRPC_LINUX_ERRQUEUE
|
27
|
+
#include <netinet/in.h>
|
28
|
+
#include <string.h>
|
27
29
|
#include <time.h>
|
28
30
|
|
29
31
|
#include "src/core/lib/gprpp/memory.h"
|
30
32
|
|
31
33
|
namespace grpc_core {
|
32
|
-
void TracedBuffer::AddNewEntry(TracedBuffer** head, uint32_t seq_no,
|
33
|
-
void* arg) {
|
34
|
-
GPR_DEBUG_ASSERT(head != nullptr);
|
35
|
-
TracedBuffer* new_elem = New<TracedBuffer>(seq_no, arg);
|
36
|
-
/* Store the current time as the sendmsg time. */
|
37
|
-
new_elem->ts_.sendmsg_time = gpr_now(GPR_CLOCK_REALTIME);
|
38
|
-
new_elem->ts_.scheduled_time = gpr_inf_past(GPR_CLOCK_REALTIME);
|
39
|
-
new_elem->ts_.sent_time = gpr_inf_past(GPR_CLOCK_REALTIME);
|
40
|
-
new_elem->ts_.acked_time = gpr_inf_past(GPR_CLOCK_REALTIME);
|
41
|
-
if (*head == nullptr) {
|
42
|
-
*head = new_elem;
|
43
|
-
return;
|
44
|
-
}
|
45
|
-
/* Append at the end. */
|
46
|
-
TracedBuffer* ptr = *head;
|
47
|
-
while (ptr->next_ != nullptr) {
|
48
|
-
ptr = ptr->next_;
|
49
|
-
}
|
50
|
-
ptr->next_ = new_elem;
|
51
|
-
}
|
52
|
-
|
53
34
|
namespace {
|
54
35
|
/** Fills gpr_timespec gts based on values from timespec ts */
|
55
36
|
void fill_gpr_from_timestamp(gpr_timespec* gts, const struct timespec* ts) {
|
@@ -68,10 +49,180 @@ void default_timestamps_callback(void* arg, grpc_core::Timestamps* ts,
|
|
68
49
|
void (*timestamps_callback)(void*, grpc_core::Timestamps*,
|
69
50
|
grpc_error* shutdown_err) =
|
70
51
|
default_timestamps_callback;
|
52
|
+
|
53
|
+
/* Used to extract individual opt stats from cmsg, so as to avoid troubles with
|
54
|
+
* unaligned reads */
|
55
|
+
template <typename T>
|
56
|
+
T read_unaligned(const void* ptr) {
|
57
|
+
T val;
|
58
|
+
memcpy(&val, ptr, sizeof(val));
|
59
|
+
return val;
|
60
|
+
}
|
61
|
+
|
62
|
+
/* Extracts opt stats from the tcp_info struct \a info to \a metrics */
|
63
|
+
void extract_opt_stats_from_tcp_info(ConnectionMetrics* metrics,
|
64
|
+
const grpc_core::tcp_info* info) {
|
65
|
+
if (info == nullptr) {
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
if (info->length > offsetof(grpc_core::tcp_info, tcpi_sndbuf_limited)) {
|
69
|
+
metrics->recurring_retrans.set(info->tcpi_retransmits);
|
70
|
+
metrics->is_delivery_rate_app_limited.set(
|
71
|
+
info->tcpi_delivery_rate_app_limited);
|
72
|
+
metrics->congestion_window.set(info->tcpi_snd_cwnd);
|
73
|
+
metrics->reordering.set(info->tcpi_reordering);
|
74
|
+
metrics->packet_retx.set(info->tcpi_total_retrans);
|
75
|
+
metrics->pacing_rate.set(info->tcpi_pacing_rate);
|
76
|
+
metrics->data_notsent.set(info->tcpi_notsent_bytes);
|
77
|
+
if (info->tcpi_min_rtt != UINT32_MAX) {
|
78
|
+
metrics->min_rtt.set(info->tcpi_min_rtt);
|
79
|
+
}
|
80
|
+
metrics->packet_sent.set(info->tcpi_data_segs_out);
|
81
|
+
metrics->delivery_rate.set(info->tcpi_delivery_rate);
|
82
|
+
metrics->busy_usec.set(info->tcpi_busy_time);
|
83
|
+
metrics->rwnd_limited_usec.set(info->tcpi_rwnd_limited);
|
84
|
+
metrics->sndbuf_limited_usec.set(info->tcpi_sndbuf_limited);
|
85
|
+
}
|
86
|
+
if (info->length > offsetof(grpc_core::tcp_info, tcpi_dsack_dups)) {
|
87
|
+
metrics->data_sent.set(info->tcpi_bytes_sent);
|
88
|
+
metrics->data_retx.set(info->tcpi_bytes_retrans);
|
89
|
+
metrics->packet_spurious_retx.set(info->tcpi_dsack_dups);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
/** Extracts opt stats from the given control message \a opt_stats to the
|
94
|
+
* connection metrics \a metrics */
|
95
|
+
void extract_opt_stats_from_cmsg(ConnectionMetrics* metrics,
|
96
|
+
const cmsghdr* opt_stats) {
|
97
|
+
if (opt_stats == nullptr) {
|
98
|
+
return;
|
99
|
+
}
|
100
|
+
const auto* data = CMSG_DATA(opt_stats);
|
101
|
+
constexpr int64_t cmsg_hdr_len = CMSG_ALIGN(sizeof(struct cmsghdr));
|
102
|
+
const int64_t len = opt_stats->cmsg_len - cmsg_hdr_len;
|
103
|
+
int64_t offset = 0;
|
104
|
+
|
105
|
+
while (offset < len) {
|
106
|
+
const auto* attr = reinterpret_cast<const nlattr*>(data + offset);
|
107
|
+
const void* val = data + offset + NLA_HDRLEN;
|
108
|
+
switch (attr->nla_type) {
|
109
|
+
case TCP_NLA_BUSY: {
|
110
|
+
metrics->busy_usec.set(read_unaligned<uint64_t>(val));
|
111
|
+
break;
|
112
|
+
}
|
113
|
+
case TCP_NLA_RWND_LIMITED: {
|
114
|
+
metrics->rwnd_limited_usec.set(read_unaligned<uint64_t>(val));
|
115
|
+
break;
|
116
|
+
}
|
117
|
+
case TCP_NLA_SNDBUF_LIMITED: {
|
118
|
+
metrics->sndbuf_limited_usec.set(read_unaligned<uint64_t>(val));
|
119
|
+
break;
|
120
|
+
}
|
121
|
+
case TCP_NLA_PACING_RATE: {
|
122
|
+
metrics->pacing_rate.set(read_unaligned<uint64_t>(val));
|
123
|
+
break;
|
124
|
+
}
|
125
|
+
case TCP_NLA_DELIVERY_RATE: {
|
126
|
+
metrics->delivery_rate.set(read_unaligned<uint64_t>(val));
|
127
|
+
break;
|
128
|
+
}
|
129
|
+
case TCP_NLA_DELIVERY_RATE_APP_LMT: {
|
130
|
+
metrics->is_delivery_rate_app_limited.set(read_unaligned<uint8_t>(val));
|
131
|
+
break;
|
132
|
+
}
|
133
|
+
case TCP_NLA_SND_CWND: {
|
134
|
+
metrics->congestion_window.set(read_unaligned<uint32_t>(val));
|
135
|
+
break;
|
136
|
+
}
|
137
|
+
case TCP_NLA_MIN_RTT: {
|
138
|
+
metrics->min_rtt.set(read_unaligned<uint32_t>(val));
|
139
|
+
break;
|
140
|
+
}
|
141
|
+
case TCP_NLA_SRTT: {
|
142
|
+
metrics->srtt.set(read_unaligned<uint32_t>(val));
|
143
|
+
break;
|
144
|
+
}
|
145
|
+
case TCP_NLA_RECUR_RETRANS: {
|
146
|
+
metrics->recurring_retrans.set(read_unaligned<uint8_t>(val));
|
147
|
+
break;
|
148
|
+
}
|
149
|
+
case TCP_NLA_BYTES_SENT: {
|
150
|
+
metrics->data_sent.set(read_unaligned<uint64_t>(val));
|
151
|
+
break;
|
152
|
+
}
|
153
|
+
case TCP_NLA_DATA_SEGS_OUT: {
|
154
|
+
metrics->packet_sent.set(read_unaligned<uint64_t>(val));
|
155
|
+
break;
|
156
|
+
}
|
157
|
+
case TCP_NLA_TOTAL_RETRANS: {
|
158
|
+
metrics->packet_retx.set(read_unaligned<uint64_t>(val));
|
159
|
+
break;
|
160
|
+
}
|
161
|
+
case TCP_NLA_DELIVERED: {
|
162
|
+
metrics->packet_delivered.set(read_unaligned<uint32_t>(val));
|
163
|
+
break;
|
164
|
+
}
|
165
|
+
case TCP_NLA_DELIVERED_CE: {
|
166
|
+
metrics->packet_delivered_ce.set(read_unaligned<uint32_t>(val));
|
167
|
+
break;
|
168
|
+
}
|
169
|
+
case TCP_NLA_BYTES_RETRANS: {
|
170
|
+
metrics->data_retx.set(read_unaligned<uint64_t>(val));
|
171
|
+
break;
|
172
|
+
}
|
173
|
+
case TCP_NLA_DSACK_DUPS: {
|
174
|
+
metrics->packet_spurious_retx.set(read_unaligned<uint32_t>(val));
|
175
|
+
break;
|
176
|
+
}
|
177
|
+
case TCP_NLA_REORDERING: {
|
178
|
+
metrics->reordering.set(read_unaligned<uint32_t>(val));
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
case TCP_NLA_SND_SSTHRESH: {
|
182
|
+
metrics->snd_ssthresh.set(read_unaligned<uint32_t>(val));
|
183
|
+
break;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
offset += NLA_ALIGN(attr->nla_len);
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
static int get_socket_tcp_info(grpc_core::tcp_info* info, int fd) {
|
191
|
+
memset(info, 0, sizeof(*info));
|
192
|
+
info->length = sizeof(*info) - sizeof(socklen_t);
|
193
|
+
return getsockopt(fd, IPPROTO_TCP, TCP_INFO, info, &(info->length));
|
194
|
+
}
|
71
195
|
} /* namespace */
|
72
196
|
|
197
|
+
void TracedBuffer::AddNewEntry(TracedBuffer** head, uint32_t seq_no, int fd,
|
198
|
+
void* arg) {
|
199
|
+
GPR_DEBUG_ASSERT(head != nullptr);
|
200
|
+
TracedBuffer* new_elem = New<TracedBuffer>(seq_no, arg);
|
201
|
+
/* Store the current time as the sendmsg time. */
|
202
|
+
new_elem->ts_.sendmsg_time.time = gpr_now(GPR_CLOCK_REALTIME);
|
203
|
+
new_elem->ts_.scheduled_time.time = gpr_inf_past(GPR_CLOCK_REALTIME);
|
204
|
+
new_elem->ts_.sent_time.time = gpr_inf_past(GPR_CLOCK_REALTIME);
|
205
|
+
new_elem->ts_.acked_time.time = gpr_inf_past(GPR_CLOCK_REALTIME);
|
206
|
+
|
207
|
+
if (get_socket_tcp_info(&new_elem->ts_.info, fd) == 0) {
|
208
|
+
extract_opt_stats_from_tcp_info(&new_elem->ts_.sendmsg_time.metrics,
|
209
|
+
&new_elem->ts_.info);
|
210
|
+
}
|
211
|
+
if (*head == nullptr) {
|
212
|
+
*head = new_elem;
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
/* Append at the end. */
|
216
|
+
TracedBuffer* ptr = *head;
|
217
|
+
while (ptr->next_ != nullptr) {
|
218
|
+
ptr = ptr->next_;
|
219
|
+
}
|
220
|
+
ptr->next_ = new_elem;
|
221
|
+
}
|
222
|
+
|
73
223
|
void TracedBuffer::ProcessTimestamp(TracedBuffer** head,
|
74
224
|
struct sock_extended_err* serr,
|
225
|
+
struct cmsghdr* opt_stats,
|
75
226
|
struct scm_timestamping* tss) {
|
76
227
|
GPR_DEBUG_ASSERT(head != nullptr);
|
77
228
|
TracedBuffer* elem = *head;
|
@@ -82,15 +233,22 @@ void TracedBuffer::ProcessTimestamp(TracedBuffer** head,
|
|
82
233
|
if (serr->ee_data >= elem->seq_no_) {
|
83
234
|
switch (serr->ee_info) {
|
84
235
|
case SCM_TSTAMP_SCHED:
|
85
|
-
fill_gpr_from_timestamp(&(elem->ts_.scheduled_time),
|
236
|
+
fill_gpr_from_timestamp(&(elem->ts_.scheduled_time.time),
|
237
|
+
&(tss->ts[0]));
|
238
|
+
extract_opt_stats_from_cmsg(&(elem->ts_.scheduled_time.metrics),
|
239
|
+
opt_stats);
|
86
240
|
elem = elem->next_;
|
87
241
|
break;
|
88
242
|
case SCM_TSTAMP_SND:
|
89
|
-
fill_gpr_from_timestamp(&(elem->ts_.sent_time), &(tss->ts[0]));
|
243
|
+
fill_gpr_from_timestamp(&(elem->ts_.sent_time.time), &(tss->ts[0]));
|
244
|
+
extract_opt_stats_from_cmsg(&(elem->ts_.sent_time.metrics),
|
245
|
+
opt_stats);
|
90
246
|
elem = elem->next_;
|
91
247
|
break;
|
92
248
|
case SCM_TSTAMP_ACK:
|
93
|
-
fill_gpr_from_timestamp(&(elem->ts_.acked_time), &(tss->ts[0]));
|
249
|
+
fill_gpr_from_timestamp(&(elem->ts_.acked_time.time), &(tss->ts[0]));
|
250
|
+
extract_opt_stats_from_cmsg(&(elem->ts_.acked_time.metrics),
|
251
|
+
opt_stats);
|
94
252
|
/* Got all timestamps. Do the callback and free this TracedBuffer.
|
95
253
|
* The thing below can be passed by value if we don't want the
|
96
254
|
* restriction on the lifetime. */
|
@@ -26,19 +26,78 @@
|
|
26
26
|
#include <grpc/support/time.h>
|
27
27
|
|
28
28
|
#include "src/core/lib/gprpp/memory.h"
|
29
|
+
#include "src/core/lib/gprpp/optional.h"
|
29
30
|
#include "src/core/lib/iomgr/error.h"
|
30
31
|
#include "src/core/lib/iomgr/internal_errqueue.h"
|
31
32
|
|
32
33
|
namespace grpc_core {
|
34
|
+
|
35
|
+
struct ConnectionMetrics {
|
36
|
+
/* Delivery rate in Bytes/s. */
|
37
|
+
Optional<uint64_t> delivery_rate;
|
38
|
+
/* If the delivery rate is limited by the application, this is set to true. */
|
39
|
+
Optional<bool> is_delivery_rate_app_limited;
|
40
|
+
/* Total packets retransmitted. */
|
41
|
+
Optional<uint32_t> packet_retx;
|
42
|
+
/* Total packets retransmitted spuriously. This metric is smaller than or
|
43
|
+
equal to packet_retx. */
|
44
|
+
Optional<uint32_t> packet_spurious_retx;
|
45
|
+
/* Total packets sent. */
|
46
|
+
Optional<uint32_t> packet_sent;
|
47
|
+
/* Total packets delivered. */
|
48
|
+
Optional<uint32_t> packet_delivered;
|
49
|
+
/* Total packets delivered with ECE marked. This metric is smaller than or
|
50
|
+
equal to packet_delivered. */
|
51
|
+
Optional<uint32_t> packet_delivered_ce;
|
52
|
+
/* Total bytes lost so far. */
|
53
|
+
Optional<uint64_t> data_retx;
|
54
|
+
/* Total bytes sent so far. */
|
55
|
+
Optional<uint64_t> data_sent;
|
56
|
+
/* Total bytes in write queue but not sent. */
|
57
|
+
Optional<uint64_t> data_notsent;
|
58
|
+
/* Pacing rate of the connection in Bps */
|
59
|
+
Optional<uint64_t> pacing_rate;
|
60
|
+
/* Minimum RTT observed in usec. */
|
61
|
+
Optional<uint32_t> min_rtt;
|
62
|
+
/* Smoothed RTT in usec */
|
63
|
+
Optional<uint32_t> srtt;
|
64
|
+
/* Send congestion window. */
|
65
|
+
Optional<uint32_t> congestion_window;
|
66
|
+
/* Slow start threshold in packets. */
|
67
|
+
Optional<uint32_t> snd_ssthresh;
|
68
|
+
/* Maximum degree of reordering (i.e., maximum number of packets reodered)
|
69
|
+
on the connection. */
|
70
|
+
Optional<uint32_t> reordering;
|
71
|
+
/* Represents the number of recurring retransmissions of the first sequence
|
72
|
+
that is not acknowledged yet. */
|
73
|
+
Optional<uint8_t> recurring_retrans;
|
74
|
+
/* The cumulative time (in usec) that the transport protocol was busy
|
75
|
+
sending data. */
|
76
|
+
Optional<uint64_t> busy_usec;
|
77
|
+
/* The cumulative time (in usec) that the transport protocol was limited by
|
78
|
+
the receive window size. */
|
79
|
+
Optional<uint64_t> rwnd_limited_usec;
|
80
|
+
/* The cumulative time (in usec) that the transport protocol was limited by
|
81
|
+
the send buffer size. */
|
82
|
+
Optional<uint64_t> sndbuf_limited_usec;
|
83
|
+
};
|
84
|
+
|
85
|
+
struct Timestamp {
|
86
|
+
gpr_timespec time;
|
87
|
+
ConnectionMetrics metrics; /* Metrics collected with this timestamp */
|
88
|
+
};
|
89
|
+
|
33
90
|
struct Timestamps {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
gpr_timespec sent_time;
|
39
|
-
gpr_timespec acked_time;
|
91
|
+
Timestamp sendmsg_time;
|
92
|
+
Timestamp scheduled_time;
|
93
|
+
Timestamp sent_time;
|
94
|
+
Timestamp acked_time;
|
40
95
|
|
41
96
|
uint32_t byte_offset; /* byte offset relative to the start of the RPC */
|
97
|
+
|
98
|
+
#ifdef GRPC_LINUX_ERRQUEUE
|
99
|
+
grpc_core::tcp_info info; /* tcp_info collected on sendmsg */
|
100
|
+
#endif /* GRPC_LINUX_ERRQUEUE */
|
42
101
|
};
|
43
102
|
|
44
103
|
/** TracedBuffer is a class to keep track of timestamps for a specific buffer in
|
@@ -58,13 +117,14 @@ class TracedBuffer {
|
|
58
117
|
/** Add a new entry in the TracedBuffer list pointed to by head. Also saves
|
59
118
|
* sendmsg_time with the current timestamp. */
|
60
119
|
static void AddNewEntry(grpc_core::TracedBuffer** head, uint32_t seq_no,
|
61
|
-
void* arg);
|
120
|
+
int fd, void* arg);
|
62
121
|
|
63
122
|
/** Processes a received timestamp based on sock_extended_err and
|
64
123
|
* scm_timestamping structures. It will invoke the timestamps callback if the
|
65
124
|
* timestamp type is SCM_TSTAMP_ACK. */
|
66
125
|
static void ProcessTimestamp(grpc_core::TracedBuffer** head,
|
67
126
|
struct sock_extended_err* serr,
|
127
|
+
struct cmsghdr* opt_stats,
|
68
128
|
struct scm_timestamping* tss);
|
69
129
|
|
70
130
|
/** Cleans the list by calling the callback for each traced buffer in the list
|
@@ -73,7 +133,7 @@ class TracedBuffer {
|
|
73
133
|
grpc_error* shutdown_err);
|
74
134
|
|
75
135
|
private:
|
76
|
-
|
136
|
+
GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW
|
77
137
|
|
78
138
|
TracedBuffer(uint32_t seq_no, void* arg)
|
79
139
|
: seq_no_(seq_no), arg_(arg), next_(nullptr) {}
|
@@ -88,7 +148,9 @@ class TracedBuffer {
|
|
88
148
|
public:
|
89
149
|
/* Dummy shutdown function */
|
90
150
|
static void Shutdown(grpc_core::TracedBuffer** head, void* remaining,
|
91
|
-
grpc_error* shutdown_err) {
|
151
|
+
grpc_error* shutdown_err) {
|
152
|
+
GRPC_ERROR_UNREF(shutdown_err);
|
153
|
+
}
|
92
154
|
};
|
93
155
|
#endif /* GRPC_LINUX_ERRQUEUE */
|
94
156
|
|
@@ -98,6 +160,6 @@ void grpc_tcp_set_write_timestamps_callback(void (*fn)(void*,
|
|
98
160
|
grpc_core::Timestamps*,
|
99
161
|
grpc_error* error));
|
100
162
|
|
101
|
-
}
|
163
|
+
} /* namespace grpc_core */
|
102
164
|
|
103
165
|
#endif /* GRPC_CORE_LIB_IOMGR_BUFFER_LIST_H */
|