grpc 1.2.5 → 1.3.4

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 (327) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1434 -399
  3. data/etc/roots.pem +34 -150
  4. data/include/grpc/grpc.h +71 -0
  5. data/include/grpc/impl/codegen/atm.h +5 -0
  6. data/include/grpc/impl/codegen/atm_gcc_atomic.h +6 -0
  7. data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
  8. data/include/grpc/impl/codegen/atm_windows.h +11 -0
  9. data/include/grpc/impl/codegen/grpc_types.h +54 -13
  10. data/include/grpc/impl/codegen/port_platform.h +15 -1
  11. data/include/grpc/support/alloc.h +2 -1
  12. data/include/grpc/support/sync.h +4 -0
  13. data/include/grpc/support/tls.h +1 -1
  14. data/src/core/ext/census/gen/trace_context.pb.h +1 -1
  15. data/src/core/ext/census/grpc_filter.c +14 -10
  16. data/src/core/ext/census/grpc_plugin.c +3 -1
  17. data/src/core/ext/census/trace_label.h +1 -1
  18. data/src/core/ext/census/trace_propagation.h +1 -1
  19. data/src/core/ext/census/trace_status.h +1 -1
  20. data/src/core/ext/census/trace_string.h +1 -1
  21. data/src/core/ext/census/tracing.h +1 -1
  22. data/src/core/ext/{client_channel → filters/client_channel}/channel_connectivity.c +56 -27
  23. data/src/core/ext/{client_channel → filters/client_channel}/client_channel.c +407 -202
  24. data/src/core/ext/{client_channel → filters/client_channel}/client_channel.h +10 -6
  25. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.c +1 -1
  26. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.h +4 -4
  27. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_plugin.c +12 -7
  28. data/src/core/ext/{client_channel → filters/client_channel}/connector.c +1 -1
  29. data/src/core/ext/{client_channel → filters/client_channel}/connector.h +3 -5
  30. data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.c +6 -6
  31. data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.h +3 -3
  32. data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.c +4 -4
  33. data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.h +3 -3
  34. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.c +1 -1
  35. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.h +4 -4
  36. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.c +22 -20
  37. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.h +4 -4
  38. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel.h +5 -4
  39. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel_secure.c +2 -2
  40. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.c +1 -1
  41. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.h +6 -5
  42. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +1 -1
  43. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -0
  44. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/pick_first/pick_first.c +20 -15
  45. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/round_robin/round_robin.c +21 -16
  46. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.c +1 -1
  47. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.h +5 -5
  48. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.c +1 -1
  49. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.h +4 -4
  50. data/src/core/ext/{client_channel → filters/client_channel}/parse_address.c +1 -1
  51. data/src/core/ext/{client_channel → filters/client_channel}/parse_address.h +4 -4
  52. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.c +1 -1
  53. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.h +3 -3
  54. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.c +10 -4
  55. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.h +4 -4
  56. data/src/core/ext/{client_channel → filters/client_channel}/resolver.c +1 -1
  57. data/src/core/ext/{client_channel → filters/client_channel}/resolver.h +4 -4
  58. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +350 -0
  59. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +66 -0
  60. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +319 -0
  61. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +289 -0
  62. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +64 -0
  63. data/src/core/ext/{resolver → filters/client_channel/resolver}/dns/native/dns_resolver.c +21 -5
  64. data/src/core/ext/{resolver → filters/client_channel/resolver}/sockaddr/sockaddr_resolver.c +3 -3
  65. data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.c +1 -1
  66. data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.h +6 -6
  67. data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.c +1 -2
  68. data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.h +4 -4
  69. data/src/core/ext/filters/client_channel/retry_throttle.c +210 -0
  70. data/src/core/ext/filters/client_channel/retry_throttle.h +65 -0
  71. data/src/core/ext/{client_channel → filters/client_channel}/subchannel.c +49 -43
  72. data/src/core/ext/{client_channel → filters/client_channel}/subchannel.h +21 -7
  73. data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.c +1 -1
  74. data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.h +5 -5
  75. data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.c +1 -1
  76. data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.h +3 -3
  77. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.c +4 -2
  78. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.h +3 -3
  79. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.c +17 -14
  80. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.h +4 -4
  81. data/src/core/ext/filters/max_age/max_age_filter.c +439 -0
  82. data/src/core/ext/filters/max_age/max_age_filter.h +39 -0
  83. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +6 -41
  84. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +1 -1
  85. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +2 -2
  86. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +3 -3
  87. data/src/core/ext/transport/chttp2/server/chttp2_server.c +2 -2
  88. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +2 -5
  89. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +2 -2
  90. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +449 -204
  91. data/src/core/ext/transport/chttp2/transport/frame_data.c +10 -7
  92. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +3 -2
  93. data/src/core/ext/transport/chttp2/transport/frame_ping.c +37 -7
  94. data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -0
  95. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +4 -3
  96. data/src/core/ext/transport/chttp2/transport/frame_settings.c +18 -38
  97. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -29
  98. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +2 -2
  99. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +64 -37
  100. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +11 -4
  101. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +60 -39
  102. data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
  103. data/src/core/ext/transport/chttp2/transport/http2_settings.c +75 -0
  104. data/src/core/ext/transport/chttp2/transport/http2_settings.h +74 -0
  105. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +22 -43
  106. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +8 -10
  107. data/src/core/ext/transport/chttp2/transport/internal.h +24 -2
  108. data/src/core/ext/transport/chttp2/transport/parsing.c +33 -15
  109. data/src/core/ext/transport/chttp2/transport/writing.c +56 -10
  110. data/src/core/lib/channel/channel_args.c +7 -0
  111. data/src/core/lib/channel/channel_args.h +2 -0
  112. data/src/core/lib/channel/channel_stack.c +20 -27
  113. data/src/core/lib/channel/channel_stack.h +18 -16
  114. data/src/core/lib/channel/compress_filter.c +20 -18
  115. data/src/core/lib/channel/connected_channel.c +9 -8
  116. data/src/core/lib/channel/deadline_filter.c +28 -24
  117. data/src/core/lib/channel/deadline_filter.h +3 -3
  118. data/src/core/lib/channel/handshaker.c +3 -2
  119. data/src/core/lib/channel/http_client_filter.c +119 -61
  120. data/src/core/lib/channel/http_server_filter.c +124 -69
  121. data/src/core/lib/channel/message_size_filter.c +23 -19
  122. data/src/core/lib/http/httpcli.c +8 -6
  123. data/src/core/lib/http/httpcli_security_connector.c +5 -5
  124. data/src/core/lib/http/parser.c +57 -31
  125. data/src/core/lib/iomgr/closure.c +15 -0
  126. data/src/core/lib/iomgr/closure.h +4 -0
  127. data/src/core/lib/iomgr/combiner.c +8 -0
  128. data/src/core/lib/iomgr/endpoint_pair.h +2 -3
  129. data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -7
  130. data/src/core/lib/iomgr/endpoint_pair_uv.c +2 -3
  131. data/src/core/lib/iomgr/endpoint_pair_windows.c +9 -6
  132. data/src/core/lib/iomgr/error.c +360 -177
  133. data/src/core/lib/iomgr/error.h +31 -33
  134. data/src/core/lib/iomgr/error_internal.h +30 -9
  135. data/src/core/lib/iomgr/ev_epoll_linux.c +25 -239
  136. data/src/core/lib/iomgr/ev_poll_posix.c +11 -7
  137. data/src/core/lib/iomgr/ev_posix.c +6 -0
  138. data/src/core/lib/iomgr/ev_posix.h +3 -0
  139. data/src/core/lib/iomgr/exec_ctx.c +6 -0
  140. data/src/core/lib/iomgr/executor.c +8 -2
  141. data/src/core/lib/iomgr/load_file.c +6 -3
  142. data/src/core/lib/iomgr/lockfree_event.c +238 -0
  143. data/src/core/{ext/client_channel/initial_connect_string.h → lib/iomgr/lockfree_event.h} +17 -13
  144. data/src/core/lib/iomgr/pollset.h +4 -0
  145. data/src/core/lib/iomgr/pollset_windows.c +2 -2
  146. data/src/core/lib/iomgr/port.h +9 -0
  147. data/src/core/lib/iomgr/resolve_address_posix.c +15 -9
  148. data/src/core/lib/iomgr/resolve_address_uv.c +8 -6
  149. data/src/core/lib/iomgr/resolve_address_windows.c +2 -2
  150. data/src/core/lib/iomgr/resource_quota.c +19 -4
  151. data/src/core/lib/iomgr/resource_quota.h +2 -0
  152. data/src/core/lib/iomgr/sockaddr_utils.c +3 -1
  153. data/src/core/lib/iomgr/socket_factory_posix.c +110 -0
  154. data/src/core/lib/iomgr/socket_factory_posix.h +90 -0
  155. data/src/core/lib/iomgr/socket_utils_common_posix.c +25 -9
  156. data/src/core/lib/iomgr/socket_utils_posix.h +7 -0
  157. data/src/core/lib/iomgr/tcp_client.h +0 -4
  158. data/src/core/lib/iomgr/tcp_client_posix.c +15 -31
  159. data/src/core/lib/iomgr/tcp_client_uv.c +10 -6
  160. data/src/core/lib/iomgr/tcp_client_windows.c +9 -19
  161. data/src/core/lib/iomgr/tcp_posix.c +111 -22
  162. data/src/core/lib/iomgr/tcp_posix.h +3 -4
  163. data/src/core/lib/iomgr/tcp_server_posix.c +39 -417
  164. data/src/core/lib/iomgr/tcp_server_utils_posix.h +135 -0
  165. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +221 -0
  166. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +196 -0
  167. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +49 -0
  168. data/src/core/lib/iomgr/tcp_server_uv.c +43 -16
  169. data/src/core/lib/iomgr/tcp_server_windows.c +10 -22
  170. data/src/core/lib/iomgr/tcp_uv.c +16 -13
  171. data/src/core/lib/iomgr/tcp_windows.c +24 -12
  172. data/src/core/lib/iomgr/tcp_windows.h +2 -2
  173. data/src/core/lib/iomgr/timer.h +3 -0
  174. data/src/core/lib/iomgr/timer_generic.c +257 -72
  175. data/src/core/lib/iomgr/timer_generic.h +1 -1
  176. data/src/core/lib/iomgr/timer_heap.c +8 -8
  177. data/src/core/lib/iomgr/udp_server.c +54 -24
  178. data/src/core/lib/iomgr/udp_server.h +7 -7
  179. data/src/core/lib/iomgr/unix_sockets_posix.c +1 -1
  180. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +2 -1
  181. data/src/core/lib/iomgr/wakeup_fd_posix.h +1 -1
  182. data/src/core/lib/profiling/basic_timers.c +1 -1
  183. data/src/core/lib/security/credentials/credentials.h +1 -1
  184. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +10 -9
  185. data/src/core/lib/security/credentials/jwt/json_token.c +1 -1
  186. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +2 -2
  187. data/src/core/lib/security/transport/client_auth_filter.c +33 -26
  188. data/src/core/lib/security/transport/secure_endpoint.c +8 -5
  189. data/src/core/lib/security/transport/security_connector.c +37 -37
  190. data/src/core/lib/security/transport/security_connector.h +1 -1
  191. data/src/core/lib/security/transport/security_handshaker.c +15 -12
  192. data/src/core/lib/security/transport/server_auth_filter.c +20 -18
  193. data/src/core/lib/security/transport/tsi_error.c +5 -3
  194. data/src/core/lib/security/transport/tsi_error.h +1 -1
  195. data/src/core/lib/{security/util → slice}/b64.c +21 -6
  196. data/src/core/lib/{security/util → slice}/b64.h +16 -4
  197. data/src/core/lib/slice/slice.c +4 -2
  198. data/src/core/lib/slice/slice_buffer.c +16 -14
  199. data/src/core/lib/support/arena.c +98 -0
  200. data/src/core/{ext/client_channel/initial_connect_string.c → lib/support/arena.h} +17 -15
  201. data/src/core/{ext/client_channel/default_initial_connect_string.c → lib/support/atm.c} +14 -5
  202. data/src/core/lib/support/cpu_linux.c +5 -0
  203. data/src/core/lib/support/sync.c +4 -0
  204. data/src/core/lib/support/time.c +4 -10
  205. data/src/core/lib/support/wrap_memcpy.c +3 -1
  206. data/src/core/lib/surface/call.c +252 -221
  207. data/src/core/lib/surface/channel.c +72 -21
  208. data/src/core/lib/surface/channel.h +8 -0
  209. data/src/core/lib/surface/completion_queue.c +2 -3
  210. data/src/core/lib/surface/completion_queue_factory.c +77 -0
  211. data/src/core/lib/surface/completion_queue_factory.h +51 -0
  212. data/src/core/lib/surface/init_secure.c +3 -1
  213. data/src/core/lib/surface/lame_client.c +18 -14
  214. data/src/core/lib/surface/server.c +43 -41
  215. data/src/core/lib/surface/validate_metadata.c +8 -4
  216. data/src/core/lib/surface/version.c +2 -2
  217. data/src/core/lib/transport/bdp_estimator.h +1 -1
  218. data/src/core/lib/transport/connectivity_state.c +2 -1
  219. data/src/core/lib/transport/error_utils.c +17 -17
  220. data/src/core/lib/transport/error_utils.h +1 -1
  221. data/src/core/lib/transport/metadata_batch.c +6 -7
  222. data/src/core/lib/transport/pid_controller.c +1 -0
  223. data/src/core/lib/transport/service_config.c +12 -0
  224. data/src/core/lib/transport/service_config.h +6 -0
  225. data/src/core/lib/transport/transport.c +29 -17
  226. data/src/core/lib/transport/transport.h +85 -42
  227. data/src/core/lib/transport/transport_impl.h +5 -3
  228. data/src/core/lib/transport/transport_op_string.c +20 -14
  229. data/src/core/plugin_registry/grpc_plugin_registry.c +8 -0
  230. data/src/core/{lib/tsi → tsi}/fake_transport_security.c +2 -2
  231. data/src/core/{lib/tsi → tsi}/fake_transport_security.h +4 -4
  232. data/src/core/{lib/tsi → tsi}/ssl_transport_security.c +40 -79
  233. data/src/core/{lib/tsi → tsi}/ssl_transport_security.h +44 -21
  234. data/src/core/{lib/tsi → tsi}/ssl_types.h +3 -3
  235. data/src/core/{lib/tsi → tsi}/transport_security.c +2 -2
  236. data/src/core/{lib/tsi → tsi}/transport_security.h +4 -4
  237. data/src/core/{lib/tsi → tsi}/transport_security_interface.h +3 -3
  238. data/src/ruby/ext/grpc/extconf.rb +1 -0
  239. data/src/ruby/ext/grpc/rb_call_credentials.c +2 -2
  240. data/src/ruby/ext/grpc/rb_channel.c +520 -93
  241. data/src/ruby/ext/grpc/rb_channel.h +2 -0
  242. data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -0
  243. data/src/ruby/ext/grpc/rb_compression_options.c +5 -2
  244. data/src/ruby/ext/grpc/rb_event_thread.c +6 -6
  245. data/src/ruby/ext/grpc/rb_grpc.c +29 -7
  246. data/src/ruby/ext/grpc/rb_grpc.h +2 -0
  247. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
  249. data/src/ruby/ext/grpc/rb_server.c +5 -3
  250. data/src/ruby/lib/grpc/version.rb +1 -1
  251. data/src/ruby/spec/channel_connection_spec.rb +173 -0
  252. data/src/ruby/spec/channel_spec.rb +29 -0
  253. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +27 -17
  254. data/third_party/cares/ares_build.h +264 -0
  255. data/third_party/cares/cares/ares.h +636 -0
  256. data/third_party/cares/cares/ares__close_sockets.c +61 -0
  257. data/third_party/cares/cares/ares__get_hostent.c +261 -0
  258. data/third_party/cares/cares/ares__read_line.c +73 -0
  259. data/third_party/cares/cares/ares__timeval.c +111 -0
  260. data/third_party/cares/cares/ares_cancel.c +63 -0
  261. data/third_party/cares/cares/ares_create_query.c +202 -0
  262. data/third_party/cares/cares/ares_data.c +221 -0
  263. data/third_party/cares/cares/ares_data.h +72 -0
  264. data/third_party/cares/cares/ares_destroy.c +108 -0
  265. data/third_party/cares/cares/ares_dns.h +103 -0
  266. data/third_party/cares/cares/ares_expand_name.c +205 -0
  267. data/third_party/cares/cares/ares_expand_string.c +70 -0
  268. data/third_party/cares/cares/ares_fds.c +59 -0
  269. data/third_party/cares/cares/ares_free_hostent.c +41 -0
  270. data/third_party/cares/cares/ares_free_string.c +25 -0
  271. data/third_party/cares/cares/ares_getenv.c +30 -0
  272. data/third_party/cares/cares/ares_getenv.h +26 -0
  273. data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
  274. data/third_party/cares/cares/ares_gethostbyname.c +518 -0
  275. data/third_party/cares/cares/ares_getnameinfo.c +422 -0
  276. data/third_party/cares/cares/ares_getopt.c +122 -0
  277. data/third_party/cares/cares/ares_getopt.h +53 -0
  278. data/third_party/cares/cares/ares_getsock.c +66 -0
  279. data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
  280. data/third_party/cares/cares/ares_init.c +2146 -0
  281. data/third_party/cares/cares/ares_iphlpapi.h +221 -0
  282. data/third_party/cares/cares/ares_ipv6.h +78 -0
  283. data/third_party/cares/cares/ares_library_init.c +167 -0
  284. data/third_party/cares/cares/ares_library_init.h +42 -0
  285. data/third_party/cares/cares/ares_llist.c +63 -0
  286. data/third_party/cares/cares/ares_llist.h +39 -0
  287. data/third_party/cares/cares/ares_mkquery.c +24 -0
  288. data/third_party/cares/cares/ares_nowarn.c +260 -0
  289. data/third_party/cares/cares/ares_nowarn.h +61 -0
  290. data/third_party/cares/cares/ares_options.c +402 -0
  291. data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
  292. data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
  293. data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
  294. data/third_party/cares/cares/ares_parse_naptr_reply.c +188 -0
  295. data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
  296. data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
  297. data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
  298. data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
  299. data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
  300. data/third_party/cares/cares/ares_platform.c +11035 -0
  301. data/third_party/cares/cares/ares_platform.h +43 -0
  302. data/third_party/cares/cares/ares_private.h +363 -0
  303. data/third_party/cares/cares/ares_process.c +1359 -0
  304. data/third_party/cares/cares/ares_query.c +186 -0
  305. data/third_party/cares/cares/ares_rules.h +125 -0
  306. data/third_party/cares/cares/ares_search.c +316 -0
  307. data/third_party/cares/cares/ares_send.c +131 -0
  308. data/third_party/cares/cares/ares_setup.h +217 -0
  309. data/third_party/cares/cares/ares_strcasecmp.c +66 -0
  310. data/third_party/cares/cares/ares_strcasecmp.h +30 -0
  311. data/third_party/cares/cares/ares_strdup.c +49 -0
  312. data/third_party/cares/cares/ares_strdup.h +24 -0
  313. data/third_party/cares/cares/ares_strerror.c +56 -0
  314. data/third_party/cares/cares/ares_timeout.c +88 -0
  315. data/third_party/cares/cares/ares_version.c +11 -0
  316. data/third_party/cares/cares/ares_version.h +24 -0
  317. data/third_party/cares/cares/ares_writev.c +79 -0
  318. data/third_party/cares/cares/bitncmp.c +59 -0
  319. data/third_party/cares/cares/bitncmp.h +26 -0
  320. data/third_party/cares/cares/config-win32.h +377 -0
  321. data/third_party/cares/cares/inet_net_pton.c +450 -0
  322. data/third_party/cares/cares/inet_ntop.c +208 -0
  323. data/third_party/cares/cares/setup_once.h +554 -0
  324. data/third_party/cares/cares/windows_port.c +22 -0
  325. data/third_party/cares/config_darwin/ares_config.h +523 -0
  326. data/third_party/cares/config_linux/ares_config.h +524 -0
  327. metadata +164 -68
@@ -37,28 +37,26 @@
37
37
  #include "src/core/lib/transport/transport.h"
38
38
 
39
39
  typedef struct {
40
- grpc_linked_mdelem *elems;
41
- size_t count;
42
- size_t capacity;
43
- gpr_timespec deadline;
44
- int published;
40
+ gpr_arena *arena;
41
+ grpc_metadata_batch batch;
45
42
  size_t size; // total size of metadata
46
43
  } grpc_chttp2_incoming_metadata_buffer;
47
44
 
48
45
  /** assumes everything initially zeroed */
49
46
  void grpc_chttp2_incoming_metadata_buffer_init(
50
- grpc_chttp2_incoming_metadata_buffer *buffer);
47
+ grpc_chttp2_incoming_metadata_buffer *buffer, gpr_arena *arena);
51
48
  void grpc_chttp2_incoming_metadata_buffer_destroy(
52
49
  grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer *buffer);
53
50
  void grpc_chttp2_incoming_metadata_buffer_publish(
54
51
  grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer *buffer,
55
52
  grpc_metadata_batch *batch);
56
53
 
57
- void grpc_chttp2_incoming_metadata_buffer_add(
58
- grpc_chttp2_incoming_metadata_buffer *buffer, grpc_mdelem elem);
59
- void grpc_chttp2_incoming_metadata_buffer_replace_or_add(
54
+ grpc_error *grpc_chttp2_incoming_metadata_buffer_add(
60
55
  grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer *buffer,
61
- grpc_mdelem elem);
56
+ grpc_mdelem elem) GRPC_MUST_USE_RESULT;
57
+ grpc_error *grpc_chttp2_incoming_metadata_buffer_replace_or_add(
58
+ grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer *buffer,
59
+ grpc_mdelem elem) GRPC_MUST_USE_RESULT;
62
60
  void grpc_chttp2_incoming_metadata_buffer_set_deadline(
63
61
  grpc_chttp2_incoming_metadata_buffer *buffer, gpr_timespec deadline);
64
62
 
@@ -97,13 +97,22 @@ typedef struct {
97
97
  typedef struct {
98
98
  gpr_timespec min_time_between_pings;
99
99
  int max_pings_without_data;
100
+ int max_ping_strikes;
101
+ gpr_timespec min_ping_interval_without_data;
100
102
  } grpc_chttp2_repeated_ping_policy;
101
103
 
102
104
  typedef struct {
103
105
  gpr_timespec last_ping_sent_time;
104
106
  int pings_before_data_required;
107
+ grpc_timer delayed_ping_timer;
108
+ bool is_delayed_ping_timer_set;
105
109
  } grpc_chttp2_repeated_ping_state;
106
110
 
111
+ typedef struct {
112
+ gpr_timespec last_ping_recv_time;
113
+ int ping_strikes;
114
+ } grpc_chttp2_server_ping_recv_state;
115
+
107
116
  /* deframer state for the overall http2 stream of bytes */
108
117
  typedef enum {
109
118
  /* prefix: one entry per http2 connection prefix byte */
@@ -308,11 +317,13 @@ struct grpc_chttp2_transport {
308
317
  grpc_chttp2_repeated_ping_policy ping_policy;
309
318
  grpc_chttp2_repeated_ping_state ping_state;
310
319
  uint64_t ping_ctr; /* unique id for pings */
320
+ grpc_closure retry_initiate_ping_locked;
311
321
 
312
322
  /** ping acks */
313
323
  size_t ping_ack_count;
314
324
  size_t ping_ack_capacity;
315
325
  uint64_t *ping_acks;
326
+ grpc_chttp2_server_ping_recv_state ping_recv_state;
316
327
 
317
328
  /** parser for headers */
318
329
  grpc_chttp2_hpack_parser hpack_parser;
@@ -425,7 +436,7 @@ struct grpc_chttp2_stream {
425
436
  grpc_stream_refcount *refcount;
426
437
 
427
438
  grpc_closure destroy_stream;
428
- void *destroy_stream_arg;
439
+ grpc_closure *destroy_stream_arg;
429
440
 
430
441
  grpc_chttp2_stream_link links[STREAM_LIST_COUNT];
431
442
  uint8_t included[STREAM_LIST_COUNT];
@@ -449,7 +460,6 @@ struct grpc_chttp2_stream {
449
460
  int64_t next_message_end_offset;
450
461
  int64_t flow_controlled_bytes_written;
451
462
  bool complete_fetch_covered_by_poller;
452
- grpc_closure complete_fetch;
453
463
  grpc_closure complete_fetch_locked;
454
464
  grpc_closure *fetching_send_message_finished;
455
465
 
@@ -790,6 +800,13 @@ void grpc_chttp2_incoming_byte_stream_finished(
790
800
  void grpc_chttp2_ack_ping(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
791
801
  uint64_t id);
792
802
 
803
+ /** Add a new ping strike to ping_recv_state.ping_strikes. If
804
+ ping_recv_state.ping_strikes > ping_policy.max_ping_strikes, it sends GOAWAY
805
+ with error code ENHANCE_YOUR_CALM and additional debug data resembling
806
+ “too_many_pings” followed by immediately closing the connection. */
807
+ void grpc_chttp2_add_ping_strike(grpc_exec_ctx *exec_ctx,
808
+ grpc_chttp2_transport *t);
809
+
793
810
  typedef enum {
794
811
  /* don't initiate a transport write, but piggyback on the next one */
795
812
  GRPC_CHTTP2_STREAM_WRITE_PIGGYBACK,
@@ -827,4 +844,9 @@ void grpc_chttp2_fail_pending_writes(grpc_exec_ctx *exec_ctx,
827
844
 
828
845
  uint32_t grpc_chttp2_target_incoming_window(grpc_chttp2_transport *t);
829
846
 
847
+ /** Set the default keepalive configurations, must only be called at
848
+ initialization */
849
+ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args *args,
850
+ bool is_client);
851
+
830
852
  #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H */
@@ -116,7 +116,7 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
116
116
  GRPC_CHTTP2_CLIENT_CONNECT_STRING[t->deframe_state],
117
117
  (int)(uint8_t)GRPC_CHTTP2_CLIENT_CONNECT_STRING[t->deframe_state],
118
118
  *cur, (int)*cur, t->deframe_state);
119
- err = GRPC_ERROR_CREATE(msg);
119
+ err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
120
120
  gpr_free(msg);
121
121
  return err;
122
122
  }
@@ -219,7 +219,7 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
219
219
  t->incoming_frame_size,
220
220
  t->settings[GRPC_ACKED_SETTINGS]
221
221
  [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE]);
222
- err = GRPC_ERROR_CREATE(msg);
222
+ err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
223
223
  gpr_free(msg);
224
224
  return err;
225
225
  }
@@ -278,7 +278,7 @@ static grpc_error *init_frame_parser(grpc_exec_ctx *exec_ctx,
278
278
  gpr_asprintf(
279
279
  &msg, "Expected SETTINGS frame as the first frame, got frame type %d",
280
280
  t->incoming_frame_type);
281
- grpc_error *err = GRPC_ERROR_CREATE(msg);
281
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
282
282
  gpr_free(msg);
283
283
  return err;
284
284
  }
@@ -288,7 +288,7 @@ static grpc_error *init_frame_parser(grpc_exec_ctx *exec_ctx,
288
288
  char *msg;
289
289
  gpr_asprintf(&msg, "Expected CONTINUATION frame, got frame type %02x",
290
290
  t->incoming_frame_type);
291
- grpc_error *err = GRPC_ERROR_CREATE(msg);
291
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
292
292
  gpr_free(msg);
293
293
  return err;
294
294
  }
@@ -299,7 +299,7 @@ static grpc_error *init_frame_parser(grpc_exec_ctx *exec_ctx,
299
299
  "Expected CONTINUATION frame for grpc_chttp2_stream %08x, got "
300
300
  "grpc_chttp2_stream %08x",
301
301
  t->expect_continuation_stream_id, t->incoming_stream_id);
302
- grpc_error *err = GRPC_ERROR_CREATE(msg);
302
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
303
303
  gpr_free(msg);
304
304
  return err;
305
305
  }
@@ -311,7 +311,8 @@ static grpc_error *init_frame_parser(grpc_exec_ctx *exec_ctx,
311
311
  case GRPC_CHTTP2_FRAME_HEADER:
312
312
  return init_header_frame_parser(exec_ctx, t, 0);
313
313
  case GRPC_CHTTP2_FRAME_CONTINUATION:
314
- return GRPC_ERROR_CREATE("Unexpected CONTINUATION frame");
314
+ return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
315
+ "Unexpected CONTINUATION frame");
315
316
  case GRPC_CHTTP2_FRAME_RST_STREAM:
316
317
  return init_rst_stream_parser(exec_ctx, t);
317
318
  case GRPC_CHTTP2_FRAME_SETTINGS:
@@ -371,7 +372,7 @@ static grpc_error *update_incoming_window(grpc_exec_ctx *exec_ctx,
371
372
  char *msg;
372
373
  gpr_asprintf(&msg, "frame of size %d overflows incoming window of %" PRId64,
373
374
  t->incoming_frame_size, t->incoming_window);
374
- grpc_error *err = GRPC_ERROR_CREATE(msg);
375
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
375
376
  gpr_free(msg);
376
377
  return err;
377
378
  }
@@ -409,7 +410,7 @@ static grpc_error *update_incoming_window(grpc_exec_ctx *exec_ctx,
409
410
  s->incoming_window_delta +
410
411
  t->settings[GRPC_ACKED_SETTINGS]
411
412
  [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]);
412
- grpc_error *err = GRPC_ERROR_CREATE(msg);
413
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
413
414
  gpr_free(msg);
414
415
  return err;
415
416
  }
@@ -542,13 +543,21 @@ static void on_initial_header(grpc_exec_ctx *exec_ctx, void *tp,
542
543
  grpc_chttp2_cancel_stream(
543
544
  exec_ctx, t, s,
544
545
  grpc_error_set_int(
545
- GRPC_ERROR_CREATE("received initial metadata size exceeds limit"),
546
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING(
547
+ "received initial metadata size exceeds limit"),
546
548
  GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
547
549
  grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
548
550
  s->seen_error = true;
549
551
  GRPC_MDELEM_UNREF(exec_ctx, md);
550
552
  } else {
551
- grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[0], md);
553
+ grpc_error *error = grpc_chttp2_incoming_metadata_buffer_add(
554
+ exec_ctx, &s->metadata_buffer[0], md);
555
+ if (error != GRPC_ERROR_NONE) {
556
+ grpc_chttp2_cancel_stream(exec_ctx, t, s, error);
557
+ grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
558
+ s->seen_error = true;
559
+ GRPC_MDELEM_UNREF(exec_ctx, md);
560
+ }
552
561
  }
553
562
  }
554
563
 
@@ -591,14 +600,22 @@ static void on_trailing_header(grpc_exec_ctx *exec_ctx, void *tp,
591
600
  new_size, metadata_size_limit);
592
601
  grpc_chttp2_cancel_stream(
593
602
  exec_ctx, t, s,
594
- grpc_error_set_int(
595
- GRPC_ERROR_CREATE("received trailing metadata size exceeds limit"),
596
- GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
603
+ grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
604
+ "received trailing metadata size exceeds limit"),
605
+ GRPC_ERROR_INT_GRPC_STATUS,
606
+ GRPC_STATUS_RESOURCE_EXHAUSTED));
597
607
  grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
598
608
  s->seen_error = true;
599
609
  GRPC_MDELEM_UNREF(exec_ctx, md);
600
610
  } else {
601
- grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[1], md);
611
+ grpc_error *error = grpc_chttp2_incoming_metadata_buffer_add(
612
+ exec_ctx, &s->metadata_buffer[1], md);
613
+ if (error != GRPC_ERROR_NONE) {
614
+ grpc_chttp2_cancel_stream(exec_ctx, t, s, error);
615
+ grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
616
+ s->seen_error = true;
617
+ GRPC_MDELEM_UNREF(exec_ctx, md);
618
+ }
602
619
  }
603
620
 
604
621
  GPR_TIMER_END("on_trailing_header", 0);
@@ -757,7 +774,8 @@ static grpc_error *init_goaway_parser(grpc_exec_ctx *exec_ctx,
757
774
  static grpc_error *init_settings_frame_parser(grpc_exec_ctx *exec_ctx,
758
775
  grpc_chttp2_transport *t) {
759
776
  if (t->incoming_stream_id != 0) {
760
- return GRPC_ERROR_CREATE("Settings frame received for grpc_chttp2_stream");
777
+ return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
778
+ "Settings frame received for grpc_chttp2_stream");
761
779
  }
762
780
 
763
781
  grpc_error *err = grpc_chttp2_settings_parser_begin_frame(
@@ -101,6 +101,14 @@ static void maybe_initiate_ping(grpc_exec_ctx *exec_ctx,
101
101
  "Ping delayed [%p]: not enough time elapsed since last ping",
102
102
  t->peer_string);
103
103
  }
104
+ if (!t->ping_state.is_delayed_ping_timer_set) {
105
+ t->ping_state.is_delayed_ping_timer_set = true;
106
+ grpc_timer_init(exec_ctx, &t->ping_state.delayed_ping_timer,
107
+ gpr_time_add(t->ping_state.last_ping_sent_time,
108
+ t->ping_policy.min_time_between_pings),
109
+ &t->retry_initiate_ping_locked,
110
+ gpr_now(GPR_CLOCK_MONOTONIC));
111
+ }
104
112
  return;
105
113
  }
106
114
  /* coalesce equivalent pings into this one */
@@ -211,16 +219,29 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
211
219
 
212
220
  /* send initial metadata if it's available */
213
221
  if (!sent_initial_metadata && s->send_initial_metadata) {
214
- grpc_chttp2_encode_header(
215
- exec_ctx, &t->hpack_compressor, s->id, s->send_initial_metadata, 0,
216
- t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
217
- &s->stats.outgoing, &t->outbuf);
222
+ grpc_encode_header_options hopt = {
223
+ .stream_id = s->id,
224
+ .is_eof = false,
225
+ .use_true_binary_metadata =
226
+ t->settings
227
+ [GRPC_PEER_SETTINGS]
228
+ [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != 0,
229
+ .max_frame_size = t->settings[GRPC_PEER_SETTINGS]
230
+ [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
231
+ .stats = &s->stats.outgoing};
232
+ grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor,
233
+ s->send_initial_metadata, &hopt, &t->outbuf);
218
234
  s->send_initial_metadata = NULL;
219
235
  s->sent_initial_metadata = true;
220
236
  sent_initial_metadata = true;
221
237
  now_writing = true;
222
238
  t->ping_state.pings_before_data_required =
223
239
  t->ping_policy.max_pings_without_data;
240
+ if (!t->is_client) {
241
+ t->ping_recv_state.last_ping_recv_time =
242
+ gpr_inf_past(GPR_CLOCK_MONOTONIC);
243
+ t->ping_recv_state.ping_strikes = 0;
244
+ }
224
245
  }
225
246
  /* send any window updates */
226
247
  if (s->announce_window > 0) {
@@ -230,6 +251,11 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
230
251
  s->id, s->announce_window, &s->stats.outgoing));
231
252
  t->ping_state.pings_before_data_required =
232
253
  t->ping_policy.max_pings_without_data;
254
+ if (!t->is_client) {
255
+ t->ping_recv_state.last_ping_recv_time =
256
+ gpr_inf_past(GPR_CLOCK_MONOTONIC);
257
+ t->ping_recv_state.ping_strikes = 0;
258
+ }
233
259
  GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", t, s, announce_window, announce);
234
260
  }
235
261
  if (sent_initial_metadata) {
@@ -241,7 +267,7 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
241
267
  (int64_t)t->settings[GRPC_PEER_SETTINGS]
242
268
  [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]);
243
269
  uint32_t max_outgoing = (uint32_t)GPR_MIN(
244
- t->settings[GRPC_ACKED_SETTINGS]
270
+ t->settings[GRPC_PEER_SETTINGS]
245
271
  [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
246
272
  GPR_MIN(stream_outgoing_window, t->outgoing_window));
247
273
  if (max_outgoing > 0) {
@@ -262,6 +288,11 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
262
288
  send_bytes);
263
289
  t->ping_state.pings_before_data_required =
264
290
  t->ping_policy.max_pings_without_data;
291
+ if (!t->is_client) {
292
+ t->ping_recv_state.last_ping_recv_time =
293
+ gpr_inf_past(GPR_CLOCK_MONOTONIC);
294
+ t->ping_recv_state.ping_strikes = 0;
295
+ }
265
296
  if (is_last_frame) {
266
297
  s->send_trailing_metadata = NULL;
267
298
  s->sent_trailing_metadata = true;
@@ -292,11 +323,21 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
292
323
  grpc_chttp2_encode_data(s->id, &s->flow_controlled_buffer, 0, true,
293
324
  &s->stats.outgoing, &t->outbuf);
294
325
  } else {
295
- grpc_chttp2_encode_header(
296
- exec_ctx, &t->hpack_compressor, s->id, s->send_trailing_metadata,
297
- true, t->settings[GRPC_ACKED_SETTINGS]
298
- [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
299
- &s->stats.outgoing, &t->outbuf);
326
+ grpc_encode_header_options hopt = {
327
+ .stream_id = s->id,
328
+ .is_eof = true,
329
+ .use_true_binary_metadata =
330
+ t->settings
331
+ [GRPC_PEER_SETTINGS]
332
+ [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] !=
333
+ 0,
334
+ .max_frame_size =
335
+ t->settings[GRPC_PEER_SETTINGS]
336
+ [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
337
+ .stats = &s->stats.outgoing};
338
+ grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor,
339
+ s->send_trailing_metadata, &hopt,
340
+ &t->outbuf);
300
341
  }
301
342
  s->send_trailing_metadata = NULL;
302
343
  s->sent_trailing_metadata = true;
@@ -337,6 +378,11 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
337
378
  0, announced, &throwaway_stats));
338
379
  t->ping_state.pings_before_data_required =
339
380
  t->ping_policy.max_pings_without_data;
381
+ if (!t->is_client) {
382
+ t->ping_recv_state.last_ping_recv_time =
383
+ gpr_inf_past(GPR_CLOCK_MONOTONIC);
384
+ t->ping_recv_state.ping_strikes = 0;
385
+ }
340
386
  }
341
387
 
342
388
  for (size_t i = 0; i < t->ping_ack_count; i++) {
@@ -346,3 +346,10 @@ int grpc_channel_arg_get_integer(grpc_arg *arg, grpc_integer_options options) {
346
346
  }
347
347
  return arg->value.integer;
348
348
  }
349
+
350
+ bool grpc_channel_args_want_minimal_stack(const grpc_channel_args *args) {
351
+ const grpc_arg *arg = grpc_channel_args_find(args, GRPC_ARG_MINIMAL_STACK);
352
+ if (arg == NULL) return false;
353
+ if (arg->type == GRPC_ARG_INTEGER && arg->value.integer == 0) return false;
354
+ return true;
355
+ }
@@ -113,6 +113,8 @@ grpc_channel_args *grpc_channel_args_set_socket_mutator(
113
113
  const grpc_arg *grpc_channel_args_find(const grpc_channel_args *args,
114
114
  const char *name);
115
115
 
116
+ bool grpc_channel_args_want_minimal_stack(const grpc_channel_args *args);
117
+
116
118
  typedef struct grpc_integer_options {
117
119
  int default_value; // Return this if value is outside of expected bounds.
118
120
  int min_value;
@@ -166,41 +166,32 @@ void grpc_channel_stack_destroy(grpc_exec_ctx *exec_ctx,
166
166
  }
167
167
  }
168
168
 
169
- grpc_error *grpc_call_stack_init(
170
- grpc_exec_ctx *exec_ctx, grpc_channel_stack *channel_stack,
171
- int initial_refs, grpc_iomgr_cb_func destroy, void *destroy_arg,
172
- grpc_call_context_element *context, const void *transport_server_data,
173
- grpc_slice path, gpr_timespec start_time, gpr_timespec deadline,
174
- grpc_call_stack *call_stack) {
169
+ grpc_error *grpc_call_stack_init(grpc_exec_ctx *exec_ctx,
170
+ grpc_channel_stack *channel_stack,
171
+ int initial_refs, grpc_iomgr_cb_func destroy,
172
+ void *destroy_arg,
173
+ const grpc_call_element_args *elem_args) {
175
174
  grpc_channel_element *channel_elems = CHANNEL_ELEMS_FROM_STACK(channel_stack);
176
175
  size_t count = channel_stack->count;
177
176
  grpc_call_element *call_elems;
178
177
  char *user_data;
179
178
  size_t i;
180
179
 
181
- call_stack->count = count;
182
- GRPC_STREAM_REF_INIT(&call_stack->refcount, initial_refs, destroy,
180
+ elem_args->call_stack->count = count;
181
+ GRPC_STREAM_REF_INIT(&elem_args->call_stack->refcount, initial_refs, destroy,
183
182
  destroy_arg, "CALL_STACK");
184
- call_elems = CALL_ELEMS_FROM_STACK(call_stack);
183
+ call_elems = CALL_ELEMS_FROM_STACK(elem_args->call_stack);
185
184
  user_data = ((char *)call_elems) +
186
185
  ROUND_UP_TO_ALIGNMENT_SIZE(count * sizeof(grpc_call_element));
187
186
 
188
187
  /* init per-filter data */
189
188
  grpc_error *first_error = GRPC_ERROR_NONE;
190
- const grpc_call_element_args args = {
191
- .start_time = start_time,
192
- .call_stack = call_stack,
193
- .server_transport_data = transport_server_data,
194
- .context = context,
195
- .path = path,
196
- .deadline = deadline,
197
- };
198
189
  for (i = 0; i < count; i++) {
199
190
  call_elems[i].filter = channel_elems[i].filter;
200
191
  call_elems[i].channel_data = channel_elems[i].channel_data;
201
192
  call_elems[i].call_data = user_data;
202
- grpc_error *error =
203
- call_elems[i].filter->init_call_elem(exec_ctx, &call_elems[i], &args);
193
+ grpc_error *error = call_elems[i].filter->init_call_elem(
194
+ exec_ctx, &call_elems[i], elem_args);
204
195
  if (error != GRPC_ERROR_NONE) {
205
196
  if (first_error == GRPC_ERROR_NONE) {
206
197
  first_error = error;
@@ -241,22 +232,23 @@ void grpc_call_stack_ignore_set_pollset_or_pollset_set(
241
232
 
242
233
  void grpc_call_stack_destroy(grpc_exec_ctx *exec_ctx, grpc_call_stack *stack,
243
234
  const grpc_call_final_info *final_info,
244
- void *and_free_memory) {
235
+ grpc_closure *then_schedule_closure) {
245
236
  grpc_call_element *elems = CALL_ELEMS_FROM_STACK(stack);
246
237
  size_t count = stack->count;
247
238
  size_t i;
248
239
 
249
240
  /* destroy per-filter data */
250
241
  for (i = 0; i < count; i++) {
251
- elems[i].filter->destroy_call_elem(exec_ctx, &elems[i], final_info,
252
- i == count - 1 ? and_free_memory : NULL);
242
+ elems[i].filter->destroy_call_elem(
243
+ exec_ctx, &elems[i], final_info,
244
+ i == count - 1 ? then_schedule_closure : NULL);
253
245
  }
254
246
  }
255
247
 
256
248
  void grpc_call_next_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
257
- grpc_transport_stream_op *op) {
249
+ grpc_transport_stream_op_batch *op) {
258
250
  grpc_call_element *next_elem = elem + 1;
259
- next_elem->filter->start_transport_stream_op(exec_ctx, next_elem, op);
251
+ next_elem->filter->start_transport_stream_op_batch(exec_ctx, next_elem, op);
260
252
  }
261
253
 
262
254
  char *grpc_call_next_get_peer(grpc_exec_ctx *exec_ctx,
@@ -292,7 +284,8 @@ grpc_call_stack *grpc_call_stack_from_top_element(grpc_call_element *elem) {
292
284
  void grpc_call_element_signal_error(grpc_exec_ctx *exec_ctx,
293
285
  grpc_call_element *elem,
294
286
  grpc_error *error) {
295
- grpc_transport_stream_op *op = grpc_make_transport_stream_op(NULL);
296
- op->cancel_error = error;
297
- elem->filter->start_transport_stream_op(exec_ctx, elem, op);
287
+ grpc_transport_stream_op_batch *op = grpc_make_transport_stream_op(NULL);
288
+ op->cancel_stream = true;
289
+ op->payload->cancel_stream.cancel_error = error;
290
+ elem->filter->start_transport_stream_op_batch(exec_ctx, elem, op);
298
291
  }