grpc 1.49.1 → 1.50.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 +54 -153
- data/include/grpc/event_engine/endpoint_config.h +11 -5
- data/include/grpc/event_engine/event_engine.h +1 -1
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
- data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
- data/include/grpc/impl/codegen/atm_windows.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +6 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
- data/src/core/ext/filters/client_channel/client_channel.cc +33 -22
- data/src/core/ext/filters/client_channel/client_channel.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
- data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +112 -96
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +84 -96
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +13 -15
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
- data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
- data/src/core/ext/filters/client_channel/subchannel.h +12 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
- data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
- data/src/core/ext/xds/certificate_provider_store.cc +63 -3
- data/src/core/ext/xds/certificate_provider_store.h +9 -1
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
- data/src/core/ext/xds/xds_api.cc +21 -17
- data/src/core/ext/xds/xds_api.h +7 -0
- data/src/core/ext/xds/xds_bootstrap.cc +5 -537
- data/src/core/ext/xds/xds_bootstrap.h +39 -111
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
- data/src/core/ext/xds/xds_client.cc +219 -145
- data/src/core/ext/xds/xds_client.h +19 -17
- data/src/core/ext/xds/xds_client_grpc.cc +18 -80
- data/src/core/ext/xds/xds_client_grpc.h +2 -25
- data/src/core/ext/xds/xds_client_stats.cc +4 -4
- data/src/core/ext/xds/xds_cluster.cc +87 -79
- data/src/core/ext/xds/xds_cluster.h +5 -5
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
- data/src/core/ext/xds/xds_common_types.cc +13 -5
- data/src/core/ext/xds/xds_endpoint.cc +8 -6
- data/src/core/ext/xds/xds_endpoint.h +3 -4
- data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
- data/src/core/ext/xds/xds_listener.cc +25 -20
- data/src/core/ext/xds/xds_listener.h +3 -4
- data/src/core/ext/xds/xds_resource_type.h +11 -8
- data/src/core/ext/xds/xds_route_config.cc +15 -16
- data/src/core/ext/xds/xds_route_config.h +3 -3
- data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
- data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
- data/src/core/lib/backoff/backoff.cc +2 -4
- data/src/core/lib/channel/call_finalization.h +1 -3
- data/src/core/lib/channel/channel_args.h +114 -14
- data/src/core/lib/channel/channel_trace.cc +3 -4
- data/src/core/lib/channel/promise_based_filter.cc +18 -19
- data/src/core/lib/channel/status_util.cc +27 -0
- data/src/core/lib/channel/status_util.h +10 -0
- data/src/core/lib/config/core_configuration.cc +5 -1
- data/src/core/lib/config/core_configuration.h +33 -0
- data/src/core/lib/debug/stats.cc +26 -30
- data/src/core/lib/debug/stats.h +2 -12
- data/src/core/lib/debug/stats_data.cc +118 -614
- data/src/core/lib/debug/stats_data.h +67 -465
- data/src/core/lib/debug/trace.cc +0 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
- data/src/core/lib/event_engine/forkable.cc +1 -1
- data/src/core/lib/event_engine/poller.h +14 -12
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
- data/src/core/lib/event_engine/thread_pool.cc +131 -94
- data/src/core/lib/event_engine/thread_pool.h +56 -23
- data/src/core/lib/event_engine/time_util.cc +30 -0
- data/src/core/lib/event_engine/time_util.h +32 -0
- data/src/core/lib/event_engine/utils.cc +0 -5
- data/src/core/lib/event_engine/utils.h +0 -4
- data/src/core/lib/event_engine/windows/iocp.cc +13 -7
- data/src/core/lib/event_engine/windows/iocp.h +2 -1
- data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
- data/src/core/lib/experiments/config.cc +146 -0
- data/src/core/lib/experiments/config.h +43 -0
- data/src/core/lib/experiments/experiments.cc +75 -0
- data/src/core/lib/experiments/experiments.h +56 -0
- data/src/core/lib/gpr/alloc.cc +1 -9
- data/src/core/lib/gpr/log_windows.cc +0 -1
- data/src/core/lib/gpr/string_util_windows.cc +3 -30
- data/src/core/lib/gpr/sync_abseil.cc +0 -14
- data/src/core/lib/gpr/sync_posix.cc +0 -14
- data/src/core/lib/gpr/time_posix.cc +0 -6
- data/src/core/lib/gpr/time_precise.h +1 -1
- data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
- data/src/core/lib/gpr/useful.h +11 -0
- data/src/core/lib/{gpr → gprpp}/env.h +25 -12
- data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
- data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
- data/src/core/lib/gprpp/env_windows.cc +56 -0
- data/src/core/lib/gprpp/fork.cc +14 -22
- data/src/core/lib/gprpp/fork.h +0 -8
- data/src/core/lib/gprpp/global_config_env.cc +7 -6
- data/src/core/lib/gprpp/notification.h +67 -0
- data/src/core/lib/gprpp/packed_table.h +40 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
- data/src/core/lib/gprpp/sorted_pack.h +98 -0
- data/src/core/lib/gprpp/status_helper.h +6 -0
- data/src/core/lib/gprpp/table.h +9 -1
- data/src/core/lib/gprpp/tchar.cc +49 -0
- data/src/core/lib/gprpp/tchar.h +33 -0
- data/src/core/lib/gprpp/time.cc +21 -0
- data/src/core/lib/gprpp/time.h +55 -0
- data/src/core/lib/gprpp/validation_errors.cc +61 -0
- data/src/core/lib/gprpp/validation_errors.h +110 -0
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
- data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
- data/src/core/lib/iomgr/call_combiner.cc +0 -8
- data/src/core/lib/iomgr/closure.h +0 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
- data/src/core/lib/iomgr/exec_ctx.cc +0 -10
- data/src/core/lib/iomgr/exec_ctx.h +7 -31
- data/src/core/lib/iomgr/iocp_windows.cc +1 -2
- data/src/core/lib/iomgr/iomgr.cc +6 -8
- data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
- data/src/core/lib/iomgr/pollset.h +1 -1
- data/src/core/lib/iomgr/pollset_set.h +0 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -0
- data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +1 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +1 -0
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
- data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
- data/src/core/lib/iomgr/tcp_client.cc +6 -7
- data/src/core/lib/iomgr/tcp_client.h +11 -11
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
- data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
- data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
- data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
- data/src/core/lib/iomgr/tcp_posix.cc +131 -114
- data/src/core/lib/iomgr/tcp_posix.h +3 -1
- data/src/core/lib/iomgr/tcp_server.cc +5 -4
- data/src/core/lib/iomgr/tcp_server.h +9 -6
- data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
- data/src/core/lib/iomgr/tcp_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.h +0 -1
- data/src/core/lib/iomgr/timer_generic.cc +4 -4
- data/src/core/lib/iomgr/timer_manager.cc +1 -2
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
- data/src/core/lib/json/json_object_loader.cc +21 -52
- data/src/core/lib/json/json_object_loader.h +56 -76
- data/src/core/lib/json/json_util.cc +2 -1
- data/src/core/lib/load_balancing/lb_policy.h +5 -5
- data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
- data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
- data/src/core/lib/promise/activity.h +2 -3
- data/src/core/lib/promise/context.h +1 -1
- data/src/core/lib/promise/sleep.cc +16 -4
- data/src/core/lib/promise/sleep.h +8 -2
- data/src/core/lib/resolver/resolver.h +13 -3
- data/src/core/lib/resource_quota/api.cc +9 -0
- data/src/core/lib/resource_quota/api.h +6 -0
- data/src/core/lib/resource_quota/arena.cc +1 -3
- data/src/core/lib/resource_quota/memory_quota.cc +8 -24
- data/src/core/lib/resource_quota/memory_quota.h +6 -19
- data/src/core/lib/resource_quota/periodic_update.cc +2 -3
- data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
- data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
- data/src/core/lib/surface/call.cc +1 -11
- data/src/core/lib/surface/channel.cc +3 -2
- data/src/core/lib/surface/completion_queue.cc +16 -28
- data/src/core/lib/surface/completion_queue.h +1 -1
- data/src/core/lib/surface/completion_queue_factory.cc +5 -0
- data/src/core/lib/surface/init.cc +16 -11
- data/src/core/lib/surface/init_internally.cc +24 -0
- data/src/core/lib/surface/init_internally.h +28 -0
- data/src/core/lib/surface/server.cc +1 -7
- data/src/core/lib/surface/server.h +4 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +1 -3
- data/src/core/lib/transport/metadata_batch.cc +2 -3
- data/src/core/lib/transport/metadata_batch.h +9 -7
- data/src/core/lib/transport/parsed_metadata.h +4 -2
- data/src/core/lib/transport/status_conversion.cc +1 -3
- data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
- data/src/core/lib/transport/transport.h +0 -1
- data/src/core/lib/transport/transport_impl.h +0 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +5 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
- data/src/ruby/spec/user_agent_spec.rb +1 -1
- metadata +33 -19
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
- data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
- data/src/core/ext/xds/certificate_provider_registry.h +0 -59
- data/src/core/lib/event_engine/promise.h +0 -78
- data/src/core/lib/gpr/env_windows.cc +0 -74
- data/src/core/lib/gpr/string_windows.h +0 -32
- data/src/core/lib/profiling/basic_timers.cc +0 -295
- data/src/core/lib/profiling/stap_timers.cc +0 -50
- data/src/core/lib/profiling/timers.h +0 -94
@@ -35,7 +35,6 @@
|
|
35
35
|
#include <grpc/support/time.h>
|
36
36
|
|
37
37
|
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
38
|
-
#include "src/core/lib/channel/channel_args.h"
|
39
38
|
#include "src/core/lib/gpr/string.h"
|
40
39
|
#include "src/core/lib/iomgr/ev_posix.h"
|
41
40
|
#include "src/core/lib/iomgr/executor.h"
|
@@ -51,6 +50,8 @@
|
|
51
50
|
|
52
51
|
extern grpc_core::TraceFlag grpc_tcp_trace;
|
53
52
|
|
53
|
+
using ::grpc_event_engine::experimental::EndpointConfig;
|
54
|
+
|
54
55
|
struct async_connect {
|
55
56
|
gpr_mu mu;
|
56
57
|
grpc_fd* fd;
|
@@ -62,9 +63,9 @@ struct async_connect {
|
|
62
63
|
std::string addr_str;
|
63
64
|
grpc_endpoint** ep;
|
64
65
|
grpc_closure* closure;
|
65
|
-
grpc_channel_args* channel_args;
|
66
66
|
int64_t connection_handle;
|
67
67
|
bool connect_cancelled;
|
68
|
+
grpc_core::PosixTcpOptions options;
|
68
69
|
};
|
69
70
|
|
70
71
|
struct ConnectionShard {
|
@@ -90,9 +91,9 @@ void grpc_tcp_client_global_init() {
|
|
90
91
|
gpr_once_init(&g_tcp_client_posix_init, do_tcp_client_global_init);
|
91
92
|
}
|
92
93
|
|
93
|
-
static grpc_error_handle prepare_socket(
|
94
|
-
|
95
|
-
|
94
|
+
static grpc_error_handle prepare_socket(
|
95
|
+
const grpc_resolved_address* addr, int fd,
|
96
|
+
const grpc_core::PosixTcpOptions& options) {
|
96
97
|
grpc_error_handle err = GRPC_ERROR_NONE;
|
97
98
|
|
98
99
|
GPR_ASSERT(fd >= 0);
|
@@ -106,15 +107,14 @@ static grpc_error_handle prepare_socket(const grpc_resolved_address* addr,
|
|
106
107
|
if (!GRPC_ERROR_IS_NONE(err)) goto error;
|
107
108
|
err = grpc_set_socket_reuse_addr(fd, 1);
|
108
109
|
if (!GRPC_ERROR_IS_NONE(err)) goto error;
|
109
|
-
err = grpc_set_socket_tcp_user_timeout(fd,
|
110
|
-
true /* is_client */);
|
110
|
+
err = grpc_set_socket_tcp_user_timeout(fd, options, true /* is_client */);
|
111
111
|
if (!GRPC_ERROR_IS_NONE(err)) goto error;
|
112
112
|
}
|
113
113
|
err = grpc_set_socket_no_sigpipe_if_possible(fd);
|
114
114
|
if (!GRPC_ERROR_IS_NONE(err)) goto error;
|
115
115
|
|
116
116
|
err = grpc_apply_socket_mutator_in_args(fd, GRPC_FD_CLIENT_CONNECTION_USAGE,
|
117
|
-
|
117
|
+
options);
|
118
118
|
if (!GRPC_ERROR_IS_NONE(err)) goto error;
|
119
119
|
|
120
120
|
goto done;
|
@@ -143,15 +143,20 @@ static void tc_on_alarm(void* acp, grpc_error_handle error) {
|
|
143
143
|
gpr_mu_unlock(&ac->mu);
|
144
144
|
if (done) {
|
145
145
|
gpr_mu_destroy(&ac->mu);
|
146
|
-
grpc_channel_args_destroy(ac->channel_args);
|
147
146
|
delete ac;
|
148
147
|
}
|
149
148
|
}
|
150
149
|
|
151
|
-
grpc_endpoint* grpc_tcp_client_create_from_fd(
|
152
|
-
grpc_fd* fd, const
|
150
|
+
static grpc_endpoint* grpc_tcp_client_create_from_fd(
|
151
|
+
grpc_fd* fd, const grpc_core::PosixTcpOptions& options,
|
152
|
+
absl::string_view addr_str) {
|
153
|
+
return grpc_tcp_create(fd, options, addr_str);
|
154
|
+
}
|
155
|
+
|
156
|
+
grpc_endpoint* grpc_tcp_create_from_fd(
|
157
|
+
grpc_fd* fd, const grpc_event_engine::experimental::EndpointConfig& config,
|
153
158
|
absl::string_view addr_str) {
|
154
|
-
return grpc_tcp_create(fd,
|
159
|
+
return grpc_tcp_create(fd, TcpOptionsFromEndpointConfig(config), addr_str);
|
155
160
|
}
|
156
161
|
|
157
162
|
static void on_writable(void* acp, grpc_error_handle error) {
|
@@ -207,7 +212,7 @@ static void on_writable(void* acp, grpc_error_handle error) {
|
|
207
212
|
switch (so_error) {
|
208
213
|
case 0:
|
209
214
|
grpc_pollset_set_del_fd(ac->interested_parties, fd);
|
210
|
-
*ep = grpc_tcp_client_create_from_fd(fd, ac->
|
215
|
+
*ep = grpc_tcp_client_create_from_fd(fd, ac->options, ac->addr_str);
|
211
216
|
fd = nullptr;
|
212
217
|
break;
|
213
218
|
case ENOBUFS:
|
@@ -269,7 +274,6 @@ finish:
|
|
269
274
|
// This is safe even outside the lock, because "done", the sentinel, is
|
270
275
|
// populated *inside* the lock.
|
271
276
|
gpr_mu_destroy(&ac->mu);
|
272
|
-
grpc_channel_args_destroy(ac->channel_args);
|
273
277
|
delete ac;
|
274
278
|
}
|
275
279
|
// Push async connect closure to the executor since this may actually be
|
@@ -284,8 +288,9 @@ finish:
|
|
284
288
|
}
|
285
289
|
|
286
290
|
grpc_error_handle grpc_tcp_client_prepare_fd(
|
287
|
-
const
|
288
|
-
grpc_resolved_address*
|
291
|
+
const grpc_core::PosixTcpOptions& options,
|
292
|
+
const grpc_resolved_address* addr, grpc_resolved_address* mapped_addr,
|
293
|
+
int* fd) {
|
289
294
|
grpc_dualstack_mode dsmode;
|
290
295
|
grpc_error_handle error;
|
291
296
|
*fd = -1;
|
@@ -306,8 +311,7 @@ grpc_error_handle grpc_tcp_client_prepare_fd(
|
|
306
311
|
memcpy(mapped_addr, addr, sizeof(*mapped_addr));
|
307
312
|
}
|
308
313
|
}
|
309
|
-
if ((error = prepare_socket(mapped_addr, *fd,
|
310
|
-
GRPC_ERROR_NONE) {
|
314
|
+
if ((error = prepare_socket(mapped_addr, *fd, options)) != GRPC_ERROR_NONE) {
|
311
315
|
return error;
|
312
316
|
}
|
313
317
|
return GRPC_ERROR_NONE;
|
@@ -315,8 +319,9 @@ grpc_error_handle grpc_tcp_client_prepare_fd(
|
|
315
319
|
|
316
320
|
int64_t grpc_tcp_client_create_from_prepared_fd(
|
317
321
|
grpc_pollset_set* interested_parties, grpc_closure* closure, const int fd,
|
318
|
-
const
|
319
|
-
grpc_core::Timestamp deadline,
|
322
|
+
const grpc_core::PosixTcpOptions& options,
|
323
|
+
const grpc_resolved_address* addr, grpc_core::Timestamp deadline,
|
324
|
+
grpc_endpoint** ep) {
|
320
325
|
int err;
|
321
326
|
do {
|
322
327
|
err = connect(fd, reinterpret_cast<const grpc_sockaddr*>(addr->addr),
|
@@ -342,7 +347,7 @@ int64_t grpc_tcp_client_create_from_prepared_fd(
|
|
342
347
|
if (err >= 0) {
|
343
348
|
// Connection already succeded. Return 0 to discourage any cancellation
|
344
349
|
// attempts.
|
345
|
-
*ep = grpc_tcp_client_create_from_fd(fdobj,
|
350
|
+
*ep = grpc_tcp_client_create_from_fd(fdobj, options, addr_uri.value());
|
346
351
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure, GRPC_ERROR_NONE);
|
347
352
|
return 0;
|
348
353
|
}
|
@@ -371,7 +376,7 @@ int64_t grpc_tcp_client_create_from_prepared_fd(
|
|
371
376
|
ac->refs = 2;
|
372
377
|
GRPC_CLOSURE_INIT(&ac->write_closure, on_writable, ac,
|
373
378
|
grpc_schedule_on_exec_ctx);
|
374
|
-
ac->
|
379
|
+
ac->options = options;
|
375
380
|
|
376
381
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
|
377
382
|
gpr_log(GPR_INFO, "CLIENT_CONNECT: %s: asynchronously connecting fd %p",
|
@@ -395,21 +400,21 @@ int64_t grpc_tcp_client_create_from_prepared_fd(
|
|
395
400
|
|
396
401
|
static int64_t tcp_connect(grpc_closure* closure, grpc_endpoint** ep,
|
397
402
|
grpc_pollset_set* interested_parties,
|
398
|
-
const
|
403
|
+
const EndpointConfig& config,
|
399
404
|
const grpc_resolved_address* addr,
|
400
405
|
grpc_core::Timestamp deadline) {
|
401
406
|
grpc_resolved_address mapped_addr;
|
407
|
+
grpc_core::PosixTcpOptions options(TcpOptionsFromEndpointConfig(config));
|
402
408
|
int fd = -1;
|
403
409
|
grpc_error_handle error;
|
404
410
|
*ep = nullptr;
|
405
|
-
if ((error = grpc_tcp_client_prepare_fd(
|
406
|
-
|
411
|
+
if ((error = grpc_tcp_client_prepare_fd(options, addr, &mapped_addr, &fd)) !=
|
412
|
+
GRPC_ERROR_NONE) {
|
407
413
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure, error);
|
408
414
|
return 0;
|
409
415
|
}
|
410
|
-
return grpc_tcp_client_create_from_prepared_fd(
|
411
|
-
|
412
|
-
deadline, ep);
|
416
|
+
return grpc_tcp_client_create_from_prepared_fd(
|
417
|
+
interested_parties, closure, fd, options, &mapped_addr, deadline, ep);
|
413
418
|
}
|
414
419
|
|
415
420
|
static bool tcp_cancel_connect(int64_t connection_handle) {
|
@@ -458,7 +463,6 @@ static bool tcp_cancel_connect(int64_t connection_handle) {
|
|
458
463
|
// This is safe even outside the lock, because "done", the sentinel, is
|
459
464
|
// populated *inside* the lock.
|
460
465
|
gpr_mu_destroy(&ac->mu);
|
461
|
-
grpc_channel_args_destroy(ac->channel_args);
|
462
466
|
delete ac;
|
463
467
|
}
|
464
468
|
return connection_cancel_success;
|
@@ -23,23 +23,24 @@
|
|
23
23
|
|
24
24
|
#include "src/core/lib/iomgr/endpoint.h"
|
25
25
|
#include "src/core/lib/iomgr/ev_posix.h"
|
26
|
+
#include "src/core/lib/iomgr/socket_utils_posix.h"
|
26
27
|
#include "src/core/lib/iomgr/tcp_client.h"
|
27
28
|
|
28
29
|
/* Create an endpoint from a connected grpc_fd.
|
29
30
|
|
30
31
|
fd: a connected FD. Ownership is taken.
|
31
|
-
|
32
|
+
config: may contain custom settings for the endpoint
|
32
33
|
addr_str: destination address in printable format
|
33
34
|
slice_allocator: ownership is taken by client.
|
34
35
|
Returns: a new endpoint
|
35
36
|
*/
|
36
|
-
grpc_endpoint*
|
37
|
-
grpc_fd* fd, const
|
37
|
+
grpc_endpoint* grpc_tcp_create_from_fd(
|
38
|
+
grpc_fd* fd, const grpc_event_engine::experimental::EndpointConfig& config,
|
38
39
|
absl::string_view addr_str);
|
39
40
|
|
40
41
|
/* Return a configured, unbound, unconnected TCP client fd.
|
41
42
|
|
42
|
-
|
43
|
+
options: may contain custom settings for the fd
|
43
44
|
addr: the destination address
|
44
45
|
mapped_addr: out parameter. addr mapped to an address appropriate to the
|
45
46
|
type of socket FD created. For example, if addr is IPv4 and dual stack
|
@@ -48,8 +49,9 @@ grpc_endpoint* grpc_tcp_client_create_from_fd(
|
|
48
49
|
Returns: error, if any. Out parameters are not set on error
|
49
50
|
*/
|
50
51
|
grpc_error_handle grpc_tcp_client_prepare_fd(
|
51
|
-
const
|
52
|
-
grpc_resolved_address*
|
52
|
+
const grpc_core::PosixTcpOptions& options,
|
53
|
+
const grpc_resolved_address* addr, grpc_resolved_address* mapped_addr,
|
54
|
+
int* fd);
|
53
55
|
|
54
56
|
/* Connect a configured TCP client fd.
|
55
57
|
|
@@ -57,13 +59,14 @@ grpc_error_handle grpc_tcp_client_prepare_fd(
|
|
57
59
|
connection being established (in order to continue their work
|
58
60
|
closure: called when complete. On success, *ep will be set.
|
59
61
|
fd: an FD returned from grpc_tcp_client_prepare_fd().
|
60
|
-
|
62
|
+
options: may contain custom settings for the endpoint
|
61
63
|
deadline: connection deadline
|
62
64
|
ep: out parameter. Set before closure is called if successful
|
63
65
|
*/
|
64
66
|
int64_t grpc_tcp_client_create_from_prepared_fd(
|
65
67
|
grpc_pollset_set* interested_parties, grpc_closure* closure, const int fd,
|
66
|
-
const
|
67
|
-
grpc_core::Timestamp deadline,
|
68
|
+
const grpc_core::PosixTcpOptions& options,
|
69
|
+
const grpc_resolved_address* addr, grpc_core::Timestamp deadline,
|
70
|
+
grpc_endpoint** ep);
|
68
71
|
|
69
72
|
#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */
|
@@ -24,13 +24,13 @@
|
|
24
24
|
|
25
25
|
#ifdef GRPC_WINSOCK_SOCKET
|
26
26
|
|
27
|
+
#include <grpc/event_engine/endpoint_config.h>
|
27
28
|
#include <grpc/slice_buffer.h>
|
28
29
|
#include <grpc/support/alloc.h>
|
29
30
|
#include <grpc/support/log.h>
|
30
31
|
#include <grpc/support/log_windows.h>
|
31
32
|
|
32
33
|
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
33
|
-
#include "src/core/lib/channel/channel_args.h"
|
34
34
|
#include "src/core/lib/iomgr/iocp_windows.h"
|
35
35
|
#include "src/core/lib/iomgr/sockaddr.h"
|
36
36
|
#include "src/core/lib/iomgr/sockaddr_windows.h"
|
@@ -38,8 +38,11 @@
|
|
38
38
|
#include "src/core/lib/iomgr/tcp_client.h"
|
39
39
|
#include "src/core/lib/iomgr/tcp_windows.h"
|
40
40
|
#include "src/core/lib/iomgr/timer.h"
|
41
|
+
#include "src/core/lib/resource_quota/api.h"
|
41
42
|
#include "src/core/lib/slice/slice_internal.h"
|
42
43
|
|
44
|
+
using ::grpc_event_engine::experimental::EndpointConfig;
|
45
|
+
|
43
46
|
struct async_connect {
|
44
47
|
grpc_closure* on_done;
|
45
48
|
gpr_mu mu;
|
@@ -50,7 +53,6 @@ struct async_connect {
|
|
50
53
|
int refs;
|
51
54
|
grpc_closure on_connect;
|
52
55
|
grpc_endpoint** endpoint;
|
53
|
-
grpc_channel_args* channel_args;
|
54
56
|
};
|
55
57
|
|
56
58
|
static void async_connect_unlock_and_cleanup(async_connect* ac,
|
@@ -58,7 +60,6 @@ static void async_connect_unlock_and_cleanup(async_connect* ac,
|
|
58
60
|
int done = (--ac->refs == 0);
|
59
61
|
gpr_mu_unlock(&ac->mu);
|
60
62
|
if (done) {
|
61
|
-
grpc_channel_args_destroy(ac->channel_args);
|
62
63
|
gpr_mu_destroy(&ac->mu);
|
63
64
|
delete ac;
|
64
65
|
}
|
@@ -105,7 +106,7 @@ static void on_connect(void* acp, grpc_error_handle error) {
|
|
105
106
|
error = GRPC_WSA_ERROR(WSAGetLastError(), "ConnectEx");
|
106
107
|
closesocket(socket->socket);
|
107
108
|
} else {
|
108
|
-
*ep = grpc_tcp_create(socket, ac->
|
109
|
+
*ep = grpc_tcp_create(socket, ac->addr_name);
|
109
110
|
socket = nullptr;
|
110
111
|
}
|
111
112
|
} else {
|
@@ -123,7 +124,7 @@ static void on_connect(void* acp, grpc_error_handle error) {
|
|
123
124
|
notification request for the connection, and one timeout alert. */
|
124
125
|
static int64_t tcp_connect(grpc_closure* on_done, grpc_endpoint** endpoint,
|
125
126
|
grpc_pollset_set* interested_parties,
|
126
|
-
const
|
127
|
+
const EndpointConfig& config,
|
127
128
|
const grpc_resolved_address* addr,
|
128
129
|
grpc_core::Timestamp deadline) {
|
129
130
|
SOCKET sock = INVALID_SOCKET;
|
@@ -208,7 +209,6 @@ static int64_t tcp_connect(grpc_closure* on_done, grpc_endpoint** endpoint,
|
|
208
209
|
ac->refs = 2;
|
209
210
|
ac->addr_name = addr_uri.value();
|
210
211
|
ac->endpoint = endpoint;
|
211
|
-
ac->channel_args = grpc_channel_args_copy(channel_args);
|
212
212
|
GRPC_CLOSURE_INIT(&ac->on_connect, on_connect, ac, grpc_schedule_on_exec_ctx);
|
213
213
|
|
214
214
|
GRPC_CLOSURE_INIT(&ac->on_alarm, on_alarm, ac, grpc_schedule_on_exec_ctx);
|