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
@@ -176,30 +176,14 @@ class ExecCtx {
|
|
176
176
|
}
|
177
177
|
}
|
178
178
|
|
179
|
-
|
180
|
-
|
181
|
-
* value.
|
182
|
-
*/
|
183
|
-
Timestamp Now();
|
184
|
-
|
185
|
-
/** Invalidates the stored time value. A new time value will be set on calling
|
186
|
-
* Now().
|
187
|
-
*/
|
188
|
-
void InvalidateNow() { now_is_valid_ = false; }
|
189
|
-
|
190
|
-
/** To be used only by shutdown code in iomgr */
|
179
|
+
Timestamp Now() { return Timestamp::Now(); }
|
180
|
+
void InvalidateNow() { time_cache_.InvalidateCache(); }
|
191
181
|
void SetNowIomgrShutdown() {
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
/** To be used only for testing.
|
197
|
-
* Sets the now value.
|
198
|
-
*/
|
199
|
-
void TestOnlySetNow(Timestamp new_val) {
|
200
|
-
now_ = new_val;
|
201
|
-
now_is_valid_ = true;
|
182
|
+
// We get to do a test only set now on this path just because iomgr
|
183
|
+
// is getting removed and no point adding more interfaces for it.
|
184
|
+
time_cache_.TestOnlySetNow(Timestamp::InfFuture());
|
202
185
|
}
|
186
|
+
void TestOnlySetNow(Timestamp now) { time_cache_.TestOnlySetNow(now); }
|
203
187
|
|
204
188
|
/** Gets pointer to current exec_ctx. */
|
205
189
|
static ExecCtx* Get() { return exec_ctx_; }
|
@@ -226,9 +210,7 @@ class ExecCtx {
|
|
226
210
|
|
227
211
|
unsigned starting_cpu_ = std::numeric_limits<unsigned>::max();
|
228
212
|
|
229
|
-
|
230
|
-
Timestamp now_;
|
231
|
-
|
213
|
+
ScopedTimeCache time_cache_;
|
232
214
|
static GPR_THREAD_LOCAL(ExecCtx*) exec_ctx_;
|
233
215
|
ExecCtx* last_exec_ctx_ = Get();
|
234
216
|
};
|
@@ -338,12 +320,6 @@ class ApplicationCallbackExecCtx {
|
|
338
320
|
ctx->tail_ = functor;
|
339
321
|
}
|
340
322
|
|
341
|
-
/** Global initialization for ApplicationCallbackExecCtx. Called by init. */
|
342
|
-
static void GlobalInit(void) {}
|
343
|
-
|
344
|
-
/** Global shutdown for ApplicationCallbackExecCtx. Called by init. */
|
345
|
-
static void GlobalShutdown(void) {}
|
346
|
-
|
347
323
|
static bool Available() { return Get() != nullptr; }
|
348
324
|
|
349
325
|
private:
|
@@ -48,7 +48,7 @@ static DWORD deadline_to_millis_timeout(grpc_core::Timestamp deadline) {
|
|
48
48
|
if (deadline == grpc_core::Timestamp::InfFuture()) {
|
49
49
|
return INFINITE;
|
50
50
|
}
|
51
|
-
grpc_core::Timestamp now = grpc_core::
|
51
|
+
grpc_core::Timestamp now = grpc_core::Timestamp::Now();
|
52
52
|
if (deadline < now) return 0;
|
53
53
|
grpc_core::Duration timeout = deadline - now;
|
54
54
|
if (timeout.millis() > std::numeric_limits<DWORD>::max()) return INFINITE;
|
@@ -63,7 +63,6 @@ grpc_iocp_work_status grpc_iocp_work(grpc_core::Timestamp deadline) {
|
|
63
63
|
LPOVERLAPPED overlapped;
|
64
64
|
grpc_winsocket* socket;
|
65
65
|
grpc_winsocket_callback_info* info;
|
66
|
-
GRPC_STATS_INC_SYSCALL_POLL();
|
67
66
|
success =
|
68
67
|
GetQueuedCompletionStatus(g_iocp, &bytes, &completion_key, &overlapped,
|
69
68
|
deadline_to_millis_timeout(deadline));
|
data/src/core/lib/iomgr/iomgr.cc
CHANGED
@@ -45,13 +45,6 @@ GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_abort_on_leaks, false,
|
|
45
45
|
"A debugging aid to cause a call to abort() when "
|
46
46
|
"gRPC objects are leaked past grpc_shutdown()");
|
47
47
|
|
48
|
-
GPR_GLOBAL_CONFIG_DEFINE_BOOL(
|
49
|
-
grpc_experimental_enable_tcp_frame_size_tuning, false,
|
50
|
-
"If set, enables TCP to use RPC size estimation made by higher layers. TCP "
|
51
|
-
"would not indicate completion of a read operation until a specified "
|
52
|
-
"number of bytes have been read over the socket. Buffers are also "
|
53
|
-
"allocated according to estimated RPC sizes.");
|
54
|
-
|
55
48
|
static gpr_mu g_mu;
|
56
49
|
static gpr_cv g_rcv;
|
57
50
|
static int g_shutdown;
|
@@ -85,7 +78,12 @@ static size_t count_objects(void) {
|
|
85
78
|
return n;
|
86
79
|
}
|
87
80
|
|
88
|
-
size_t grpc_iomgr_count_objects_for_testing(void) {
|
81
|
+
size_t grpc_iomgr_count_objects_for_testing(void) {
|
82
|
+
gpr_mu_lock(&g_mu);
|
83
|
+
size_t ret = count_objects();
|
84
|
+
gpr_mu_unlock(&g_mu);
|
85
|
+
return ret;
|
86
|
+
}
|
89
87
|
|
90
88
|
static void dump_objects(const char* kind) {
|
91
89
|
grpc_iomgr_object* obj;
|
@@ -25,6 +25,7 @@
|
|
25
25
|
#include <grpc/support/time.h>
|
26
26
|
|
27
27
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
28
|
+
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
28
29
|
|
29
30
|
extern grpc_core::DebugOnlyTraceFlag grpc_trace_fd_refcount;
|
30
31
|
|
@@ -35,7 +36,6 @@ extern grpc_core::DebugOnlyTraceFlag grpc_trace_fd_refcount;
|
|
35
36
|
- a completion queue might keep a pollset with an entry for each transport
|
36
37
|
that is servicing a call that it's tracking */
|
37
38
|
|
38
|
-
typedef struct grpc_pollset grpc_pollset;
|
39
39
|
typedef struct grpc_pollset_worker grpc_pollset_worker;
|
40
40
|
|
41
41
|
typedef struct grpc_pollset_vtable {
|
@@ -22,7 +22,6 @@
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
24
|
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
25
|
-
#include "src/core/lib/iomgr/pollset.h"
|
26
25
|
|
27
26
|
/* A grpc_pollset_set is a set of pollsets that are interested in an
|
28
27
|
action. Adding a pollset to a pollset_set automatically adds any
|
@@ -28,6 +28,7 @@
|
|
28
28
|
#include <grpc/event_engine/event_engine.h>
|
29
29
|
|
30
30
|
#include "src/core/lib/gprpp/orphanable.h"
|
31
|
+
#include "src/core/lib/gprpp/time.h"
|
31
32
|
#include "src/core/lib/iomgr/pollset_set.h"
|
32
33
|
#include "src/core/lib/iomgr/port.h"
|
33
34
|
#include "src/core/lib/iomgr/resolved_address.h"
|
@@ -35,6 +35,7 @@
|
|
35
35
|
#include "src/core/lib/gprpp/host_port.h"
|
36
36
|
#include "src/core/lib/gprpp/thd.h"
|
37
37
|
#include "src/core/lib/iomgr/block_annotate.h"
|
38
|
+
#include "src/core/lib/iomgr/exec_ctx.h"
|
38
39
|
#include "src/core/lib/iomgr/executor.h"
|
39
40
|
#include "src/core/lib/iomgr/iomgr_internal.h"
|
40
41
|
#include "src/core/lib/iomgr/resolve_address.h"
|
@@ -39,6 +39,7 @@
|
|
39
39
|
#include "src/core/lib/gprpp/host_port.h"
|
40
40
|
#include "src/core/lib/gprpp/thd.h"
|
41
41
|
#include "src/core/lib/iomgr/block_annotate.h"
|
42
|
+
#include "src/core/lib/iomgr/exec_ctx.h"
|
42
43
|
#include "src/core/lib/iomgr/executor.h"
|
43
44
|
#include "src/core/lib/iomgr/iomgr_internal.h"
|
44
45
|
#include "src/core/lib/iomgr/resolve_address.h"
|
@@ -23,6 +23,8 @@
|
|
23
23
|
#ifdef GRPC_POSIX_SOCKET_UTILS_COMMON
|
24
24
|
|
25
25
|
#include "src/core/lib/iomgr/socket_utils.h"
|
26
|
+
// sys/types.h must precede netinet/tcp.h for compatibility.
|
27
|
+
#include <sys/types.h>
|
26
28
|
#ifdef GRPC_LINUX_TCP_H
|
27
29
|
#include <linux/tcp.h>
|
28
30
|
#else
|
@@ -31,7 +33,6 @@
|
|
31
33
|
#include <stdio.h>
|
32
34
|
#include <string.h>
|
33
35
|
#include <sys/socket.h>
|
34
|
-
#include <sys/types.h>
|
35
36
|
#include <unistd.h>
|
36
37
|
|
37
38
|
#include <string>
|
@@ -43,12 +43,12 @@
|
|
43
43
|
|
44
44
|
#include <string>
|
45
45
|
|
46
|
+
#include <grpc/event_engine/endpoint_config.h>
|
46
47
|
#include <grpc/support/alloc.h>
|
47
48
|
#include <grpc/support/log.h>
|
48
49
|
#include <grpc/support/sync.h>
|
49
50
|
|
50
51
|
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
51
|
-
#include "src/core/lib/channel/channel_args.h"
|
52
52
|
#include "src/core/lib/gpr/string.h"
|
53
53
|
#include "src/core/lib/iomgr/sockaddr.h"
|
54
54
|
|
@@ -298,10 +298,9 @@ void config_default_tcp_user_timeout(bool enable, int timeout, bool is_client) {
|
|
298
298
|
|
299
299
|
/* Set TCP_USER_TIMEOUT */
|
300
300
|
grpc_error_handle grpc_set_socket_tcp_user_timeout(
|
301
|
-
int fd, const
|
301
|
+
int fd, const grpc_core::PosixTcpOptions& options, bool is_client) {
|
302
302
|
// Use conditionally-important parameter to avoid warning
|
303
303
|
(void)fd;
|
304
|
-
(void)channel_args;
|
305
304
|
(void)is_client;
|
306
305
|
extern grpc_core::TraceFlag grpc_tcp_trace;
|
307
306
|
if (g_socket_supports_tcp_user_timeout.load() >= 0) {
|
@@ -314,29 +313,13 @@ grpc_error_handle grpc_set_socket_tcp_user_timeout(
|
|
314
313
|
enable = g_default_server_tcp_user_timeout_enabled;
|
315
314
|
timeout = g_default_server_tcp_user_timeout_ms;
|
316
315
|
}
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
if (value == 0) {
|
325
|
-
continue;
|
326
|
-
}
|
327
|
-
/* Disable if value is INT_MAX */
|
328
|
-
enable = value != INT_MAX;
|
329
|
-
} else if (0 == strcmp(channel_args->args[i].key,
|
330
|
-
GRPC_ARG_KEEPALIVE_TIMEOUT_MS)) {
|
331
|
-
const int value = grpc_channel_arg_get_integer(
|
332
|
-
&channel_args->args[i], grpc_integer_options{0, 1, INT_MAX});
|
333
|
-
/* Continue using default if value is 0 */
|
334
|
-
if (value == 0) {
|
335
|
-
continue;
|
336
|
-
}
|
337
|
-
timeout = value;
|
338
|
-
}
|
339
|
-
}
|
316
|
+
int value = options.keep_alive_time_ms;
|
317
|
+
if (value > 0) {
|
318
|
+
enable = value != INT_MAX;
|
319
|
+
}
|
320
|
+
value = options.keep_alive_timeout_ms;
|
321
|
+
if (value > 0) {
|
322
|
+
timeout = value;
|
340
323
|
}
|
341
324
|
if (enable) {
|
342
325
|
int newval;
|
@@ -398,16 +381,11 @@ grpc_error_handle grpc_set_socket_with_mutator(int fd, grpc_fd_usage usage,
|
|
398
381
|
}
|
399
382
|
|
400
383
|
grpc_error_handle grpc_apply_socket_mutator_in_args(
|
401
|
-
int fd, grpc_fd_usage usage, const
|
402
|
-
|
403
|
-
grpc_channel_args_find(args, GRPC_ARG_SOCKET_MUTATOR);
|
404
|
-
if (socket_mutator_arg == nullptr) {
|
384
|
+
int fd, grpc_fd_usage usage, const grpc_core::PosixTcpOptions& options) {
|
385
|
+
if (options.socket_mutator == nullptr) {
|
405
386
|
return GRPC_ERROR_NONE;
|
406
387
|
}
|
407
|
-
|
408
|
-
grpc_socket_mutator* mutator =
|
409
|
-
static_cast<grpc_socket_mutator*>(socket_mutator_arg->value.pointer.p);
|
410
|
-
return grpc_set_socket_with_mutator(fd, usage, mutator);
|
388
|
+
return grpc_set_socket_with_mutator(fd, usage, options.socket_mutator);
|
411
389
|
}
|
412
390
|
|
413
391
|
static gpr_once g_probe_ipv6_once = GPR_ONCE_INIT;
|
@@ -18,18 +18,100 @@
|
|
18
18
|
|
19
19
|
#include <grpc/support/port_platform.h>
|
20
20
|
|
21
|
+
#include "absl/types/optional.h"
|
22
|
+
|
21
23
|
#include "src/core/lib/iomgr/port.h"
|
22
24
|
|
23
25
|
#ifdef GRPC_POSIX_SOCKETUTILS
|
24
|
-
|
25
26
|
#include <fcntl.h>
|
26
27
|
#include <sys/socket.h>
|
27
28
|
#include <unistd.h>
|
28
29
|
|
30
|
+
#include <grpc/impl/codegen/grpc_types.h>
|
29
31
|
#include <grpc/support/log.h>
|
30
32
|
|
31
33
|
#include "src/core/lib/iomgr/sockaddr.h"
|
32
34
|
#include "src/core/lib/iomgr/socket_utils_posix.h"
|
35
|
+
#endif
|
36
|
+
|
37
|
+
#ifdef GRPC_POSIX_SOCKET_TCP
|
38
|
+
|
39
|
+
#include "src/core/lib/event_engine/channel_args_endpoint_config.h"
|
40
|
+
#include "src/core/lib/iomgr/socket_utils_posix.h"
|
41
|
+
|
42
|
+
using ::grpc_event_engine::experimental::EndpointConfig;
|
43
|
+
|
44
|
+
using ::grpc_core::PosixTcpOptions;
|
45
|
+
|
46
|
+
namespace {
|
47
|
+
|
48
|
+
int AdjustValue(int default_value, int min_value, int max_value,
|
49
|
+
absl::optional<int> actual_value) {
|
50
|
+
if (!actual_value.has_value() || *actual_value < min_value ||
|
51
|
+
*actual_value > max_value) {
|
52
|
+
return default_value;
|
53
|
+
}
|
54
|
+
return *actual_value;
|
55
|
+
}
|
56
|
+
} // namespace
|
57
|
+
|
58
|
+
PosixTcpOptions TcpOptionsFromEndpointConfig(const EndpointConfig& config) {
|
59
|
+
void* value;
|
60
|
+
PosixTcpOptions options;
|
61
|
+
options.tcp_read_chunk_size = AdjustValue(
|
62
|
+
PosixTcpOptions::kDefaultReadChunkSize, 1, PosixTcpOptions::kMaxChunkSize,
|
63
|
+
config.GetInt(GRPC_ARG_TCP_READ_CHUNK_SIZE));
|
64
|
+
options.tcp_min_read_chunk_size =
|
65
|
+
AdjustValue(PosixTcpOptions::kDefaultMinReadChunksize, 1,
|
66
|
+
PosixTcpOptions::kMaxChunkSize,
|
67
|
+
config.GetInt(GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE));
|
68
|
+
options.tcp_max_read_chunk_size =
|
69
|
+
AdjustValue(PosixTcpOptions::kDefaultMaxReadChunksize, 1,
|
70
|
+
PosixTcpOptions::kMaxChunkSize,
|
71
|
+
config.GetInt(GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE));
|
72
|
+
options.tcp_tx_zerocopy_send_bytes_threshold =
|
73
|
+
AdjustValue(PosixTcpOptions::kDefaultSendBytesThreshold, 0, INT_MAX,
|
74
|
+
config.GetInt(GRPC_ARG_TCP_TX_ZEROCOPY_SEND_BYTES_THRESHOLD));
|
75
|
+
options.tcp_tx_zerocopy_max_simultaneous_sends =
|
76
|
+
AdjustValue(PosixTcpOptions::kDefaultMaxSends, 0, INT_MAX,
|
77
|
+
config.GetInt(GRPC_ARG_TCP_TX_ZEROCOPY_MAX_SIMULT_SENDS));
|
78
|
+
options.tcp_tx_zero_copy_enabled =
|
79
|
+
(AdjustValue(PosixTcpOptions::kZerocpTxEnabledDefault, 0, 1,
|
80
|
+
config.GetInt(GRPC_ARG_TCP_TX_ZEROCOPY_ENABLED)) != 0);
|
81
|
+
options.keep_alive_time_ms =
|
82
|
+
AdjustValue(0, 1, INT_MAX, config.GetInt(GRPC_ARG_KEEPALIVE_TIME_MS));
|
83
|
+
options.keep_alive_timeout_ms =
|
84
|
+
AdjustValue(0, 1, INT_MAX, config.GetInt(GRPC_ARG_KEEPALIVE_TIMEOUT_MS));
|
85
|
+
options.expand_wildcard_addrs =
|
86
|
+
(AdjustValue(0, 1, INT_MAX,
|
87
|
+
config.GetInt(GRPC_ARG_EXPAND_WILDCARD_ADDRS)) != 0);
|
88
|
+
options.allow_reuse_port =
|
89
|
+
(AdjustValue(0, 1, INT_MAX, config.GetInt(GRPC_ARG_ALLOW_REUSEPORT)) !=
|
90
|
+
0);
|
91
|
+
|
92
|
+
if (options.tcp_min_read_chunk_size > options.tcp_max_read_chunk_size) {
|
93
|
+
options.tcp_min_read_chunk_size = options.tcp_max_read_chunk_size;
|
94
|
+
}
|
95
|
+
options.tcp_read_chunk_size = grpc_core::Clamp(
|
96
|
+
options.tcp_read_chunk_size, options.tcp_min_read_chunk_size,
|
97
|
+
options.tcp_max_read_chunk_size);
|
98
|
+
|
99
|
+
value = config.GetVoidPointer(GRPC_ARG_RESOURCE_QUOTA);
|
100
|
+
if (value != nullptr) {
|
101
|
+
options.resource_quota =
|
102
|
+
reinterpret_cast<grpc_core::ResourceQuota*>(value)->Ref();
|
103
|
+
}
|
104
|
+
value = config.GetVoidPointer(GRPC_ARG_SOCKET_MUTATOR);
|
105
|
+
if (value != nullptr) {
|
106
|
+
options.socket_mutator =
|
107
|
+
grpc_socket_mutator_ref(static_cast<grpc_socket_mutator*>(value));
|
108
|
+
}
|
109
|
+
return options;
|
110
|
+
}
|
111
|
+
|
112
|
+
#endif /* GRPC_POSIX_SOCKET_TCP */
|
113
|
+
|
114
|
+
#ifdef GRPC_POSIX_SOCKETUTILS
|
33
115
|
|
34
116
|
int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock,
|
35
117
|
int cloexec) {
|
@@ -21,15 +21,14 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
-
#include <
|
25
|
-
#include <unistd.h>
|
26
|
-
|
24
|
+
#include <grpc/event_engine/endpoint_config.h>
|
27
25
|
#include <grpc/impl/codegen/grpc_types.h>
|
28
26
|
|
29
27
|
#include "src/core/lib/iomgr/error.h"
|
30
28
|
#include "src/core/lib/iomgr/resolve_address.h"
|
31
29
|
#include "src/core/lib/iomgr/socket_factory_posix.h"
|
32
30
|
#include "src/core/lib/iomgr/socket_mutator.h"
|
31
|
+
#include "src/core/lib/resource_quota/resource_quota.h"
|
33
32
|
|
34
33
|
#ifdef GRPC_LINUX_ERRQUEUE
|
35
34
|
#ifndef SO_ZEROCOPY
|
@@ -40,6 +39,98 @@
|
|
40
39
|
#endif
|
41
40
|
#endif /* ifdef GRPC_LINUX_ERRQUEUE */
|
42
41
|
|
42
|
+
namespace grpc_core {
|
43
|
+
|
44
|
+
struct PosixTcpOptions {
|
45
|
+
static constexpr int kDefaultReadChunkSize = 8192;
|
46
|
+
static constexpr int kDefaultMinReadChunksize = 256;
|
47
|
+
static constexpr int kDefaultMaxReadChunksize = 4 * 1024 * 1024;
|
48
|
+
static constexpr int kZerocpTxEnabledDefault = 0;
|
49
|
+
static constexpr int kMaxChunkSize = 32 * 1024 * 1024;
|
50
|
+
static constexpr int kDefaultMaxSends = 4;
|
51
|
+
static constexpr size_t kDefaultSendBytesThreshold = 16 * 1024;
|
52
|
+
int tcp_read_chunk_size = kDefaultReadChunkSize;
|
53
|
+
int tcp_min_read_chunk_size = kDefaultMinReadChunksize;
|
54
|
+
int tcp_max_read_chunk_size = kDefaultMaxReadChunksize;
|
55
|
+
int tcp_tx_zerocopy_send_bytes_threshold = kDefaultSendBytesThreshold;
|
56
|
+
int tcp_tx_zerocopy_max_simultaneous_sends = kDefaultMaxSends;
|
57
|
+
bool tcp_tx_zero_copy_enabled = kZerocpTxEnabledDefault;
|
58
|
+
int keep_alive_time_ms = 0;
|
59
|
+
int keep_alive_timeout_ms = 0;
|
60
|
+
bool expand_wildcard_addrs = false;
|
61
|
+
bool allow_reuse_port = false;
|
62
|
+
RefCountedPtr<ResourceQuota> resource_quota;
|
63
|
+
struct grpc_socket_mutator* socket_mutator = nullptr;
|
64
|
+
PosixTcpOptions() = default;
|
65
|
+
// Move ctor
|
66
|
+
PosixTcpOptions(PosixTcpOptions&& other) noexcept {
|
67
|
+
socket_mutator = absl::exchange(other.socket_mutator, nullptr);
|
68
|
+
resource_quota = std::move(other.resource_quota);
|
69
|
+
CopyIntegerOptions(other);
|
70
|
+
}
|
71
|
+
// Move assignment
|
72
|
+
PosixTcpOptions& operator=(PosixTcpOptions&& other) noexcept {
|
73
|
+
if (socket_mutator != nullptr) {
|
74
|
+
grpc_socket_mutator_unref(socket_mutator);
|
75
|
+
}
|
76
|
+
socket_mutator = absl::exchange(other.socket_mutator, nullptr);
|
77
|
+
resource_quota = std::move(other.resource_quota);
|
78
|
+
CopyIntegerOptions(other);
|
79
|
+
return *this;
|
80
|
+
}
|
81
|
+
// Copy ctor
|
82
|
+
PosixTcpOptions(const PosixTcpOptions& other) {
|
83
|
+
if (other.socket_mutator != nullptr) {
|
84
|
+
socket_mutator = grpc_socket_mutator_ref(other.socket_mutator);
|
85
|
+
}
|
86
|
+
resource_quota = other.resource_quota;
|
87
|
+
CopyIntegerOptions(other);
|
88
|
+
}
|
89
|
+
// Copy assignment
|
90
|
+
PosixTcpOptions& operator=(const PosixTcpOptions& other) {
|
91
|
+
if (&other == this) {
|
92
|
+
return *this;
|
93
|
+
}
|
94
|
+
if (socket_mutator != nullptr) {
|
95
|
+
grpc_socket_mutator_unref(socket_mutator);
|
96
|
+
socket_mutator = nullptr;
|
97
|
+
}
|
98
|
+
if (other.socket_mutator != nullptr) {
|
99
|
+
socket_mutator = grpc_socket_mutator_ref(other.socket_mutator);
|
100
|
+
}
|
101
|
+
resource_quota = other.resource_quota;
|
102
|
+
CopyIntegerOptions(other);
|
103
|
+
return *this;
|
104
|
+
}
|
105
|
+
// Destructor.
|
106
|
+
~PosixTcpOptions() {
|
107
|
+
if (socket_mutator != nullptr) {
|
108
|
+
grpc_socket_mutator_unref(socket_mutator);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
private:
|
113
|
+
void CopyIntegerOptions(const PosixTcpOptions& other) {
|
114
|
+
tcp_read_chunk_size = other.tcp_read_chunk_size;
|
115
|
+
tcp_min_read_chunk_size = other.tcp_min_read_chunk_size;
|
116
|
+
tcp_max_read_chunk_size = other.tcp_max_read_chunk_size;
|
117
|
+
tcp_tx_zerocopy_send_bytes_threshold =
|
118
|
+
other.tcp_tx_zerocopy_send_bytes_threshold;
|
119
|
+
tcp_tx_zerocopy_max_simultaneous_sends =
|
120
|
+
other.tcp_tx_zerocopy_max_simultaneous_sends;
|
121
|
+
tcp_tx_zero_copy_enabled = other.tcp_tx_zero_copy_enabled;
|
122
|
+
keep_alive_time_ms = other.keep_alive_time_ms;
|
123
|
+
keep_alive_timeout_ms = other.keep_alive_timeout_ms;
|
124
|
+
expand_wildcard_addrs = other.expand_wildcard_addrs;
|
125
|
+
allow_reuse_port = other.allow_reuse_port;
|
126
|
+
}
|
127
|
+
};
|
128
|
+
|
129
|
+
} // namespace grpc_core
|
130
|
+
|
131
|
+
grpc_core::PosixTcpOptions TcpOptionsFromEndpointConfig(
|
132
|
+
const grpc_event_engine::experimental::EndpointConfig& config);
|
133
|
+
|
43
134
|
/* a wrapper for accept or accept4 */
|
44
135
|
int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock,
|
45
136
|
int cloexec);
|
@@ -70,7 +161,7 @@ void config_default_tcp_user_timeout(bool enable, int timeout, bool is_client);
|
|
70
161
|
|
71
162
|
/* Set TCP_USER_TIMEOUT */
|
72
163
|
grpc_error_handle grpc_set_socket_tcp_user_timeout(
|
73
|
-
int fd, const
|
164
|
+
int fd, const grpc_core::PosixTcpOptions& options, bool is_client);
|
74
165
|
|
75
166
|
/* Returns true if this system can create AF_INET6 sockets bound to ::1.
|
76
167
|
The value is probed once, and cached for the life of the process.
|
@@ -104,9 +195,10 @@ grpc_error_handle grpc_set_socket_rcvbuf(int fd, int buffer_size_bytes);
|
|
104
195
|
grpc_error_handle grpc_set_socket_with_mutator(int fd, grpc_fd_usage usage,
|
105
196
|
grpc_socket_mutator* mutator);
|
106
197
|
|
107
|
-
/* Extracts the first socket mutator from
|
198
|
+
/* Extracts the first socket mutator from config if any and applies on the fd.
|
199
|
+
*/
|
108
200
|
grpc_error_handle grpc_apply_socket_mutator_in_args(
|
109
|
-
int fd, grpc_fd_usage usage, const
|
201
|
+
int fd, grpc_fd_usage usage, const grpc_core::PosixTcpOptions& options);
|
110
202
|
|
111
203
|
/* An enum to keep track of IPv4/IPv6 socket modes.
|
112
204
|
|
@@ -22,14 +22,13 @@
|
|
22
22
|
|
23
23
|
grpc_tcp_client_vtable* grpc_tcp_client_impl;
|
24
24
|
|
25
|
-
int64_t grpc_tcp_client_connect(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
grpc_core::Timestamp deadline) {
|
25
|
+
int64_t grpc_tcp_client_connect(
|
26
|
+
grpc_closure* on_connect, grpc_endpoint** endpoint,
|
27
|
+
grpc_pollset_set* interested_parties,
|
28
|
+
const grpc_event_engine::experimental::EndpointConfig& config,
|
29
|
+
const grpc_resolved_address* addr, grpc_core::Timestamp deadline) {
|
31
30
|
return grpc_tcp_client_impl->connect(on_connect, endpoint, interested_parties,
|
32
|
-
|
31
|
+
config, addr, deadline);
|
33
32
|
}
|
34
33
|
|
35
34
|
bool grpc_tcp_client_cancel_connect(int64_t connection_handle) {
|
@@ -21,6 +21,7 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
+
#include <grpc/event_engine/endpoint_config.h>
|
24
25
|
#include <grpc/impl/codegen/grpc_types.h>
|
25
26
|
#include <grpc/support/time.h>
|
26
27
|
|
@@ -30,11 +31,11 @@
|
|
30
31
|
#include "src/core/lib/resource_quota/memory_quota.h"
|
31
32
|
|
32
33
|
typedef struct grpc_tcp_client_vtable {
|
33
|
-
int64_t (*connect)(
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
int64_t (*connect)(
|
35
|
+
grpc_closure* on_connect, grpc_endpoint** endpoint,
|
36
|
+
grpc_pollset_set* interested_parties,
|
37
|
+
const grpc_event_engine::experimental::EndpointConfig& config,
|
38
|
+
const grpc_resolved_address* addr, grpc_core::Timestamp deadline);
|
38
39
|
bool (*cancel_connect)(int64_t connection_handle);
|
39
40
|
} grpc_tcp_client_vtable;
|
40
41
|
|
@@ -45,12 +46,11 @@ typedef struct grpc_tcp_client_vtable {
|
|
45
46
|
in this connection being established (in order to continue their work). It
|
46
47
|
returns a handle to the connect operation which can be used to cancel the
|
47
48
|
connection attempt. */
|
48
|
-
int64_t grpc_tcp_client_connect(
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
grpc_core::Timestamp deadline);
|
49
|
+
int64_t grpc_tcp_client_connect(
|
50
|
+
grpc_closure* on_connect, grpc_endpoint** endpoint,
|
51
|
+
grpc_pollset_set* interested_parties,
|
52
|
+
const grpc_event_engine::experimental::EndpointConfig& config,
|
53
|
+
const grpc_resolved_address* addr, grpc_core::Timestamp deadline);
|
54
54
|
|
55
55
|
// Returns true if a connect attempt corresponding to the provided handle
|
56
56
|
// is successfully cancelled. Otherwise it returns false. If the connect
|
@@ -27,12 +27,12 @@
|
|
27
27
|
#include <netinet/in.h>
|
28
28
|
#include <string.h>
|
29
29
|
|
30
|
+
#include <grpc/event_engine/endpoint_config.h>
|
30
31
|
#include <grpc/support/alloc.h>
|
31
32
|
#include <grpc/support/log.h>
|
32
33
|
#include <grpc/support/sync.h>
|
33
34
|
|
34
35
|
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
35
|
-
#include "src/core/lib/channel/channel_args.h"
|
36
36
|
#include "src/core/lib/gprpp/host_port.h"
|
37
37
|
#include "src/core/lib/iomgr/cfstream_handle.h"
|
38
38
|
#include "src/core/lib/iomgr/closure.h"
|
@@ -149,11 +149,11 @@ static void ParseResolvedAddress(const grpc_resolved_address* addr,
|
|
149
149
|
*port = grpc_sockaddr_get_port(addr);
|
150
150
|
}
|
151
151
|
|
152
|
-
static int64_t CFStreamClientConnect(
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
152
|
+
static int64_t CFStreamClientConnect(
|
153
|
+
grpc_closure* closure, grpc_endpoint** ep,
|
154
|
+
grpc_pollset_set* interested_parties,
|
155
|
+
const grpc_event_engine::experimental::EndpointConfig& /*config*/,
|
156
|
+
const grpc_resolved_address* resolved_addr, grpc_core::Timestamp deadline) {
|
157
157
|
auto addr_uri = grpc_sockaddr_to_uri(resolved_addr);
|
158
158
|
if (!addr_uri.ok()) {
|
159
159
|
grpc_error_handle error =
|