grpc 1.49.0.pre1 → 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.

Files changed (271) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +54 -153
  3. data/include/grpc/event_engine/endpoint_config.h +11 -5
  4. data/include/grpc/event_engine/event_engine.h +1 -1
  5. data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
  6. data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
  7. data/include/grpc/impl/codegen/atm_windows.h +0 -2
  8. data/include/grpc/impl/codegen/grpc_types.h +6 -0
  9. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
  10. data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
  11. data/src/core/ext/filters/client_channel/client_channel.cc +41 -22
  12. data/src/core/ext/filters/client_channel/client_channel.h +1 -1
  13. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
  14. data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
  15. data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
  16. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
  17. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
  19. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +114 -103
  20. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
  21. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
  22. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
  26. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
  27. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
  28. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
  29. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
  30. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +87 -96
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
  35. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
  36. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
  37. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +38 -18
  38. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
  39. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
  40. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
  41. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
  42. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
  43. data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
  44. data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
  45. data/src/core/ext/filters/client_channel/subchannel.h +12 -3
  46. data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
  47. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
  48. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
  49. data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
  50. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
  51. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
  52. data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
  53. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
  54. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
  55. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
  56. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
  57. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
  58. data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
  59. data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
  60. data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
  61. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
  62. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
  63. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
  65. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
  66. data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
  67. data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
  68. data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
  69. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
  70. data/src/core/ext/xds/certificate_provider_store.cc +63 -3
  71. data/src/core/ext/xds/certificate_provider_store.h +9 -1
  72. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
  73. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
  74. data/src/core/ext/xds/xds_api.cc +21 -17
  75. data/src/core/ext/xds/xds_api.h +7 -0
  76. data/src/core/ext/xds/xds_bootstrap.cc +5 -537
  77. data/src/core/ext/xds/xds_bootstrap.h +39 -111
  78. data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
  79. data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
  80. data/src/core/ext/xds/xds_client.cc +219 -145
  81. data/src/core/ext/xds/xds_client.h +19 -17
  82. data/src/core/ext/xds/xds_client_grpc.cc +18 -80
  83. data/src/core/ext/xds/xds_client_grpc.h +2 -25
  84. data/src/core/ext/xds/xds_client_stats.cc +4 -4
  85. data/src/core/ext/xds/xds_cluster.cc +87 -79
  86. data/src/core/ext/xds/xds_cluster.h +5 -5
  87. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
  88. data/src/core/ext/xds/xds_common_types.cc +13 -5
  89. data/src/core/ext/xds/xds_endpoint.cc +8 -6
  90. data/src/core/ext/xds/xds_endpoint.h +3 -4
  91. data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
  92. data/src/core/ext/xds/xds_listener.cc +25 -20
  93. data/src/core/ext/xds/xds_listener.h +3 -4
  94. data/src/core/ext/xds/xds_resource_type.h +11 -8
  95. data/src/core/ext/xds/xds_route_config.cc +15 -16
  96. data/src/core/ext/xds/xds_route_config.h +3 -3
  97. data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
  98. data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
  99. data/src/core/lib/backoff/backoff.cc +2 -4
  100. data/src/core/lib/channel/call_finalization.h +1 -3
  101. data/src/core/lib/channel/channel_args.h +114 -14
  102. data/src/core/lib/channel/channel_trace.cc +3 -4
  103. data/src/core/lib/channel/promise_based_filter.cc +18 -19
  104. data/src/core/lib/channel/status_util.cc +27 -0
  105. data/src/core/lib/channel/status_util.h +10 -0
  106. data/src/core/lib/config/core_configuration.cc +5 -1
  107. data/src/core/lib/config/core_configuration.h +33 -0
  108. data/src/core/lib/debug/stats.cc +26 -30
  109. data/src/core/lib/debug/stats.h +2 -12
  110. data/src/core/lib/debug/stats_data.cc +118 -614
  111. data/src/core/lib/debug/stats_data.h +67 -465
  112. data/src/core/lib/debug/trace.cc +0 -2
  113. data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
  114. data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
  115. data/src/core/lib/event_engine/forkable.cc +19 -16
  116. data/src/core/lib/event_engine/poller.h +14 -12
  117. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
  118. data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
  119. data/src/core/lib/event_engine/thread_pool.cc +131 -94
  120. data/src/core/lib/event_engine/thread_pool.h +56 -23
  121. data/src/core/lib/event_engine/time_util.cc +30 -0
  122. data/src/core/lib/event_engine/time_util.h +32 -0
  123. data/src/core/lib/event_engine/utils.cc +0 -5
  124. data/src/core/lib/event_engine/utils.h +0 -4
  125. data/src/core/lib/event_engine/windows/iocp.cc +13 -7
  126. data/src/core/lib/event_engine/windows/iocp.h +2 -1
  127. data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
  128. data/src/core/lib/experiments/config.cc +146 -0
  129. data/src/core/lib/experiments/config.h +43 -0
  130. data/src/core/lib/experiments/experiments.cc +75 -0
  131. data/src/core/lib/experiments/experiments.h +56 -0
  132. data/src/core/lib/gpr/alloc.cc +1 -9
  133. data/src/core/lib/gpr/log_windows.cc +0 -1
  134. data/src/core/lib/gpr/string_util_windows.cc +3 -30
  135. data/src/core/lib/gpr/sync_abseil.cc +0 -14
  136. data/src/core/lib/gpr/sync_posix.cc +0 -14
  137. data/src/core/lib/gpr/time_posix.cc +0 -6
  138. data/src/core/lib/gpr/time_precise.h +1 -1
  139. data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
  140. data/src/core/lib/gpr/useful.h +11 -0
  141. data/src/core/lib/{gpr → gprpp}/env.h +25 -12
  142. data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
  143. data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
  144. data/src/core/lib/gprpp/env_windows.cc +56 -0
  145. data/src/core/lib/gprpp/fork.cc +14 -22
  146. data/src/core/lib/gprpp/fork.h +0 -8
  147. data/src/core/lib/gprpp/global_config_env.cc +7 -6
  148. data/src/core/lib/gprpp/notification.h +67 -0
  149. data/src/core/lib/gprpp/packed_table.h +40 -0
  150. data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
  151. data/src/core/lib/gprpp/sorted_pack.h +98 -0
  152. data/src/core/lib/gprpp/status_helper.h +6 -0
  153. data/src/core/lib/gprpp/table.h +9 -1
  154. data/src/core/lib/gprpp/tchar.cc +49 -0
  155. data/src/core/lib/gprpp/tchar.h +33 -0
  156. data/src/core/lib/gprpp/time.cc +21 -0
  157. data/src/core/lib/gprpp/time.h +55 -0
  158. data/src/core/lib/gprpp/validation_errors.cc +61 -0
  159. data/src/core/lib/gprpp/validation_errors.h +110 -0
  160. data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
  161. data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
  162. data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
  163. data/src/core/lib/iomgr/call_combiner.cc +0 -8
  164. data/src/core/lib/iomgr/closure.h +0 -1
  165. data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
  166. data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
  167. data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
  168. data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
  169. data/src/core/lib/iomgr/exec_ctx.cc +0 -10
  170. data/src/core/lib/iomgr/exec_ctx.h +7 -31
  171. data/src/core/lib/iomgr/iocp_windows.cc +1 -2
  172. data/src/core/lib/iomgr/iomgr.cc +6 -8
  173. data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
  174. data/src/core/lib/iomgr/pollset.h +1 -1
  175. data/src/core/lib/iomgr/pollset_set.h +0 -1
  176. data/src/core/lib/iomgr/resolve_address.h +1 -0
  177. data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
  178. data/src/core/lib/iomgr/resolve_address_posix.cc +5 -0
  179. data/src/core/lib/iomgr/resolve_address_windows.cc +5 -0
  180. data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
  181. data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
  182. data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
  183. data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
  184. data/src/core/lib/iomgr/tcp_client.cc +6 -7
  185. data/src/core/lib/iomgr/tcp_client.h +11 -11
  186. data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
  187. data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
  188. data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
  189. data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
  190. data/src/core/lib/iomgr/tcp_posix.cc +131 -114
  191. data/src/core/lib/iomgr/tcp_posix.h +3 -1
  192. data/src/core/lib/iomgr/tcp_server.cc +5 -4
  193. data/src/core/lib/iomgr/tcp_server.h +9 -6
  194. data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
  195. data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
  196. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
  197. data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
  198. data/src/core/lib/iomgr/tcp_windows.cc +0 -1
  199. data/src/core/lib/iomgr/tcp_windows.h +0 -1
  200. data/src/core/lib/iomgr/timer_generic.cc +4 -4
  201. data/src/core/lib/iomgr/timer_manager.cc +1 -2
  202. data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
  203. data/src/core/lib/json/json_object_loader.cc +21 -52
  204. data/src/core/lib/json/json_object_loader.h +56 -76
  205. data/src/core/lib/json/json_util.cc +2 -1
  206. data/src/core/lib/load_balancing/lb_policy.h +5 -5
  207. data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
  208. data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
  209. data/src/core/lib/promise/activity.h +2 -3
  210. data/src/core/lib/promise/context.h +1 -1
  211. data/src/core/lib/promise/sleep.cc +16 -4
  212. data/src/core/lib/promise/sleep.h +8 -2
  213. data/src/core/lib/resolver/resolver.h +13 -3
  214. data/src/core/lib/resource_quota/api.cc +9 -0
  215. data/src/core/lib/resource_quota/api.h +6 -0
  216. data/src/core/lib/resource_quota/arena.cc +1 -3
  217. data/src/core/lib/resource_quota/memory_quota.cc +8 -24
  218. data/src/core/lib/resource_quota/memory_quota.h +6 -19
  219. data/src/core/lib/resource_quota/periodic_update.cc +2 -3
  220. data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
  221. data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
  222. data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
  223. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
  224. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
  225. data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
  226. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
  227. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
  228. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
  229. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
  230. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
  231. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
  232. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
  233. data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
  234. data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
  235. data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
  236. data/src/core/lib/surface/call.cc +1 -11
  237. data/src/core/lib/surface/channel.cc +3 -2
  238. data/src/core/lib/surface/completion_queue.cc +16 -28
  239. data/src/core/lib/surface/completion_queue.h +1 -1
  240. data/src/core/lib/surface/completion_queue_factory.cc +5 -0
  241. data/src/core/lib/surface/init.cc +16 -11
  242. data/src/core/lib/surface/init_internally.cc +24 -0
  243. data/src/core/lib/surface/init_internally.h +28 -0
  244. data/src/core/lib/surface/server.cc +1 -7
  245. data/src/core/lib/surface/server.h +4 -6
  246. data/src/core/lib/surface/version.cc +2 -2
  247. data/src/core/lib/transport/bdp_estimator.cc +1 -3
  248. data/src/core/lib/transport/metadata_batch.cc +2 -3
  249. data/src/core/lib/transport/metadata_batch.h +9 -7
  250. data/src/core/lib/transport/parsed_metadata.h +4 -2
  251. data/src/core/lib/transport/status_conversion.cc +1 -3
  252. data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
  253. data/src/core/lib/transport/transport.h +0 -1
  254. data/src/core/lib/transport/transport_impl.h +0 -1
  255. data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
  256. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
  257. data/src/ruby/ext/grpc/extconf.rb +1 -1
  258. data/src/ruby/lib/grpc/version.rb +1 -1
  259. data/src/ruby/spec/channel_spec.rb +5 -0
  260. data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
  261. data/src/ruby/spec/user_agent_spec.rb +1 -1
  262. metadata +31 -17
  263. data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
  264. data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
  265. data/src/core/ext/xds/certificate_provider_registry.h +0 -59
  266. data/src/core/lib/event_engine/promise.h +0 -78
  267. data/src/core/lib/gpr/env_windows.cc +0 -74
  268. data/src/core/lib/gpr/string_windows.h +0 -32
  269. data/src/core/lib/profiling/basic_timers.cc +0 -295
  270. data/src/core/lib/profiling/stap_timers.cc +0 -50
  271. data/src/core/lib/profiling/timers.h +0 -94
@@ -48,7 +48,6 @@
48
48
  #include "src/core/lib/iomgr/ev_poll_posix.h"
49
49
  #include "src/core/lib/iomgr/iomgr_internal.h"
50
50
  #include "src/core/lib/iomgr/wakeup_fd_posix.h"
51
- #include "src/core/lib/profiling/timers.h"
52
51
 
53
52
  #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker*)1)
54
53
 
@@ -769,14 +768,11 @@ static void kick_append_error(grpc_error_handle* composite,
769
768
  static grpc_error_handle pollset_kick_ext(grpc_pollset* p,
770
769
  grpc_pollset_worker* specific_worker,
771
770
  uint32_t flags) {
772
- GPR_TIMER_SCOPE("pollset_kick_ext", 0);
773
771
  grpc_error_handle error = GRPC_ERROR_NONE;
774
- GRPC_STATS_INC_POLLSET_KICK();
775
772
 
776
773
  /* pollset->mu already held */
777
774
  if (specific_worker != nullptr) {
778
775
  if (specific_worker == GRPC_POLLSET_KICK_BROADCAST) {
779
- GPR_TIMER_SCOPE("pollset_kick_ext.broadcast", 0);
780
776
  GPR_ASSERT((flags & GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP) == 0);
781
777
  for (specific_worker = p->root_worker.next;
782
778
  specific_worker != &p->root_worker;
@@ -786,7 +782,6 @@ static grpc_error_handle pollset_kick_ext(grpc_pollset* p,
786
782
  }
787
783
  p->kicked_without_pollers = true;
788
784
  } else if (g_current_thread_worker != specific_worker) {
789
- GPR_TIMER_MARK("different_thread_worker", 0);
790
785
  if ((flags & GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP) != 0) {
791
786
  specific_worker->reevaluate_polling_on_wakeup = true;
792
787
  }
@@ -794,7 +789,6 @@ static grpc_error_handle pollset_kick_ext(grpc_pollset* p,
794
789
  kick_append_error(&error,
795
790
  grpc_wakeup_fd_wakeup(&specific_worker->wakeup_fd->fd));
796
791
  } else if ((flags & GRPC_POLLSET_CAN_KICK_SELF) != 0) {
797
- GPR_TIMER_MARK("kick_yoself", 0);
798
792
  if ((flags & GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP) != 0) {
799
793
  specific_worker->reevaluate_polling_on_wakeup = true;
800
794
  }
@@ -804,11 +798,9 @@ static grpc_error_handle pollset_kick_ext(grpc_pollset* p,
804
798
  }
805
799
  } else if (g_current_thread_poller != p) {
806
800
  GPR_ASSERT((flags & GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP) == 0);
807
- GPR_TIMER_MARK("kick_anonymous", 0);
808
801
  specific_worker = pop_front_worker(p);
809
802
  if (specific_worker != nullptr) {
810
803
  if (g_current_thread_worker == specific_worker) {
811
- GPR_TIMER_MARK("kick_anonymous_not_self", 0);
812
804
  push_back_worker(p, specific_worker);
813
805
  specific_worker = pop_front_worker(p);
814
806
  if ((flags & GRPC_POLLSET_CAN_KICK_SELF) == 0 &&
@@ -818,13 +810,11 @@ static grpc_error_handle pollset_kick_ext(grpc_pollset* p,
818
810
  }
819
811
  }
820
812
  if (specific_worker != nullptr) {
821
- GPR_TIMER_MARK("finally_kick", 0);
822
813
  push_back_worker(p, specific_worker);
823
814
  kick_append_error(
824
815
  &error, grpc_wakeup_fd_wakeup(&specific_worker->wakeup_fd->fd));
825
816
  }
826
817
  } else {
827
- GPR_TIMER_MARK("kicked_no_pollers", 0);
828
818
  p->kicked_without_pollers = true;
829
819
  }
830
820
  }
@@ -914,7 +904,6 @@ static void work_combine_error(grpc_error_handle* composite,
914
904
  static grpc_error_handle pollset_work(grpc_pollset* pollset,
915
905
  grpc_pollset_worker** worker_hdl,
916
906
  grpc_core::Timestamp deadline) {
917
- GPR_TIMER_SCOPE("pollset_work", 0);
918
907
  grpc_pollset_worker worker;
919
908
  if (worker_hdl) *worker_hdl = &worker;
920
909
  grpc_error_handle error = GRPC_ERROR_NONE;
@@ -948,7 +937,6 @@ static grpc_error_handle pollset_work(grpc_pollset* pollset,
948
937
  worker.kicked_specifically = 0;
949
938
  /* If we're shutting down then we don't execute any extended work */
950
939
  if (pollset->shutting_down) {
951
- GPR_TIMER_MARK("pollset_work.shutting_down", 0);
952
940
  goto done;
953
941
  }
954
942
  /* Start polling, and keep doing so while we're being asked to
@@ -959,13 +947,12 @@ static grpc_error_handle pollset_work(grpc_pollset* pollset,
959
947
  while (keep_polling) {
960
948
  keep_polling = 0;
961
949
  if (!pollset->kicked_without_pollers ||
962
- deadline <= grpc_core::ExecCtx::Get()->Now()) {
950
+ deadline <= grpc_core::Timestamp::Now()) {
963
951
  if (!added_worker) {
964
952
  push_front_worker(pollset, &worker);
965
953
  added_worker = 1;
966
954
  g_current_thread_worker = &worker;
967
955
  }
968
- GPR_TIMER_SCOPE("maybe_work_and_unlock", 0);
969
956
  #define POLLOUT_CHECK (POLLOUT | POLLHUP | POLLERR)
970
957
  #define POLLIN_CHECK (POLLIN | POLLHUP | POLLERR)
971
958
 
@@ -1024,7 +1011,6 @@ static grpc_error_handle pollset_work(grpc_pollset* pollset,
1024
1011
  /* TODO(vpai): Consider first doing a 0 timeout poll here to avoid
1025
1012
  even going into the blocking annotation if possible */
1026
1013
  GRPC_SCHEDULING_START_BLOCKING_REGION;
1027
- GRPC_STATS_INC_SYSCALL_POLL();
1028
1014
  r = grpc_poll_function(pfds, pfd_count, timeout);
1029
1015
  GRPC_SCHEDULING_END_BLOCKING_REGION;
1030
1016
 
@@ -1090,7 +1076,6 @@ static grpc_error_handle pollset_work(grpc_pollset* pollset,
1090
1076
 
1091
1077
  locked = 0;
1092
1078
  } else {
1093
- GPR_TIMER_MARK("pollset_work.kicked_without_pollers", 0);
1094
1079
  pollset->kicked_without_pollers = 0;
1095
1080
  }
1096
1081
  /* Finished execution - start cleaning up.
@@ -1160,7 +1145,7 @@ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
1160
1145
  static int poll_deadline_to_millis_timeout(grpc_core::Timestamp deadline) {
1161
1146
  if (deadline == grpc_core::Timestamp::InfFuture()) return -1;
1162
1147
  if (deadline.is_process_epoch()) return 0;
1163
- int64_t n = (deadline - grpc_core::ExecCtx::Get()->Now()).millis();
1148
+ int64_t n = (deadline - grpc_core::Timestamp::Now()).millis();
1164
1149
  if (n < 0) return 0;
1165
1150
  if (n > INT_MAX) return -1;
1166
1151
  return static_cast<int>(n);
@@ -25,7 +25,6 @@
25
25
 
26
26
  #include "src/core/lib/iomgr/combiner.h"
27
27
  #include "src/core/lib/iomgr/error.h"
28
- #include "src/core/lib/profiling/timers.h"
29
28
 
30
29
  static void exec_ctx_run(grpc_closure* closure) {
31
30
  #ifndef NDEBUG
@@ -60,7 +59,6 @@ ApplicationCallbackExecCtx::callback_exec_ctx_;
60
59
 
61
60
  bool ExecCtx::Flush() {
62
61
  bool did_something = false;
63
- GPR_TIMER_SCOPE("grpc_exec_ctx_flush", 0);
64
62
  for (;;) {
65
63
  if (!grpc_closure_list_empty(closure_list_)) {
66
64
  grpc_closure* c = closure_list_.head;
@@ -79,14 +77,6 @@ bool ExecCtx::Flush() {
79
77
  return did_something;
80
78
  }
81
79
 
82
- Timestamp ExecCtx::Now() {
83
- if (!now_is_valid_) {
84
- now_ = Timestamp::FromTimespecRoundDown(gpr_now(GPR_CLOCK_MONOTONIC));
85
- now_is_valid_ = true;
86
- }
87
- return now_;
88
- }
89
-
90
80
  void ExecCtx::Run(const DebugLocation& location, grpc_closure* closure,
91
81
  grpc_error_handle error) {
92
82
  (void)location;
@@ -176,30 +176,14 @@ class ExecCtx {
176
176
  }
177
177
  }
178
178
 
179
- /** Returns the stored current time relative to start if valid,
180
- * otherwise refreshes the stored time, sets it valid and returns the new
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
- now_ = Timestamp::InfFuture();
193
- now_is_valid_ = true;
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
- bool now_is_valid_ = false;
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::ExecCtx::Get()->Now();
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));
@@ -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) { return count_objects(); }
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;
@@ -21,5 +21,6 @@
21
21
  #include <grpc/support/port_platform.h>
22
22
 
23
23
  typedef struct grpc_pollset_set grpc_pollset_set;
24
+ typedef struct grpc_pollset grpc_pollset;
24
25
 
25
26
  #endif // GRPC_CORE_LIB_IOMGR_IOMGR_FWD_H
@@ -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"
@@ -21,6 +21,7 @@
21
21
 
22
22
  #include <stddef.h>
23
23
 
24
+ #include "src/core/lib/iomgr/exec_ctx.h"
24
25
  #include "src/core/lib/iomgr/port.h"
25
26
  #include "src/core/lib/iomgr/resolve_address.h"
26
27
 
@@ -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"
@@ -184,6 +185,8 @@ DNSResolver::TaskHandle NativeDNSResolver::LookupSRV(
184
185
  grpc_pollset_set* /* interested_parties */,
185
186
  absl::string_view /* name_server */) {
186
187
  GetDefaultEventEngine()->Run([on_resolved] {
188
+ ApplicationCallbackExecCtx app_exec_ctx;
189
+ ExecCtx exec_ctx;
187
190
  on_resolved(absl::UnimplementedError(
188
191
  "The Native resolver does not support looking up SRV records"));
189
192
  });
@@ -197,6 +200,8 @@ DNSResolver::TaskHandle NativeDNSResolver::LookupTXT(
197
200
  absl::string_view /* name_server */) {
198
201
  // Not supported
199
202
  GetDefaultEventEngine()->Run([on_resolved] {
203
+ ApplicationCallbackExecCtx app_exec_ctx;
204
+ ExecCtx exec_ctx;
200
205
  on_resolved(absl::UnimplementedError(
201
206
  "The Native resolver does not support looking up TXT records"));
202
207
  });
@@ -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"
@@ -168,6 +169,8 @@ DNSResolver::TaskHandle NativeDNSResolver::LookupSRV(
168
169
  grpc_pollset_set* /* interested_parties */,
169
170
  absl::string_view /* name_server */) {
170
171
  GetDefaultEventEngine()->Run([on_resolved] {
172
+ ApplicationCallbackExecCtx app_exec_ctx;
173
+ ExecCtx exec_ctx;
171
174
  on_resolved(absl::UnimplementedError(
172
175
  "The Native resolver does not support looking up SRV records"));
173
176
  });
@@ -181,6 +184,8 @@ DNSResolver::TaskHandle NativeDNSResolver::LookupTXT(
181
184
  absl::string_view /* name_server */) {
182
185
  // Not supported
183
186
  GetDefaultEventEngine()->Run([on_resolved] {
187
+ ApplicationCallbackExecCtx app_exec_ctx;
188
+ ExecCtx exec_ctx;
184
189
  on_resolved(absl::UnimplementedError(
185
190
  "The Native resolver does not support looking up TXT records"));
186
191
  });
@@ -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 grpc_channel_args* channel_args, bool is_client) {
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
- if (channel_args) {
318
- for (unsigned int i = 0; i < channel_args->num_args; i++) {
319
- if (0 ==
320
- strcmp(channel_args->args[i].key, GRPC_ARG_KEEPALIVE_TIME_MS)) {
321
- const int value = grpc_channel_arg_get_integer(
322
- &channel_args->args[i], grpc_integer_options{0, 1, INT_MAX});
323
- /* Continue using default if value is 0 */
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 grpc_channel_args* args) {
402
- const grpc_arg* socket_mutator_arg =
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
- GPR_DEBUG_ASSERT(socket_mutator_arg->type == GRPC_ARG_POINTER);
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) {