grpc 1.4.5 → 1.6.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 (928) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1235 -1100
  3. data/etc/roots.pem +0 -412
  4. data/include/grpc/byte_buffer.h +10 -25
  5. data/include/grpc/byte_buffer_reader.h +10 -25
  6. data/include/grpc/census.h +10 -25
  7. data/include/grpc/compression.h +10 -25
  8. data/include/grpc/grpc.h +15 -26
  9. data/include/grpc/grpc_cronet.h +10 -25
  10. data/include/grpc/grpc_posix.h +10 -25
  11. data/include/grpc/grpc_security.h +10 -25
  12. data/include/grpc/grpc_security_constants.h +10 -25
  13. data/include/grpc/impl/codegen/atm.h +11 -25
  14. data/include/grpc/impl/codegen/atm_gcc_atomic.h +10 -25
  15. data/include/grpc/impl/codegen/atm_gcc_sync.h +10 -25
  16. data/include/grpc/impl/codegen/atm_windows.h +10 -25
  17. data/include/grpc/impl/codegen/byte_buffer_reader.h +11 -26
  18. data/include/grpc/impl/codegen/compression_types.h +12 -27
  19. data/include/grpc/impl/codegen/connectivity_state.h +10 -25
  20. data/include/grpc/impl/codegen/exec_ctx_fwd.h +10 -25
  21. data/include/grpc/impl/codegen/gpr_slice.h +10 -25
  22. data/include/grpc/impl/codegen/gpr_types.h +10 -25
  23. data/include/grpc/impl/codegen/grpc_types.h +42 -43
  24. data/include/grpc/impl/codegen/port_platform.h +10 -25
  25. data/include/grpc/impl/codegen/propagation_bits.h +10 -25
  26. data/include/grpc/impl/codegen/slice.h +13 -28
  27. data/include/grpc/impl/codegen/status.h +10 -25
  28. data/include/grpc/impl/codegen/sync.h +10 -25
  29. data/include/grpc/impl/codegen/sync_generic.h +10 -25
  30. data/include/grpc/impl/codegen/sync_posix.h +10 -25
  31. data/include/grpc/impl/codegen/sync_windows.h +10 -25
  32. data/include/grpc/load_reporting.h +10 -25
  33. data/include/grpc/slice.h +10 -25
  34. data/include/grpc/slice_buffer.h +10 -25
  35. data/include/grpc/status.h +10 -25
  36. data/include/grpc/support/alloc.h +10 -25
  37. data/include/grpc/support/atm.h +10 -25
  38. data/include/grpc/support/atm_gcc_atomic.h +10 -25
  39. data/include/grpc/support/atm_gcc_sync.h +10 -25
  40. data/include/grpc/support/atm_windows.h +10 -25
  41. data/include/grpc/support/avl.h +46 -49
  42. data/include/grpc/support/cmdline.h +10 -25
  43. data/include/grpc/support/cpu.h +10 -25
  44. data/include/grpc/support/histogram.h +10 -25
  45. data/include/grpc/support/host_port.h +10 -25
  46. data/include/grpc/support/log.h +10 -25
  47. data/include/grpc/support/log_windows.h +10 -25
  48. data/include/grpc/support/port_platform.h +10 -25
  49. data/include/grpc/support/string_util.h +10 -25
  50. data/include/grpc/support/subprocess.h +10 -25
  51. data/include/grpc/support/sync.h +10 -25
  52. data/include/grpc/support/sync_generic.h +10 -25
  53. data/include/grpc/support/sync_posix.h +10 -25
  54. data/include/grpc/support/sync_windows.h +10 -25
  55. data/include/grpc/support/thd.h +10 -25
  56. data/include/grpc/support/time.h +10 -25
  57. data/include/grpc/support/tls.h +10 -25
  58. data/include/grpc/support/tls_gcc.h +10 -25
  59. data/include/grpc/support/tls_msvc.h +10 -25
  60. data/include/grpc/support/tls_pthread.h +10 -25
  61. data/include/grpc/support/useful.h +10 -25
  62. data/include/grpc/support/workaround_list.h +11 -26
  63. data/src/boringssl/err_data.c +277 -259
  64. data/src/core/ext/census/aggregation.h +10 -25
  65. data/src/core/ext/census/base_resources.c +10 -25
  66. data/src/core/ext/census/base_resources.h +10 -25
  67. data/src/core/ext/census/census_interface.h +10 -25
  68. data/src/core/ext/census/census_rpc_stats.h +10 -25
  69. data/src/core/ext/census/context.c +10 -25
  70. data/src/core/ext/census/gen/census.pb.c +10 -25
  71. data/src/core/ext/census/gen/census.pb.h +10 -25
  72. data/src/core/ext/census/gen/trace_context.pb.c +10 -25
  73. data/src/core/ext/census/gen/trace_context.pb.h +10 -25
  74. data/src/core/ext/census/grpc_context.c +10 -25
  75. data/src/core/ext/census/grpc_filter.c +11 -26
  76. data/src/core/ext/census/grpc_filter.h +10 -25
  77. data/src/core/ext/census/grpc_plugin.c +10 -25
  78. data/src/core/ext/census/initialize.c +10 -25
  79. data/src/core/ext/census/intrusive_hash_map.c +10 -25
  80. data/src/core/ext/census/intrusive_hash_map.h +10 -25
  81. data/src/core/ext/census/intrusive_hash_map_internal.h +10 -25
  82. data/src/core/ext/census/mlog.c +10 -25
  83. data/src/core/ext/census/mlog.h +10 -25
  84. data/src/core/ext/census/operation.c +10 -25
  85. data/src/core/ext/census/placeholders.c +10 -25
  86. data/src/core/ext/census/resource.c +10 -25
  87. data/src/core/ext/census/resource.h +10 -25
  88. data/src/core/ext/census/rpc_metric_id.h +10 -25
  89. data/src/core/ext/census/trace_context.c +10 -25
  90. data/src/core/ext/census/trace_context.h +10 -25
  91. data/src/core/ext/census/trace_label.h +10 -25
  92. data/src/core/ext/census/trace_propagation.h +10 -25
  93. data/src/core/ext/census/trace_status.h +10 -25
  94. data/src/core/ext/census/trace_string.h +10 -25
  95. data/src/core/ext/census/tracing.c +10 -26
  96. data/src/core/ext/census/tracing.h +10 -25
  97. data/src/core/ext/filters/client_channel/channel_connectivity.c +20 -33
  98. data/src/core/ext/filters/client_channel/client_channel.c +617 -520
  99. data/src/core/ext/filters/client_channel/client_channel.h +15 -28
  100. data/src/core/ext/filters/client_channel/client_channel_factory.c +13 -31
  101. data/src/core/ext/filters/client_channel/client_channel_factory.h +10 -25
  102. data/src/core/ext/filters/client_channel/client_channel_plugin.c +16 -29
  103. data/src/core/ext/filters/client_channel/connector.c +10 -25
  104. data/src/core/ext/filters/client_channel/connector.h +10 -25
  105. data/src/core/ext/filters/client_channel/http_connect_handshaker.c +15 -30
  106. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +10 -25
  107. data/src/core/ext/filters/client_channel/http_proxy.c +112 -38
  108. data/src/core/ext/filters/client_channel/http_proxy.h +10 -25
  109. data/src/core/ext/filters/client_channel/lb_policy.c +32 -36
  110. data/src/core/ext/filters/client_channel/lb_policy.h +24 -27
  111. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +14 -30
  112. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +10 -25
  113. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +464 -279
  114. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +10 -25
  115. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +15 -28
  116. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.c +40 -48
  117. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +65 -49
  118. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +31 -31
  119. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +47 -32
  120. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +11 -26
  121. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +13 -9
  122. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +27 -21
  123. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +373 -136
  124. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +504 -279
  125. data/src/core/ext/filters/client_channel/lb_policy_factory.c +12 -31
  126. data/src/core/ext/filters/client_channel/lb_policy_factory.h +12 -27
  127. data/src/core/ext/filters/client_channel/lb_policy_registry.c +10 -25
  128. data/src/core/ext/filters/client_channel/lb_policy_registry.h +10 -25
  129. data/src/core/ext/filters/client_channel/parse_address.c +10 -25
  130. data/src/core/ext/filters/client_channel/parse_address.h +10 -25
  131. data/src/core/ext/filters/client_channel/proxy_mapper.c +10 -25
  132. data/src/core/ext/filters/client_channel/proxy_mapper.h +10 -25
  133. data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +10 -25
  134. data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +10 -25
  135. data/src/core/ext/filters/client_channel/resolver.c +33 -38
  136. data/src/core/ext/filters/client_channel/resolver.h +19 -30
  137. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +153 -50
  138. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +14 -27
  139. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +33 -30
  140. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +326 -116
  141. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +35 -36
  142. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c +60 -0
  143. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c +19 -34
  144. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +254 -0
  145. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +60 -0
  146. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +16 -28
  147. data/src/core/ext/filters/client_channel/resolver_factory.c +10 -25
  148. data/src/core/ext/filters/client_channel/resolver_factory.h +10 -25
  149. data/src/core/ext/filters/client_channel/resolver_registry.c +10 -25
  150. data/src/core/ext/filters/client_channel/resolver_registry.h +10 -25
  151. data/src/core/ext/filters/client_channel/retry_throttle.c +23 -34
  152. data/src/core/ext/filters/client_channel/retry_throttle.h +10 -25
  153. data/src/core/ext/filters/client_channel/subchannel.c +33 -55
  154. data/src/core/ext/filters/client_channel/subchannel.h +16 -26
  155. data/src/core/ext/filters/client_channel/subchannel_index.c +55 -92
  156. data/src/core/ext/filters/client_channel/subchannel_index.h +26 -29
  157. data/src/core/ext/filters/client_channel/uri_parser.c +10 -25
  158. data/src/core/ext/filters/client_channel/uri_parser.h +10 -25
  159. data/src/core/ext/filters/deadline/deadline_filter.c +30 -45
  160. data/src/core/ext/filters/deadline/deadline_filter.h +10 -25
  161. data/src/core/ext/filters/http/client/http_client_filter.c +255 -294
  162. data/src/core/ext/filters/http/client/http_client_filter.h +10 -25
  163. data/src/core/ext/filters/http/http_filters_plugin.c +11 -26
  164. data/src/core/ext/filters/http/message_compress/message_compress_filter.c +133 -105
  165. data/src/core/ext/filters/http/message_compress/message_compress_filter.h +10 -25
  166. data/src/core/ext/filters/http/server/http_server_filter.c +17 -32
  167. data/src/core/ext/filters/http/server/http_server_filter.h +10 -25
  168. data/src/core/ext/filters/load_reporting/load_reporting.c +11 -30
  169. data/src/core/ext/filters/load_reporting/load_reporting.h +10 -25
  170. data/src/core/ext/filters/load_reporting/load_reporting_filter.c +11 -26
  171. data/src/core/ext/filters/load_reporting/load_reporting_filter.h +10 -25
  172. data/src/core/ext/filters/max_age/max_age_filter.c +28 -43
  173. data/src/core/ext/filters/max_age/max_age_filter.h +10 -25
  174. data/src/core/ext/filters/message_size/message_size_filter.c +24 -37
  175. data/src/core/ext/filters/message_size/message_size_filter.h +10 -25
  176. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +16 -31
  177. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +10 -25
  178. data/src/core/ext/filters/workarounds/workaround_utils.c +12 -26
  179. data/src/core/ext/filters/workarounds/workaround_utils.h +11 -26
  180. data/src/core/ext/transport/chttp2/alpn/alpn.c +10 -25
  181. data/src/core/ext/transport/chttp2/alpn/alpn.h +10 -25
  182. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +13 -28
  183. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +10 -25
  184. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +13 -30
  185. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +12 -29
  186. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +13 -30
  187. data/src/core/ext/transport/chttp2/server/chttp2_server.c +11 -26
  188. data/src/core/ext/transport/chttp2/server/chttp2_server.h +10 -25
  189. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +10 -25
  190. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +10 -25
  191. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +10 -25
  192. data/src/core/ext/transport/chttp2/transport/bin_decoder.c +11 -25
  193. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +10 -25
  194. data/src/core/ext/transport/chttp2/transport/bin_encoder.c +10 -25
  195. data/src/core/ext/transport/chttp2/transport/bin_encoder.h +10 -25
  196. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +15 -27
  197. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +421 -443
  198. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +14 -25
  199. data/src/core/ext/transport/chttp2/transport/flow_control.c +500 -0
  200. data/src/core/ext/transport/chttp2/transport/frame.h +10 -25
  201. data/src/core/ext/transport/chttp2/transport/frame_data.c +20 -28
  202. data/src/core/ext/transport/chttp2/transport/frame_data.h +10 -25
  203. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +10 -25
  204. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +10 -25
  205. data/src/core/ext/transport/chttp2/transport/frame_ping.c +11 -26
  206. data/src/core/ext/transport/chttp2/transport/frame_ping.h +10 -25
  207. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +11 -26
  208. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +10 -25
  209. data/src/core/ext/transport/chttp2/transport/frame_settings.c +16 -29
  210. data/src/core/ext/transport/chttp2/transport/frame_settings.h +10 -25
  211. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +17 -33
  212. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +10 -25
  213. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +18 -31
  214. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +12 -25
  215. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +15 -30
  216. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +10 -25
  217. data/src/core/ext/transport/chttp2/transport/hpack_table.c +10 -25
  218. data/src/core/ext/transport/chttp2/transport/hpack_table.h +10 -25
  219. data/src/core/ext/transport/chttp2/transport/http2_settings.c +10 -25
  220. data/src/core/ext/transport/chttp2/transport/http2_settings.h +10 -25
  221. data/src/core/ext/transport/chttp2/transport/huffsyms.c +10 -25
  222. data/src/core/ext/transport/chttp2/transport/huffsyms.h +10 -25
  223. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +10 -25
  224. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +10 -25
  225. data/src/core/ext/transport/chttp2/transport/internal.h +191 -179
  226. data/src/core/ext/transport/chttp2/transport/parsing.c +33 -102
  227. data/src/core/ext/transport/chttp2/transport/stream_lists.c +26 -28
  228. data/src/core/ext/transport/chttp2/transport/stream_map.c +10 -25
  229. data/src/core/ext/transport/chttp2/transport/stream_map.h +10 -25
  230. data/src/core/ext/transport/chttp2/transport/varint.c +14 -25
  231. data/src/core/ext/transport/chttp2/transport/varint.h +10 -25
  232. data/src/core/ext/transport/chttp2/transport/writing.c +164 -106
  233. data/src/core/ext/transport/inproc/inproc_plugin.c +29 -0
  234. data/src/core/ext/transport/inproc/inproc_transport.c +1303 -0
  235. data/src/core/ext/transport/inproc/inproc_transport.h +41 -0
  236. data/src/core/lib/channel/channel_args.c +52 -27
  237. data/src/core/lib/channel/channel_args.h +18 -27
  238. data/src/core/lib/channel/channel_stack.c +11 -26
  239. data/src/core/lib/channel/channel_stack.h +12 -27
  240. data/src/core/lib/channel/channel_stack_builder.c +11 -26
  241. data/src/core/lib/channel/channel_stack_builder.h +10 -25
  242. data/src/core/lib/channel/connected_channel.c +10 -25
  243. data/src/core/lib/channel/connected_channel.h +10 -25
  244. data/src/core/lib/channel/context.h +10 -25
  245. data/src/core/lib/channel/handshaker.c +14 -29
  246. data/src/core/lib/channel/handshaker.h +10 -25
  247. data/src/core/lib/channel/handshaker_factory.c +10 -25
  248. data/src/core/lib/channel/handshaker_factory.h +10 -25
  249. data/src/core/lib/channel/handshaker_registry.c +10 -25
  250. data/src/core/lib/channel/handshaker_registry.h +10 -25
  251. data/src/core/lib/compression/algorithm_metadata.h +10 -25
  252. data/src/core/lib/compression/compression.c +10 -25
  253. data/src/core/lib/compression/message_compress.c +10 -25
  254. data/src/core/lib/compression/message_compress.h +10 -25
  255. data/src/core/lib/compression/stream_compression.c +191 -0
  256. data/src/core/lib/compression/stream_compression.h +90 -0
  257. data/src/core/lib/debug/trace.c +28 -29
  258. data/src/core/lib/debug/trace.h +16 -30
  259. data/src/core/lib/http/format_request.c +10 -25
  260. data/src/core/lib/http/format_request.h +10 -25
  261. data/src/core/lib/http/httpcli.c +19 -35
  262. data/src/core/lib/http/httpcli.h +10 -25
  263. data/src/core/lib/http/httpcli_security_connector.c +17 -30
  264. data/src/core/lib/http/parser.c +11 -26
  265. data/src/core/lib/http/parser.h +10 -25
  266. data/src/core/lib/iomgr/closure.c +62 -25
  267. data/src/core/lib/iomgr/closure.h +81 -26
  268. data/src/core/lib/iomgr/combiner.c +103 -200
  269. data/src/core/lib/iomgr/combiner.h +14 -32
  270. data/src/core/lib/iomgr/endpoint.c +10 -29
  271. data/src/core/lib/iomgr/endpoint.h +10 -29
  272. data/src/core/lib/iomgr/endpoint_pair.h +10 -25
  273. data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -25
  274. data/src/core/lib/iomgr/endpoint_pair_uv.c +10 -25
  275. data/src/core/lib/iomgr/endpoint_pair_windows.c +10 -25
  276. data/src/core/lib/iomgr/error.c +45 -46
  277. data/src/core/lib/iomgr/error.h +21 -34
  278. data/src/core/lib/iomgr/error_internal.h +10 -25
  279. data/src/core/lib/iomgr/ev_epoll1_linux.c +279 -179
  280. data/src/core/lib/iomgr/ev_epoll1_linux.h +10 -25
  281. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +75 -264
  282. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +10 -25
  283. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +44 -199
  284. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +10 -25
  285. data/src/core/lib/iomgr/ev_epollex_linux.c +184 -247
  286. data/src/core/lib/iomgr/ev_epollex_linux.h +10 -25
  287. data/src/core/lib/iomgr/ev_epollsig_linux.c +116 -323
  288. data/src/core/lib/iomgr/ev_epollsig_linux.h +10 -25
  289. data/src/core/lib/iomgr/ev_poll_posix.c +328 -184
  290. data/src/core/lib/iomgr/ev_poll_posix.h +10 -25
  291. data/src/core/lib/iomgr/ev_posix.c +25 -56
  292. data/src/core/lib/iomgr/ev_posix.h +15 -44
  293. data/src/core/lib/iomgr/ev_windows.c +11 -26
  294. data/src/core/lib/iomgr/exec_ctx.c +36 -45
  295. data/src/core/lib/iomgr/exec_ctx.h +10 -25
  296. data/src/core/lib/iomgr/executor.c +152 -127
  297. data/src/core/lib/iomgr/executor.h +18 -26
  298. data/src/core/lib/iomgr/gethostname.h +26 -0
  299. data/src/core/lib/iomgr/gethostname_fallback.c +27 -0
  300. data/src/core/lib/iomgr/gethostname_host_name_max.c +37 -0
  301. data/src/core/lib/iomgr/gethostname_sysconf.c +37 -0
  302. data/src/core/lib/iomgr/iocp_windows.c +10 -25
  303. data/src/core/lib/iomgr/iocp_windows.h +10 -25
  304. data/src/core/lib/iomgr/iomgr.c +17 -28
  305. data/src/core/lib/iomgr/iomgr.h +12 -27
  306. data/src/core/lib/iomgr/iomgr_internal.h +10 -25
  307. data/src/core/lib/iomgr/iomgr_posix.c +11 -26
  308. data/src/core/lib/iomgr/iomgr_posix.h +10 -25
  309. data/src/core/lib/iomgr/iomgr_uv.c +19 -26
  310. data/src/core/lib/iomgr/iomgr_uv.h +37 -0
  311. data/src/core/lib/iomgr/iomgr_windows.c +10 -25
  312. data/src/core/lib/iomgr/is_epollexclusive_available.c +10 -25
  313. data/src/core/lib/iomgr/is_epollexclusive_available.h +10 -25
  314. data/src/core/lib/iomgr/load_file.c +10 -25
  315. data/src/core/lib/iomgr/load_file.h +10 -25
  316. data/src/core/lib/iomgr/lockfree_event.c +22 -35
  317. data/src/core/lib/iomgr/lockfree_event.h +13 -27
  318. data/src/core/lib/iomgr/nameser.h +104 -0
  319. data/src/core/lib/iomgr/network_status_tracker.c +10 -25
  320. data/src/core/lib/iomgr/network_status_tracker.h +10 -25
  321. data/src/core/lib/iomgr/polling_entity.c +10 -25
  322. data/src/core/lib/iomgr/polling_entity.h +14 -34
  323. data/src/core/lib/iomgr/pollset.h +14 -25
  324. data/src/core/lib/iomgr/pollset_set.h +10 -25
  325. data/src/core/lib/iomgr/pollset_set_uv.c +10 -25
  326. data/src/core/lib/iomgr/pollset_set_windows.c +10 -25
  327. data/src/core/lib/iomgr/pollset_set_windows.h +10 -25
  328. data/src/core/lib/iomgr/pollset_uv.c +25 -26
  329. data/src/core/lib/iomgr/pollset_uv.h +10 -25
  330. data/src/core/lib/iomgr/pollset_windows.c +17 -27
  331. data/src/core/lib/iomgr/pollset_windows.h +10 -25
  332. data/src/core/lib/iomgr/port.h +24 -25
  333. data/src/core/lib/iomgr/resolve_address.h +10 -25
  334. data/src/core/lib/iomgr/resolve_address_posix.c +13 -28
  335. data/src/core/lib/iomgr/resolve_address_uv.c +31 -35
  336. data/src/core/lib/iomgr/resolve_address_windows.c +13 -28
  337. data/src/core/lib/iomgr/resource_quota.c +52 -67
  338. data/src/core/lib/iomgr/resource_quota.h +10 -25
  339. data/src/core/lib/iomgr/sockaddr.h +10 -25
  340. data/src/core/lib/iomgr/sockaddr_posix.h +10 -25
  341. data/src/core/lib/iomgr/sockaddr_utils.c +15 -25
  342. data/src/core/lib/iomgr/sockaddr_utils.h +12 -25
  343. data/src/core/lib/iomgr/sockaddr_windows.h +10 -25
  344. data/src/core/lib/iomgr/socket_factory_posix.c +13 -31
  345. data/src/core/lib/iomgr/socket_factory_posix.h +10 -25
  346. data/src/core/lib/iomgr/socket_mutator.c +14 -31
  347. data/src/core/lib/iomgr/socket_mutator.h +10 -25
  348. data/src/core/lib/iomgr/socket_utils.h +10 -25
  349. data/src/core/lib/iomgr/socket_utils_common_posix.c +10 -25
  350. data/src/core/lib/iomgr/socket_utils_linux.c +10 -25
  351. data/src/core/lib/iomgr/socket_utils_posix.c +10 -25
  352. data/src/core/lib/iomgr/socket_utils_posix.h +10 -25
  353. data/src/core/lib/iomgr/socket_utils_uv.c +10 -25
  354. data/src/core/lib/iomgr/socket_utils_windows.c +10 -25
  355. data/src/core/lib/iomgr/socket_windows.c +12 -27
  356. data/src/core/lib/iomgr/socket_windows.h +10 -25
  357. data/src/core/lib/iomgr/sys_epoll_wrapper.h +10 -25
  358. data/src/core/lib/iomgr/tcp_client.h +10 -25
  359. data/src/core/lib/iomgr/tcp_client_posix.c +21 -34
  360. data/src/core/lib/iomgr/tcp_client_posix.h +10 -25
  361. data/src/core/lib/iomgr/tcp_client_uv.c +18 -27
  362. data/src/core/lib/iomgr/tcp_client_windows.c +14 -29
  363. data/src/core/lib/iomgr/tcp_posix.c +36 -55
  364. data/src/core/lib/iomgr/tcp_posix.h +10 -25
  365. data/src/core/lib/iomgr/tcp_server.h +10 -25
  366. data/src/core/lib/iomgr/tcp_server_posix.c +16 -31
  367. data/src/core/lib/iomgr/tcp_server_utils_posix.h +10 -25
  368. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +11 -26
  369. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +10 -25
  370. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +10 -25
  371. data/src/core/lib/iomgr/tcp_server_uv.c +103 -64
  372. data/src/core/lib/iomgr/tcp_server_windows.c +14 -29
  373. data/src/core/lib/iomgr/tcp_uv.c +41 -45
  374. data/src/core/lib/iomgr/tcp_uv.h +10 -25
  375. data/src/core/lib/iomgr/tcp_windows.c +39 -53
  376. data/src/core/lib/iomgr/tcp_windows.h +10 -25
  377. data/src/core/lib/iomgr/time_averaged_stats.c +10 -25
  378. data/src/core/lib/iomgr/time_averaged_stats.h +10 -25
  379. data/src/core/lib/iomgr/timer.h +18 -27
  380. data/src/core/lib/iomgr/timer_generic.c +91 -87
  381. data/src/core/lib/iomgr/timer_generic.h +10 -25
  382. data/src/core/lib/iomgr/timer_heap.c +10 -25
  383. data/src/core/lib/iomgr/timer_heap.h +10 -25
  384. data/src/core/lib/iomgr/timer_manager.c +178 -100
  385. data/src/core/lib/iomgr/timer_manager.h +10 -25
  386. data/src/core/lib/iomgr/timer_uv.c +23 -33
  387. data/src/core/lib/iomgr/timer_uv.h +10 -25
  388. data/src/core/lib/iomgr/udp_server.c +17 -32
  389. data/src/core/lib/iomgr/udp_server.h +10 -25
  390. data/src/core/lib/iomgr/unix_sockets_posix.c +10 -25
  391. data/src/core/lib/iomgr/unix_sockets_posix.h +10 -25
  392. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +10 -25
  393. data/src/core/lib/iomgr/wakeup_fd_cv.c +10 -25
  394. data/src/core/lib/iomgr/wakeup_fd_cv.h +13 -28
  395. data/src/core/lib/iomgr/wakeup_fd_eventfd.c +10 -25
  396. data/src/core/lib/iomgr/wakeup_fd_nospecial.c +10 -25
  397. data/src/core/lib/iomgr/wakeup_fd_pipe.c +10 -25
  398. data/src/core/lib/iomgr/wakeup_fd_pipe.h +10 -25
  399. data/src/core/lib/iomgr/wakeup_fd_posix.c +10 -25
  400. data/src/core/lib/iomgr/wakeup_fd_posix.h +10 -25
  401. data/src/core/lib/json/json.c +10 -25
  402. data/src/core/lib/json/json.h +10 -25
  403. data/src/core/lib/json/json_common.h +10 -25
  404. data/src/core/lib/json/json_reader.c +11 -25
  405. data/src/core/lib/json/json_reader.h +10 -25
  406. data/src/core/lib/json/json_string.c +10 -25
  407. data/src/core/lib/json/json_writer.c +10 -25
  408. data/src/core/lib/json/json_writer.h +10 -25
  409. data/src/core/lib/profiling/basic_timers.c +10 -25
  410. data/src/core/lib/profiling/stap_timers.c +10 -25
  411. data/src/core/lib/profiling/timers.h +10 -25
  412. data/src/core/lib/security/context/security_context.c +32 -40
  413. data/src/core/lib/security/context/security_context.h +15 -26
  414. data/src/core/lib/security/credentials/composite/composite_credentials.c +76 -81
  415. data/src/core/lib/security/credentials/composite/composite_credentials.h +10 -25
  416. data/src/core/lib/security/credentials/credentials.c +29 -49
  417. data/src/core/lib/security/credentials/credentials.h +48 -61
  418. data/src/core/lib/security/credentials/credentials_metadata.c +34 -78
  419. data/src/core/lib/security/credentials/fake/fake_credentials.c +33 -56
  420. data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -27
  421. data/src/core/lib/security/credentials/google_default/credentials_generic.c +10 -25
  422. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +12 -27
  423. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +10 -25
  424. data/src/core/lib/security/credentials/iam/iam_credentials.c +40 -40
  425. data/src/core/lib/security/credentials/iam/iam_credentials.h +11 -26
  426. data/src/core/lib/security/credentials/jwt/json_token.c +10 -25
  427. data/src/core/lib/security/credentials/jwt/json_token.h +10 -25
  428. data/src/core/lib/security/credentials/jwt/jwt_credentials.c +45 -48
  429. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +11 -26
  430. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +53 -33
  431. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +10 -25
  432. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +155 -87
  433. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +24 -28
  434. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +118 -82
  435. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +24 -27
  436. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +13 -32
  437. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -25
  438. data/src/core/lib/security/transport/auth_filters.h +10 -25
  439. data/src/core/lib/security/transport/client_auth_filter.c +217 -112
  440. data/src/core/lib/security/transport/lb_targets_info.c +16 -32
  441. data/src/core/lib/security/transport/lb_targets_info.h +10 -25
  442. data/src/core/lib/security/transport/secure_endpoint.c +29 -43
  443. data/src/core/lib/security/transport/secure_endpoint.h +10 -25
  444. data/src/core/lib/security/transport/security_connector.c +80 -61
  445. data/src/core/lib/security/transport/security_connector.h +35 -35
  446. data/src/core/lib/security/transport/security_handshaker.c +18 -33
  447. data/src/core/lib/security/transport/security_handshaker.h +10 -25
  448. data/src/core/lib/security/transport/server_auth_filter.c +62 -116
  449. data/src/core/lib/security/transport/tsi_error.c +10 -25
  450. data/src/core/lib/security/transport/tsi_error.h +10 -25
  451. data/src/core/lib/security/util/json_util.c +10 -25
  452. data/src/core/lib/security/util/json_util.h +10 -25
  453. data/src/core/lib/slice/b64.c +10 -25
  454. data/src/core/lib/slice/b64.h +10 -25
  455. data/src/core/lib/slice/percent_encoding.c +10 -25
  456. data/src/core/lib/slice/percent_encoding.h +10 -25
  457. data/src/core/lib/slice/slice.c +10 -25
  458. data/src/core/lib/slice/slice_buffer.c +10 -25
  459. data/src/core/lib/slice/slice_hash_table.c +48 -26
  460. data/src/core/lib/slice/slice_hash_table.h +26 -28
  461. data/src/core/lib/slice/slice_intern.c +10 -25
  462. data/src/core/lib/slice/slice_internal.h +10 -25
  463. data/src/core/lib/slice/slice_string_helpers.c +10 -25
  464. data/src/core/lib/slice/slice_string_helpers.h +10 -25
  465. data/src/core/lib/support/alloc.c +10 -25
  466. data/src/core/lib/support/arena.c +12 -27
  467. data/src/core/lib/support/arena.h +10 -25
  468. data/src/core/lib/support/atm.c +17 -32
  469. data/src/core/lib/support/atomic.h +10 -25
  470. data/src/core/lib/support/atomic_with_atm.h +10 -25
  471. data/src/core/lib/support/atomic_with_std.h +10 -25
  472. data/src/core/lib/support/avl.c +101 -101
  473. data/src/core/lib/support/backoff.c +10 -25
  474. data/src/core/lib/support/backoff.h +10 -25
  475. data/src/core/lib/support/block_annotate.h +10 -25
  476. data/src/core/lib/support/cmdline.c +10 -25
  477. data/src/core/lib/support/cpu_iphone.c +10 -25
  478. data/src/core/lib/support/cpu_linux.c +10 -25
  479. data/src/core/lib/support/cpu_posix.c +10 -25
  480. data/src/core/lib/support/cpu_windows.c +10 -25
  481. data/src/core/lib/support/env.h +16 -25
  482. data/src/core/lib/support/env_linux.c +30 -37
  483. data/src/core/lib/support/env_posix.c +15 -25
  484. data/src/core/lib/support/env_windows.c +15 -25
  485. data/src/core/lib/support/histogram.c +10 -25
  486. data/src/core/lib/support/host_port.c +10 -25
  487. data/src/core/lib/support/log.c +20 -29
  488. data/src/core/lib/support/log_android.c +10 -25
  489. data/src/core/lib/support/log_linux.c +13 -26
  490. data/src/core/lib/support/log_posix.c +10 -25
  491. data/src/core/lib/support/log_windows.c +10 -25
  492. data/src/core/lib/support/memory.h +10 -25
  493. data/src/core/lib/support/mpscq.c +11 -49
  494. data/src/core/lib/support/mpscq.h +11 -50
  495. data/src/core/lib/support/murmur_hash.c +12 -25
  496. data/src/core/lib/support/murmur_hash.h +10 -25
  497. data/src/core/lib/support/spinlock.h +10 -25
  498. data/src/core/lib/support/stack_lockfree.c +10 -25
  499. data/src/core/lib/support/stack_lockfree.h +10 -25
  500. data/src/core/lib/support/string.c +10 -25
  501. data/src/core/lib/support/string.h +10 -25
  502. data/src/core/lib/support/string_posix.c +10 -25
  503. data/src/core/lib/support/string_util_windows.c +10 -25
  504. data/src/core/lib/support/string_windows.c +10 -25
  505. data/src/core/lib/support/string_windows.h +10 -25
  506. data/src/core/lib/support/subprocess_posix.c +10 -25
  507. data/src/core/lib/support/subprocess_windows.c +10 -25
  508. data/src/core/lib/support/sync.c +10 -25
  509. data/src/core/lib/support/sync_posix.c +10 -25
  510. data/src/core/lib/support/sync_windows.c +10 -25
  511. data/src/core/lib/support/thd.c +10 -25
  512. data/src/core/lib/support/thd_internal.h +10 -25
  513. data/src/core/lib/support/thd_posix.c +10 -25
  514. data/src/core/lib/support/thd_windows.c +10 -25
  515. data/src/core/lib/support/time.c +10 -25
  516. data/src/core/lib/support/time_posix.c +10 -25
  517. data/src/core/lib/support/time_precise.c +18 -33
  518. data/src/core/lib/support/time_precise.h +10 -25
  519. data/src/core/lib/support/time_windows.c +10 -25
  520. data/src/core/lib/support/tls_pthread.c +10 -25
  521. data/src/core/lib/support/tmpfile.h +10 -25
  522. data/src/core/lib/support/tmpfile_msys.c +10 -25
  523. data/src/core/lib/support/tmpfile_posix.c +10 -25
  524. data/src/core/lib/support/tmpfile_windows.c +10 -25
  525. data/src/core/lib/support/wrap_memcpy.c +10 -25
  526. data/src/core/lib/surface/alarm.c +78 -35
  527. data/src/core/lib/surface/alarm_internal.h +40 -0
  528. data/src/core/lib/surface/api_trace.c +11 -26
  529. data/src/core/lib/surface/api_trace.h +10 -25
  530. data/src/core/lib/surface/byte_buffer.c +10 -25
  531. data/src/core/lib/surface/byte_buffer_reader.c +10 -25
  532. data/src/core/lib/surface/call.c +64 -84
  533. data/src/core/lib/surface/call.h +11 -26
  534. data/src/core/lib/surface/call_details.c +10 -25
  535. data/src/core/lib/surface/call_log_batch.c +10 -25
  536. data/src/core/lib/surface/call_test_only.h +10 -25
  537. data/src/core/lib/surface/channel.c +11 -26
  538. data/src/core/lib/surface/channel.h +11 -26
  539. data/src/core/lib/surface/channel_init.c +10 -25
  540. data/src/core/lib/surface/channel_init.h +10 -25
  541. data/src/core/lib/surface/channel_ping.c +12 -27
  542. data/src/core/lib/surface/channel_stack_type.c +10 -25
  543. data/src/core/lib/surface/channel_stack_type.h +10 -25
  544. data/src/core/lib/surface/completion_queue.c +442 -331
  545. data/src/core/lib/surface/completion_queue.h +16 -33
  546. data/src/core/lib/surface/completion_queue_factory.c +10 -25
  547. data/src/core/lib/surface/completion_queue_factory.h +10 -25
  548. data/src/core/lib/surface/event_string.c +10 -25
  549. data/src/core/lib/surface/event_string.h +10 -25
  550. data/src/core/lib/surface/init.c +38 -47
  551. data/src/core/lib/surface/init.h +10 -25
  552. data/src/core/lib/surface/init_secure.c +20 -27
  553. data/src/core/lib/surface/lame_client.cc +14 -29
  554. data/src/core/lib/surface/lame_client.h +10 -25
  555. data/src/core/lib/surface/metadata_array.c +10 -25
  556. data/src/core/lib/surface/server.c +128 -81
  557. data/src/core/lib/surface/server.h +10 -25
  558. data/src/core/lib/surface/validate_metadata.c +10 -25
  559. data/src/core/lib/surface/validate_metadata.h +10 -25
  560. data/src/core/lib/surface/version.c +11 -26
  561. data/src/core/lib/transport/bdp_estimator.c +19 -29
  562. data/src/core/lib/transport/bdp_estimator.h +16 -29
  563. data/src/core/lib/transport/byte_stream.c +127 -36
  564. data/src/core/lib/transport/byte_stream.h +88 -46
  565. data/src/core/lib/transport/connectivity_state.c +17 -31
  566. data/src/core/lib/transport/connectivity_state.h +10 -25
  567. data/src/core/lib/transport/error_utils.c +10 -25
  568. data/src/core/lib/transport/error_utils.h +10 -25
  569. data/src/core/lib/transport/http2_errors.h +10 -25
  570. data/src/core/lib/transport/metadata.c +87 -85
  571. data/src/core/lib/transport/metadata.h +15 -28
  572. data/src/core/lib/transport/metadata_batch.c +10 -25
  573. data/src/core/lib/transport/metadata_batch.h +10 -25
  574. data/src/core/lib/transport/pid_controller.c +10 -25
  575. data/src/core/lib/transport/pid_controller.h +10 -25
  576. data/src/core/lib/transport/service_config.c +11 -26
  577. data/src/core/lib/transport/service_config.h +10 -25
  578. data/src/core/lib/transport/static_metadata.c +12 -26
  579. data/src/core/lib/transport/static_metadata.h +10 -25
  580. data/src/core/lib/transport/status_conversion.c +10 -25
  581. data/src/core/lib/transport/status_conversion.h +10 -25
  582. data/src/core/lib/transport/timeout_encoding.c +10 -25
  583. data/src/core/lib/transport/timeout_encoding.h +10 -25
  584. data/src/core/lib/transport/transport.c +60 -53
  585. data/src/core/lib/transport/transport.h +36 -34
  586. data/src/core/lib/transport/transport_impl.h +10 -25
  587. data/src/core/lib/transport/transport_op_string.c +10 -28
  588. data/src/core/plugin_registry/grpc_plugin_registry.c +22 -25
  589. data/src/core/tsi/fake_transport_security.c +199 -94
  590. data/src/core/tsi/fake_transport_security.h +11 -26
  591. data/src/core/tsi/gts_transport_security.c +40 -0
  592. data/src/core/tsi/gts_transport_security.h +37 -0
  593. data/src/core/tsi/ssl_transport_security.c +13 -32
  594. data/src/core/tsi/ssl_transport_security.h +10 -25
  595. data/src/core/tsi/ssl_types.h +10 -25
  596. data/src/core/tsi/transport_security.c +48 -78
  597. data/src/core/tsi/transport_security.h +18 -27
  598. data/src/core/tsi/transport_security_adapter.c +17 -29
  599. data/src/core/tsi/transport_security_adapter.h +10 -25
  600. data/src/core/tsi/transport_security_grpc.c +64 -0
  601. data/src/core/tsi/transport_security_grpc.h +80 -0
  602. data/src/core/tsi/transport_security_interface.h +21 -27
  603. data/src/ruby/bin/apis/google/protobuf/empty.rb +10 -25
  604. data/src/ruby/bin/apis/pubsub_demo.rb +10 -25
  605. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +10 -25
  606. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +10 -25
  607. data/src/ruby/bin/math_client.rb +10 -25
  608. data/src/ruby/bin/math_server.rb +10 -25
  609. data/src/ruby/bin/math_services_pb.rb +10 -25
  610. data/src/ruby/bin/noproto_client.rb +10 -25
  611. data/src/ruby/bin/noproto_server.rb +10 -25
  612. data/src/ruby/ext/grpc/extconf.rb +10 -25
  613. data/src/ruby/ext/grpc/rb_byte_buffer.c +10 -25
  614. data/src/ruby/ext/grpc/rb_byte_buffer.h +10 -25
  615. data/src/ruby/ext/grpc/rb_call.c +44 -25
  616. data/src/ruby/ext/grpc/rb_call.h +10 -25
  617. data/src/ruby/ext/grpc/rb_call_credentials.c +10 -25
  618. data/src/ruby/ext/grpc/rb_call_credentials.h +10 -25
  619. data/src/ruby/ext/grpc/rb_channel.c +10 -25
  620. data/src/ruby/ext/grpc/rb_channel.h +10 -25
  621. data/src/ruby/ext/grpc/rb_channel_args.c +10 -25
  622. data/src/ruby/ext/grpc/rb_channel_args.h +10 -25
  623. data/src/ruby/ext/grpc/rb_channel_credentials.c +10 -25
  624. data/src/ruby/ext/grpc/rb_channel_credentials.h +10 -25
  625. data/src/ruby/ext/grpc/rb_completion_queue.c +10 -25
  626. data/src/ruby/ext/grpc/rb_completion_queue.h +10 -25
  627. data/src/ruby/ext/grpc/rb_compression_options.c +10 -25
  628. data/src/ruby/ext/grpc/rb_compression_options.h +10 -25
  629. data/src/ruby/ext/grpc/rb_event_thread.c +10 -25
  630. data/src/ruby/ext/grpc/rb_event_thread.h +10 -25
  631. data/src/ruby/ext/grpc/rb_grpc.c +10 -25
  632. data/src/ruby/ext/grpc/rb_grpc.h +10 -25
  633. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -25
  634. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +16 -31
  635. data/src/ruby/ext/grpc/rb_loader.c +10 -25
  636. data/src/ruby/ext/grpc/rb_loader.h +10 -25
  637. data/src/ruby/ext/grpc/rb_server.c +10 -25
  638. data/src/ruby/ext/grpc/rb_server.h +10 -25
  639. data/src/ruby/ext/grpc/rb_server_credentials.c +10 -25
  640. data/src/ruby/ext/grpc/rb_server_credentials.h +10 -25
  641. data/src/ruby/lib/grpc.rb +10 -25
  642. data/src/ruby/lib/grpc/core/time_consts.rb +10 -25
  643. data/src/ruby/lib/grpc/errors.rb +16 -30
  644. data/src/ruby/lib/grpc/generic/active_call.rb +25 -27
  645. data/src/ruby/lib/grpc/generic/bidi_call.rb +17 -27
  646. data/src/ruby/lib/grpc/generic/client_stub.rb +10 -25
  647. data/src/ruby/lib/grpc/generic/rpc_desc.rb +10 -25
  648. data/src/ruby/lib/grpc/generic/rpc_server.rb +10 -25
  649. data/src/ruby/lib/grpc/generic/service.rb +10 -25
  650. data/src/ruby/lib/grpc/grpc.rb +10 -25
  651. data/src/ruby/lib/grpc/logconfig.rb +10 -25
  652. data/src/ruby/lib/grpc/notifier.rb +10 -25
  653. data/src/ruby/lib/grpc/version.rb +11 -26
  654. data/src/ruby/pb/generate_proto_ruby.sh +10 -25
  655. data/src/ruby/pb/grpc/health/checker.rb +10 -25
  656. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +10 -25
  657. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +10 -25
  658. data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +10 -25
  659. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +10 -25
  660. data/src/ruby/pb/test/client.rb +10 -25
  661. data/src/ruby/pb/test/server.rb +10 -25
  662. data/src/ruby/spec/call_credentials_spec.rb +10 -25
  663. data/src/ruby/spec/call_spec.rb +43 -25
  664. data/src/ruby/spec/channel_connection_spec.rb +10 -25
  665. data/src/ruby/spec/channel_credentials_spec.rb +11 -26
  666. data/src/ruby/spec/channel_spec.rb +10 -25
  667. data/src/ruby/spec/client_auth_spec.rb +10 -25
  668. data/src/ruby/spec/client_server_spec.rb +66 -25
  669. data/src/ruby/spec/compression_options_spec.rb +10 -25
  670. data/src/ruby/spec/error_sanity_spec.rb +10 -25
  671. data/src/ruby/spec/generic/active_call_spec.rb +10 -25
  672. data/src/ruby/spec/generic/client_stub_spec.rb +146 -35
  673. data/src/ruby/spec/generic/rpc_desc_spec.rb +10 -25
  674. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +10 -25
  675. data/src/ruby/spec/generic/rpc_server_spec.rb +124 -34
  676. data/src/ruby/spec/generic/service_spec.rb +10 -25
  677. data/src/ruby/spec/pb/duplicate/codegen_spec.rb +10 -25
  678. data/src/ruby/spec/pb/health/checker_spec.rb +10 -25
  679. data/src/ruby/spec/server_credentials_spec.rb +10 -25
  680. data/src/ruby/spec/server_spec.rb +10 -25
  681. data/src/ruby/spec/spec_helper.rb +10 -25
  682. data/src/ruby/spec/time_consts_spec.rb +10 -25
  683. data/third_party/boringssl/crypto/aes/key_wrap.c +138 -0
  684. data/third_party/boringssl/crypto/asn1/a_bitstr.c +6 -3
  685. data/third_party/boringssl/crypto/asn1/a_enum.c +4 -1
  686. data/third_party/boringssl/crypto/asn1/a_gentm.c +20 -15
  687. data/third_party/boringssl/crypto/asn1/a_int.c +7 -4
  688. data/third_party/boringssl/crypto/asn1/a_object.c +5 -2
  689. data/third_party/boringssl/crypto/asn1/a_time.c +0 -1
  690. data/third_party/boringssl/crypto/asn1/a_utctm.c +1 -2
  691. data/third_party/boringssl/crypto/asn1/asn1_lib.c +5 -2
  692. data/third_party/boringssl/crypto/asn1/asn1_locl.h +35 -0
  693. data/third_party/boringssl/crypto/asn1/tasn_dec.c +3 -1
  694. data/third_party/boringssl/crypto/asn1/tasn_enc.c +6 -3
  695. data/third_party/boringssl/crypto/asn1/tasn_new.c +12 -7
  696. data/third_party/boringssl/crypto/asn1/tasn_utl.c +22 -8
  697. data/third_party/boringssl/crypto/{time_support.c → asn1/time_support.c} +1 -1
  698. data/third_party/boringssl/crypto/asn1/x_long.c +5 -2
  699. data/third_party/boringssl/crypto/base64/base64.c +7 -5
  700. data/third_party/boringssl/crypto/bio/bio.c +24 -10
  701. data/third_party/boringssl/crypto/bio/bio_mem.c +12 -10
  702. data/third_party/boringssl/crypto/bio/connect.c +7 -18
  703. data/third_party/boringssl/crypto/bio/fd.c +3 -6
  704. data/third_party/boringssl/crypto/bio/file.c +6 -6
  705. data/third_party/boringssl/crypto/bio/hexdump.c +4 -2
  706. data/third_party/boringssl/crypto/bio/pair.c +30 -344
  707. data/third_party/boringssl/crypto/bio/socket.c +6 -7
  708. data/third_party/boringssl/crypto/bio/socket_helper.c +4 -3
  709. data/third_party/boringssl/crypto/bn/add.c +1 -1
  710. data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +11 -10
  711. data/third_party/boringssl/crypto/bn/bn.c +6 -20
  712. data/third_party/boringssl/crypto/bn/cmp.c +14 -0
  713. data/third_party/boringssl/crypto/bn/convert.c +73 -2
  714. data/third_party/boringssl/crypto/bn/ctx.c +3 -1
  715. data/third_party/boringssl/crypto/bn/div.c +108 -51
  716. data/third_party/boringssl/crypto/bn/exponentiation.c +15 -33
  717. data/third_party/boringssl/crypto/bn/gcd.c +29 -22
  718. data/third_party/boringssl/crypto/bn/generic.c +71 -67
  719. data/third_party/boringssl/crypto/bn/internal.h +19 -6
  720. data/third_party/boringssl/crypto/bn/kronecker.c +1 -0
  721. data/third_party/boringssl/crypto/bn/montgomery.c +9 -10
  722. data/third_party/boringssl/crypto/bn/montgomery_inv.c +47 -0
  723. data/third_party/boringssl/crypto/bn/mul.c +11 -9
  724. data/third_party/boringssl/crypto/bn/random.c +6 -3
  725. data/third_party/boringssl/crypto/bn/rsaz_exp.c +0 -65
  726. data/third_party/boringssl/crypto/bn/rsaz_exp.h +0 -3
  727. data/third_party/boringssl/crypto/bn/shift.c +9 -1
  728. data/third_party/boringssl/crypto/bn/sqrt.c +3 -1
  729. data/third_party/boringssl/crypto/buf/buf.c +6 -4
  730. data/third_party/boringssl/crypto/bytestring/asn1_compat.c +2 -1
  731. data/third_party/boringssl/crypto/bytestring/ber.c +2 -1
  732. data/third_party/boringssl/crypto/bytestring/cbb.c +9 -7
  733. data/third_party/boringssl/crypto/bytestring/cbs.c +54 -2
  734. data/third_party/boringssl/crypto/chacha/chacha.c +1 -1
  735. data/third_party/boringssl/crypto/cipher/aead.c +3 -3
  736. data/third_party/boringssl/crypto/cipher/cipher.c +18 -13
  737. data/third_party/boringssl/crypto/cipher/e_aes.c +335 -281
  738. data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +113 -137
  739. data/third_party/boringssl/crypto/cipher/e_null.c +2 -1
  740. data/third_party/boringssl/crypto/cipher/e_rc2.c +54 -49
  741. data/third_party/boringssl/crypto/cipher/e_ssl3.c +4 -3
  742. data/third_party/boringssl/crypto/cipher/e_tls.c +5 -5
  743. data/third_party/boringssl/crypto/cipher/tls_cbc.c +41 -112
  744. data/third_party/boringssl/crypto/cmac/cmac.c +6 -4
  745. data/third_party/boringssl/crypto/conf/conf.c +6 -3
  746. data/third_party/boringssl/crypto/cpu-arm-linux.c +2 -2
  747. data/third_party/boringssl/crypto/curve25519/curve25519.c +28 -34
  748. data/third_party/boringssl/crypto/curve25519/spake25519.c +7 -6
  749. data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +2 -1
  750. data/third_party/boringssl/crypto/des/des.c +1 -1
  751. data/third_party/boringssl/crypto/des/internal.h +58 -46
  752. data/third_party/boringssl/crypto/dh/dh.c +4 -8
  753. data/third_party/boringssl/crypto/digest/digest.c +5 -2
  754. data/third_party/boringssl/crypto/digest/digests.c +70 -33
  755. data/third_party/boringssl/crypto/digest/md32_common.h +39 -27
  756. data/third_party/boringssl/crypto/dsa/dsa.c +11 -19
  757. data/third_party/boringssl/crypto/ec/ec.c +1 -1
  758. data/third_party/boringssl/crypto/ec/ec_asn1.c +3 -2
  759. data/third_party/boringssl/crypto/ec/ec_key.c +1 -1
  760. data/third_party/boringssl/crypto/ec/ec_montgomery.c +6 -11
  761. data/third_party/boringssl/crypto/ec/oct.c +2 -14
  762. data/third_party/boringssl/crypto/ec/p224-64.c +78 -122
  763. data/third_party/boringssl/crypto/ec/p256-64.c +93 -133
  764. data/third_party/boringssl/crypto/ec/p256-x86_64.c +48 -61
  765. data/third_party/boringssl/crypto/ec/p256-x86_64.h +113 -0
  766. data/third_party/boringssl/crypto/ec/simple.c +2 -1
  767. data/third_party/boringssl/crypto/ec/wnaf.c +52 -43
  768. data/third_party/boringssl/crypto/ecdh/ecdh.c +4 -2
  769. data/third_party/boringssl/crypto/ecdsa/ecdsa.c +17 -16
  770. data/third_party/boringssl/crypto/engine/engine.c +3 -1
  771. data/third_party/boringssl/crypto/err/err.c +5 -5
  772. data/third_party/boringssl/crypto/evp/evp.c +1 -1
  773. data/third_party/boringssl/crypto/evp/evp_asn1.c +1 -1
  774. data/third_party/boringssl/crypto/evp/evp_ctx.c +23 -29
  775. data/third_party/boringssl/crypto/evp/p_ec.c +2 -1
  776. data/third_party/boringssl/crypto/evp/p_rsa.c +9 -3
  777. data/third_party/boringssl/crypto/evp/pbkdf.c +3 -1
  778. data/third_party/boringssl/crypto/hkdf/hkdf.c +3 -1
  779. data/third_party/boringssl/crypto/hmac/hmac.c +4 -2
  780. data/third_party/boringssl/crypto/internal.h +81 -0
  781. data/third_party/boringssl/crypto/lhash/lhash.c +7 -13
  782. data/third_party/boringssl/crypto/md4/md4.c +20 -18
  783. data/third_party/boringssl/crypto/md5/md5.c +31 -21
  784. data/third_party/boringssl/crypto/mem.c +4 -10
  785. data/third_party/boringssl/crypto/modes/cbc.c +2 -6
  786. data/third_party/boringssl/crypto/modes/cfb.c +2 -2
  787. data/third_party/boringssl/crypto/modes/ctr.c +1 -1
  788. data/third_party/boringssl/crypto/modes/gcm.c +117 -334
  789. data/third_party/boringssl/crypto/modes/internal.h +107 -84
  790. data/third_party/boringssl/crypto/modes/ofb.c +3 -3
  791. data/third_party/boringssl/crypto/modes/polyval.c +94 -0
  792. data/third_party/boringssl/crypto/obj/obj.c +13 -8
  793. data/third_party/boringssl/crypto/obj/obj_dat.h +6109 -5187
  794. data/third_party/boringssl/crypto/obj/obj_xref.c +55 -57
  795. data/third_party/boringssl/crypto/pem/pem_lib.c +6 -3
  796. data/third_party/boringssl/crypto/pkcs8/internal.h +27 -8
  797. data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +137 -352
  798. data/third_party/boringssl/crypto/pkcs8/pkcs8.c +371 -364
  799. data/third_party/boringssl/crypto/poly1305/poly1305.c +12 -18
  800. data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +2 -2
  801. data/third_party/boringssl/crypto/{newhope/reduce.c → pool/internal.h} +24 -21
  802. data/third_party/boringssl/crypto/pool/pool.c +200 -0
  803. data/third_party/boringssl/crypto/rand/deterministic.c +6 -5
  804. data/third_party/boringssl/crypto/rand/fuchsia.c +43 -0
  805. data/third_party/boringssl/crypto/rand/rand.c +7 -7
  806. data/third_party/boringssl/crypto/rand/urandom.c +136 -22
  807. data/third_party/boringssl/crypto/rand/windows.c +2 -2
  808. data/third_party/boringssl/crypto/rsa/blinding.c +2 -1
  809. data/third_party/boringssl/crypto/rsa/padding.c +11 -11
  810. data/third_party/boringssl/crypto/rsa/rsa.c +4 -4
  811. data/third_party/boringssl/crypto/rsa/rsa_asn1.c +7 -1
  812. data/third_party/boringssl/crypto/rsa/rsa_impl.c +41 -80
  813. data/third_party/boringssl/crypto/sha/sha1-altivec.c +346 -0
  814. data/third_party/boringssl/crypto/sha/sha1.c +60 -42
  815. data/third_party/boringssl/crypto/sha/sha256.c +4 -2
  816. data/third_party/boringssl/crypto/sha/sha512.c +9 -7
  817. data/third_party/boringssl/crypto/stack/stack.c +10 -7
  818. data/third_party/boringssl/crypto/thread_pthread.c +2 -2
  819. data/third_party/boringssl/crypto/thread_win.c +2 -2
  820. data/third_party/boringssl/crypto/x509/a_verify.c +1 -1
  821. data/third_party/boringssl/crypto/x509/asn1_gen.c +1 -1
  822. data/third_party/boringssl/crypto/x509/by_dir.c +1 -1
  823. data/third_party/boringssl/crypto/x509/t_x509.c +78 -38
  824. data/third_party/boringssl/crypto/x509/x509_cmp.c +8 -5
  825. data/third_party/boringssl/crypto/x509/x509_lu.c +6 -1
  826. data/third_party/boringssl/crypto/x509/x509_obj.c +4 -1
  827. data/third_party/boringssl/crypto/x509/x509_vfy.c +42 -8
  828. data/third_party/boringssl/crypto/x509/x509_vpm.c +8 -6
  829. data/third_party/boringssl/crypto/x509/x509name.c +4 -1
  830. data/third_party/boringssl/crypto/x509/x_crl.c +4 -2
  831. data/third_party/boringssl/crypto/x509/x_name.c +23 -13
  832. data/third_party/boringssl/crypto/x509/x_pkey.c +4 -1
  833. data/third_party/boringssl/crypto/x509/x_x509.c +42 -3
  834. data/third_party/boringssl/crypto/x509v3/pcy_int.h +2 -2
  835. data/third_party/boringssl/crypto/x509v3/pcy_tree.c +2 -1
  836. data/third_party/boringssl/crypto/x509v3/v3_cpols.c +1 -1
  837. data/third_party/boringssl/crypto/x509v3/v3_ia5.c +4 -1
  838. data/third_party/boringssl/crypto/x509v3/v3_ncons.c +4 -1
  839. data/third_party/boringssl/crypto/x509v3/v3_pci.c +6 -3
  840. data/third_party/boringssl/crypto/x509v3/v3_purp.c +13 -21
  841. data/third_party/boringssl/crypto/x509v3/v3_utl.c +19 -33
  842. data/third_party/boringssl/include/openssl/aead.h +9 -20
  843. data/third_party/boringssl/include/openssl/aes.h +21 -9
  844. data/third_party/boringssl/include/openssl/asn1.h +9 -1
  845. data/third_party/boringssl/include/openssl/base.h +33 -6
  846. data/third_party/boringssl/include/openssl/bio.h +10 -103
  847. data/third_party/boringssl/include/openssl/bn.h +58 -42
  848. data/third_party/boringssl/include/openssl/bytestring.h +17 -0
  849. data/third_party/boringssl/include/openssl/cipher.h +4 -3
  850. data/third_party/boringssl/include/openssl/conf.h +4 -1
  851. data/third_party/boringssl/include/openssl/curve25519.h +13 -0
  852. data/third_party/boringssl/include/openssl/digest.h +5 -3
  853. data/third_party/boringssl/include/openssl/dsa.h +5 -5
  854. data/third_party/boringssl/include/openssl/ec.h +2 -2
  855. data/third_party/boringssl/include/openssl/ecdh.h +3 -4
  856. data/third_party/boringssl/include/openssl/ecdsa.h +10 -10
  857. data/third_party/boringssl/include/openssl/err.h +5 -5
  858. data/third_party/boringssl/include/openssl/evp.h +11 -7
  859. data/third_party/boringssl/include/openssl/lhash.h +2 -3
  860. data/third_party/boringssl/include/openssl/lhash_macros.h +56 -14
  861. data/third_party/boringssl/include/openssl/nid.h +2949 -2916
  862. data/third_party/boringssl/include/openssl/obj.h +1 -1
  863. data/third_party/boringssl/include/openssl/pkcs8.h +21 -42
  864. data/third_party/boringssl/include/openssl/pool.h +87 -0
  865. data/third_party/boringssl/include/openssl/rand.h +1 -1
  866. data/third_party/boringssl/include/openssl/rsa.h +4 -2
  867. data/third_party/boringssl/include/openssl/sha.h +0 -4
  868. data/third_party/boringssl/include/openssl/ssl.h +327 -662
  869. data/third_party/boringssl/include/openssl/ssl3.h +1 -21
  870. data/third_party/boringssl/include/openssl/stack.h +1 -0
  871. data/third_party/boringssl/include/openssl/stack_macros.h +85 -0
  872. data/third_party/boringssl/include/openssl/tls1.h +23 -52
  873. data/third_party/boringssl/include/openssl/type_check.h +4 -0
  874. data/third_party/boringssl/include/openssl/x509.h +10 -59
  875. data/third_party/boringssl/include/openssl/x509_vfy.h +7 -1
  876. data/third_party/boringssl/include/openssl/x509v3.h +4 -4
  877. data/third_party/boringssl/ssl/bio_ssl.c +175 -0
  878. data/third_party/boringssl/ssl/custom_extensions.c +24 -21
  879. data/third_party/boringssl/ssl/d1_both.c +259 -289
  880. data/third_party/boringssl/ssl/d1_lib.c +8 -20
  881. data/third_party/boringssl/ssl/d1_pkt.c +6 -15
  882. data/third_party/boringssl/ssl/dtls_method.c +22 -8
  883. data/third_party/boringssl/ssl/dtls_record.c +27 -2
  884. data/third_party/boringssl/ssl/handshake_client.c +460 -579
  885. data/third_party/boringssl/ssl/handshake_server.c +662 -644
  886. data/third_party/boringssl/ssl/internal.h +1009 -375
  887. data/third_party/boringssl/ssl/s3_both.c +312 -162
  888. data/third_party/boringssl/ssl/s3_lib.c +12 -128
  889. data/third_party/boringssl/ssl/s3_pkt.c +22 -30
  890. data/third_party/boringssl/ssl/ssl_aead_ctx.c +28 -22
  891. data/third_party/boringssl/ssl/ssl_asn1.c +210 -114
  892. data/third_party/boringssl/ssl/ssl_buffer.c +2 -1
  893. data/third_party/boringssl/ssl/ssl_cert.c +417 -219
  894. data/third_party/boringssl/ssl/ssl_cipher.c +191 -393
  895. data/third_party/boringssl/ssl/ssl_ecdh.c +19 -164
  896. data/third_party/boringssl/ssl/ssl_file.c +0 -11
  897. data/third_party/boringssl/ssl/ssl_lib.c +325 -652
  898. data/third_party/boringssl/ssl/{ssl_rsa.c → ssl_privkey.c} +21 -131
  899. data/third_party/boringssl/ssl/ssl_privkey_cc.cc +76 -0
  900. data/third_party/boringssl/ssl/ssl_session.c +206 -95
  901. data/third_party/boringssl/ssl/ssl_stat.c +18 -84
  902. data/third_party/boringssl/ssl/{s3_enc.c → ssl_transcript.c} +150 -157
  903. data/third_party/boringssl/ssl/ssl_x509.c +815 -0
  904. data/third_party/boringssl/ssl/t1_enc.c +188 -174
  905. data/third_party/boringssl/ssl/t1_lib.c +1064 -764
  906. data/third_party/boringssl/ssl/tls13_both.c +290 -96
  907. data/third_party/boringssl/ssl/tls13_client.c +344 -314
  908. data/third_party/boringssl/ssl/tls13_enc.c +239 -200
  909. data/third_party/boringssl/ssl/tls13_server.c +374 -366
  910. data/third_party/boringssl/ssl/tls_method.c +40 -5
  911. data/third_party/boringssl/ssl/tls_record.c +166 -71
  912. metadata +39 -25
  913. data/src/core/lib/iomgr/workqueue.h +0 -87
  914. data/src/core/lib/iomgr/workqueue_uv.c +0 -65
  915. data/src/core/lib/iomgr/workqueue_uv.h +0 -37
  916. data/src/core/lib/iomgr/workqueue_windows.c +0 -63
  917. data/src/core/lib/iomgr/workqueue_windows.h +0 -37
  918. data/third_party/boringssl/crypto/bio/buffer.c +0 -496
  919. data/third_party/boringssl/crypto/newhope/error_correction.c +0 -131
  920. data/third_party/boringssl/crypto/newhope/internal.h +0 -71
  921. data/third_party/boringssl/crypto/newhope/newhope.c +0 -174
  922. data/third_party/boringssl/crypto/newhope/ntt.c +0 -148
  923. data/third_party/boringssl/crypto/newhope/poly.c +0 -183
  924. data/third_party/boringssl/crypto/newhope/precomp.c +0 -306
  925. data/third_party/boringssl/crypto/obj/obj_xref.h +0 -96
  926. data/third_party/boringssl/crypto/pkcs8/p5_pbe.c +0 -151
  927. data/third_party/boringssl/include/openssl/newhope.h +0 -158
  928. data/third_party/boringssl/include/openssl/time_support.h +0 -91
@@ -1,33 +1,18 @@
1
1
  /*
2
2
  *
3
- * Copyright 2016, Google Inc.
4
- * All rights reserved.
3
+ * Copyright 2016 gRPC authors.
5
4
  *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are
8
- * met:
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
9
8
  *
10
- * * Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- * * Redistributions in binary form must reproduce the above
13
- * copyright notice, this list of conditions and the following disclaimer
14
- * in the documentation and/or other materials provided with the
15
- * distribution.
16
- * * Neither the name of Google Inc. nor the names of its
17
- * contributors may be used to endorse or promote products derived from
18
- * this software without specific prior written permission.
9
+ * http://www.apache.org/licenses/LICENSE-2.0
19
10
  *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
31
16
  *
32
17
  */
33
18
 
@@ -1,33 +1,18 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
4
- * All rights reserved.
3
+ * Copyright 2015 gRPC authors.
5
4
  *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are
8
- * met:
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
9
8
  *
10
- * * Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- * * Redistributions in binary form must reproduce the above
13
- * copyright notice, this list of conditions and the following disclaimer
14
- * in the documentation and/or other materials provided with the
15
- * distribution.
16
- * * Neither the name of Google Inc. nor the names of its
17
- * contributors may be used to endorse or promote products derived from
18
- * this software without specific prior written permission.
9
+ * http://www.apache.org/licenses/LICENSE-2.0
19
10
  *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
31
16
  *
32
17
  */
33
18
 
@@ -1,33 +1,18 @@
1
1
  /*
2
2
  *
3
- * Copyright 2016, Google Inc.
4
- * All rights reserved.
3
+ * Copyright 2016 gRPC authors.
5
4
  *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are
8
- * met:
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
9
8
  *
10
- * * Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- * * Redistributions in binary form must reproduce the above
13
- * copyright notice, this list of conditions and the following disclaimer
14
- * in the documentation and/or other materials provided with the
15
- * distribution.
16
- * * Neither the name of Google Inc. nor the names of its
17
- * contributors may be used to endorse or promote products derived from
18
- * this software without specific prior written permission.
9
+ * http://www.apache.org/licenses/LICENSE-2.0
19
10
  *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
31
16
  *
32
17
  */
33
18
 
@@ -133,6 +118,7 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx) {
133
118
  switch (input_tail) {
134
119
  case 3:
135
120
  ctx->output_cur[1] = COMPOSE_OUTPUT_BYTE_1(ctx->input_cur);
121
+ /* fallthrough */
136
122
  case 2:
137
123
  ctx->output_cur[0] = COMPOSE_OUTPUT_BYTE_0(ctx->input_cur);
138
124
  }
@@ -1,33 +1,18 @@
1
1
  /*
2
2
  *
3
- * Copyright 2016, Google Inc.
4
- * All rights reserved.
3
+ * Copyright 2016 gRPC authors.
5
4
  *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are
8
- * met:
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
9
8
  *
10
- * * Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- * * Redistributions in binary form must reproduce the above
13
- * copyright notice, this list of conditions and the following disclaimer
14
- * in the documentation and/or other materials provided with the
15
- * distribution.
16
- * * Neither the name of Google Inc. nor the names of its
17
- * contributors may be used to endorse or promote products derived from
18
- * this software without specific prior written permission.
9
+ * http://www.apache.org/licenses/LICENSE-2.0
19
10
  *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
31
16
  *
32
17
  */
33
18
 
@@ -1,33 +1,18 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
4
- * All rights reserved.
3
+ * Copyright 2015 gRPC authors.
5
4
  *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are
8
- * met:
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
9
8
  *
10
- * * Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- * * Redistributions in binary form must reproduce the above
13
- * copyright notice, this list of conditions and the following disclaimer
14
- * in the documentation and/or other materials provided with the
15
- * distribution.
16
- * * Neither the name of Google Inc. nor the names of its
17
- * contributors may be used to endorse or promote products derived from
18
- * this software without specific prior written permission.
9
+ * http://www.apache.org/licenses/LICENSE-2.0
19
10
  *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
31
16
  *
32
17
  */
33
18
 
@@ -1,33 +1,18 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
4
- * All rights reserved.
3
+ * Copyright 2015 gRPC authors.
5
4
  *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are
8
- * met:
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
9
8
  *
10
- * * Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- * * Redistributions in binary form must reproduce the above
13
- * copyright notice, this list of conditions and the following disclaimer
14
- * in the documentation and/or other materials provided with the
15
- * distribution.
16
- * * Neither the name of Google Inc. nor the names of its
17
- * contributors may be used to endorse or promote products derived from
18
- * this software without specific prior written permission.
9
+ * http://www.apache.org/licenses/LICENSE-2.0
19
10
  *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
31
16
  *
32
17
  */
33
18
 
@@ -1,33 +1,18 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
4
- * All rights reserved.
3
+ * Copyright 2015 gRPC authors.
5
4
  *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are
8
- * met:
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
9
8
  *
10
- * * Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- * * Redistributions in binary form must reproduce the above
13
- * copyright notice, this list of conditions and the following disclaimer
14
- * in the documentation and/or other materials provided with the
15
- * distribution.
16
- * * Neither the name of Google Inc. nor the names of its
17
- * contributors may be used to endorse or promote products derived from
18
- * this software without specific prior written permission.
9
+ * http://www.apache.org/licenses/LICENSE-2.0
19
10
  *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
31
16
  *
32
17
  */
33
18
 
@@ -36,8 +21,11 @@
36
21
  #include "src/core/lib/transport/metadata.h"
37
22
 
38
23
  void grpc_chttp2_plugin_init(void) {
39
- grpc_register_tracer("http", &grpc_http_trace);
40
- grpc_register_tracer("flowctl", &grpc_flowctl_trace);
24
+ grpc_register_tracer(&grpc_http_trace);
25
+ grpc_register_tracer(&grpc_flowctl_trace);
26
+ #ifndef NDEBUG
27
+ grpc_register_tracer(&grpc_trace_chttp2_refcount);
28
+ #endif
41
29
  }
42
30
 
43
31
  void grpc_chttp2_plugin_shutdown(void) {}
@@ -1,33 +1,18 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
4
- * All rights reserved.
3
+ * Copyright 2015 gRPC authors.
5
4
  *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are
8
- * met:
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
9
8
  *
10
- * * Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- * * Redistributions in binary form must reproduce the above
13
- * copyright notice, this list of conditions and the following disclaimer
14
- * in the documentation and/or other materials provided with the
15
- * distribution.
16
- * * Neither the name of Google Inc. nor the names of its
17
- * contributors may be used to endorse or promote products derived from
18
- * this software without specific prior written permission.
9
+ * http://www.apache.org/licenses/LICENSE-2.0
19
10
  *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
31
16
  *
32
17
  */
33
18
 
@@ -48,9 +33,10 @@
48
33
  #include "src/core/ext/transport/chttp2/transport/internal.h"
49
34
  #include "src/core/ext/transport/chttp2/transport/varint.h"
50
35
  #include "src/core/lib/channel/channel_args.h"
36
+ #include "src/core/lib/compression/stream_compression.h"
51
37
  #include "src/core/lib/http/parser.h"
38
+ #include "src/core/lib/iomgr/executor.h"
52
39
  #include "src/core/lib/iomgr/timer.h"
53
- #include "src/core/lib/iomgr/workqueue.h"
54
40
  #include "src/core/lib/profiling/timers.h"
55
41
  #include "src/core/lib/slice/slice_internal.h"
56
42
  #include "src/core/lib/slice/slice_string_helpers.h"
@@ -68,7 +54,7 @@
68
54
  #define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024)
69
55
  #define MAX_WINDOW 0x7fffffffu
70
56
  #define MAX_WRITE_BUFFER_SIZE (64 * 1024 * 1024)
71
- #define DEFAULT_MAX_HEADER_LIST_SIZE (16 * 1024)
57
+ #define DEFAULT_MAX_HEADER_LIST_SIZE (8 * 1024)
72
58
 
73
59
  #define DEFAULT_CLIENT_KEEPALIVE_TIME_MS INT_MAX
74
60
  #define DEFAULT_CLIENT_KEEPALIVE_TIMEOUT_MS 20000 /* 20 seconds */
@@ -89,8 +75,13 @@ static bool g_default_keepalive_permit_without_calls =
89
75
  DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS;
90
76
 
91
77
  #define MAX_CLIENT_STREAM_ID 0x7fffffffu
92
- grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false);
93
- grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false);
78
+ grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false, "http");
79
+ grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false, "flowctl");
80
+
81
+ #ifndef NDEBUG
82
+ grpc_tracer_flag grpc_trace_chttp2_refcount =
83
+ GRPC_TRACER_INITIALIZER(false, "chttp2_refcount");
84
+ #endif
94
85
 
95
86
  static const grpc_transport_vtable vtable;
96
87
 
@@ -107,8 +98,9 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *t,
107
98
  static void complete_fetch_locked(grpc_exec_ctx *exec_ctx, void *gs,
108
99
  grpc_error *error);
109
100
  /** Set a transport level setting, and push it to our peer */
110
- static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
111
- grpc_chttp2_setting_id id, uint32_t value);
101
+ static void queue_setting_update(grpc_exec_ctx *exec_ctx,
102
+ grpc_chttp2_transport *t,
103
+ grpc_chttp2_setting_id id, uint32_t value);
112
104
 
113
105
  static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
114
106
  grpc_chttp2_stream *s, grpc_error *error);
@@ -122,11 +114,6 @@ static void connectivity_state_set(grpc_exec_ctx *exec_ctx,
122
114
  grpc_connectivity_state state,
123
115
  grpc_error *error, const char *reason);
124
116
 
125
- static void incoming_byte_stream_update_flow_control(grpc_exec_ctx *exec_ctx,
126
- grpc_chttp2_transport *t,
127
- grpc_chttp2_stream *s,
128
- size_t max_size_hint,
129
- size_t have_already);
130
117
  static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx,
131
118
  void *byte_stream,
132
119
  grpc_error *error_ignored);
@@ -228,20 +215,26 @@ static void destruct_transport(grpc_exec_ctx *exec_ctx,
228
215
  gpr_free(t);
229
216
  }
230
217
 
231
- #ifdef GRPC_CHTTP2_REFCOUNTING_DEBUG
218
+ #ifndef NDEBUG
232
219
  void grpc_chttp2_unref_transport(grpc_exec_ctx *exec_ctx,
233
220
  grpc_chttp2_transport *t, const char *reason,
234
221
  const char *file, int line) {
235
- gpr_log(GPR_DEBUG, "chttp2:unref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", t,
236
- t->refs.count, t->refs.count - 1, reason, file, line);
222
+ if (GRPC_TRACER_ON(grpc_trace_chttp2_refcount)) {
223
+ gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count);
224
+ gpr_log(GPR_DEBUG, "chttp2:unref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]",
225
+ t, val, val - 1, reason, file, line);
226
+ }
237
227
  if (!gpr_unref(&t->refs)) return;
238
228
  destruct_transport(exec_ctx, t);
239
229
  }
240
230
 
241
231
  void grpc_chttp2_ref_transport(grpc_chttp2_transport *t, const char *reason,
242
232
  const char *file, int line) {
243
- gpr_log(GPR_DEBUG, "chttp2: ref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", t,
244
- t->refs.count, t->refs.count + 1, reason, file, line);
233
+ if (GRPC_TRACER_ON(grpc_trace_chttp2_refcount)) {
234
+ gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count);
235
+ gpr_log(GPR_DEBUG, "chttp2: ref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]",
236
+ t, val, val + 1, reason, file, line);
237
+ }
245
238
  gpr_ref(&t->refs);
246
239
  }
247
240
  #else
@@ -267,13 +260,14 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
267
260
  t->ep = ep;
268
261
  /* one ref is for destroy */
269
262
  gpr_ref_init(&t->refs, 1);
270
- t->combiner = grpc_combiner_create(grpc_endpoint_get_workqueue(ep));
263
+ t->combiner = grpc_combiner_create();
271
264
  t->peer_string = grpc_endpoint_get_peer(ep);
272
265
  t->endpoint_reading = 1;
273
266
  t->next_stream_id = is_client ? 1 : 2;
274
267
  t->is_client = is_client;
275
- t->outgoing_window = DEFAULT_WINDOW;
276
- t->incoming_window = DEFAULT_WINDOW;
268
+ t->flow_control.remote_window = DEFAULT_WINDOW;
269
+ t->flow_control.announced_window = DEFAULT_WINDOW;
270
+ t->flow_control.t = t;
277
271
  t->deframe_state = is_client ? GRPC_DTS_FH_0 : GRPC_DTS_CLIENT_PREFIX_0;
278
272
  t->is_first_frame = true;
279
273
  grpc_connectivity_state_init(
@@ -285,37 +279,35 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
285
279
  grpc_slice_buffer_init(&t->outbuf);
286
280
  grpc_chttp2_hpack_compressor_init(&t->hpack_compressor);
287
281
 
288
- grpc_closure_init(&t->write_action, write_action, t,
289
- grpc_schedule_on_exec_ctx);
290
- grpc_closure_init(&t->read_action_locked, read_action_locked, t,
291
- grpc_combiner_scheduler(t->combiner, false));
292
- grpc_closure_init(&t->benign_reclaimer_locked, benign_reclaimer_locked, t,
293
- grpc_combiner_scheduler(t->combiner, false));
294
- grpc_closure_init(&t->destructive_reclaimer_locked,
282
+ GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t,
283
+ grpc_combiner_scheduler(t->combiner));
284
+ GRPC_CLOSURE_INIT(&t->benign_reclaimer_locked, benign_reclaimer_locked, t,
285
+ grpc_combiner_scheduler(t->combiner));
286
+ GRPC_CLOSURE_INIT(&t->destructive_reclaimer_locked,
295
287
  destructive_reclaimer_locked, t,
296
- grpc_combiner_scheduler(t->combiner, false));
297
- grpc_closure_init(&t->retry_initiate_ping_locked, retry_initiate_ping_locked,
298
- t, grpc_combiner_scheduler(t->combiner, false));
299
- grpc_closure_init(&t->start_bdp_ping_locked, start_bdp_ping_locked, t,
300
- grpc_combiner_scheduler(t->combiner, false));
301
- grpc_closure_init(&t->finish_bdp_ping_locked, finish_bdp_ping_locked, t,
302
- grpc_combiner_scheduler(t->combiner, false));
303
- grpc_closure_init(&t->init_keepalive_ping_locked, init_keepalive_ping_locked,
304
- t, grpc_combiner_scheduler(t->combiner, false));
305
- grpc_closure_init(&t->start_keepalive_ping_locked,
288
+ grpc_combiner_scheduler(t->combiner));
289
+ GRPC_CLOSURE_INIT(&t->retry_initiate_ping_locked, retry_initiate_ping_locked,
290
+ t, grpc_combiner_scheduler(t->combiner));
291
+ GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked, start_bdp_ping_locked, t,
292
+ grpc_combiner_scheduler(t->combiner));
293
+ GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked, finish_bdp_ping_locked, t,
294
+ grpc_combiner_scheduler(t->combiner));
295
+ GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping_locked,
296
+ t, grpc_combiner_scheduler(t->combiner));
297
+ GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
306
298
  start_keepalive_ping_locked, t,
307
- grpc_combiner_scheduler(t->combiner, false));
308
- grpc_closure_init(&t->finish_keepalive_ping_locked,
299
+ grpc_combiner_scheduler(t->combiner));
300
+ GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
309
301
  finish_keepalive_ping_locked, t,
310
- grpc_combiner_scheduler(t->combiner, false));
311
- grpc_closure_init(&t->keepalive_watchdog_fired_locked,
302
+ grpc_combiner_scheduler(t->combiner));
303
+ GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked,
312
304
  keepalive_watchdog_fired_locked, t,
313
- grpc_combiner_scheduler(t->combiner, false));
305
+ grpc_combiner_scheduler(t->combiner));
314
306
 
315
- grpc_bdp_estimator_init(&t->bdp_estimator, t->peer_string);
316
- t->last_pid_update = gpr_now(GPR_CLOCK_MONOTONIC);
307
+ grpc_bdp_estimator_init(&t->flow_control.bdp_estimator, t->peer_string);
308
+ t->flow_control.last_pid_update = gpr_now(GPR_CLOCK_MONOTONIC);
317
309
  grpc_pid_controller_init(
318
- &t->pid_controller,
310
+ &t->flow_control.pid_controller,
319
311
  (grpc_pid_controller_args){.gain_p = 4,
320
312
  .gain_i = 8,
321
313
  .gain_d = 0,
@@ -348,25 +340,26 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
348
340
  t->force_send_settings = 1 << GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
349
341
  t->sent_local_settings = 0;
350
342
  t->write_buffer_size = DEFAULT_WINDOW;
351
- t->enable_bdp_probe = true;
343
+ t->flow_control.enable_bdp_probe = true;
352
344
 
353
345
  if (is_client) {
354
346
  grpc_slice_buffer_add(&t->outbuf, grpc_slice_from_copied_string(
355
347
  GRPC_CHTTP2_CLIENT_CONNECT_STRING));
356
- grpc_chttp2_initiate_write(exec_ctx, t, false, "initial_write");
348
+ grpc_chttp2_initiate_write(exec_ctx, t, "initial_write");
357
349
  }
358
350
 
359
351
  /* configure http2 the way we like it */
360
352
  if (is_client) {
361
- push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0);
362
- push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0);
353
+ queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0);
354
+ queue_setting_update(exec_ctx, t,
355
+ GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0);
363
356
  }
364
- push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
365
- DEFAULT_WINDOW);
366
- push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE,
367
- DEFAULT_MAX_HEADER_LIST_SIZE);
368
- push_setting(exec_ctx, t,
369
- GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, 1);
357
+ queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
358
+ DEFAULT_WINDOW);
359
+ queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE,
360
+ DEFAULT_MAX_HEADER_LIST_SIZE);
361
+ queue_setting_update(exec_ctx, t,
362
+ GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, 1);
370
363
 
371
364
  t->ping_policy = (grpc_chttp2_repeated_ping_policy){
372
365
  .max_pings_without_data = DEFAULT_MAX_PINGS_BETWEEN_DATA,
@@ -403,6 +396,8 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
403
396
  }
404
397
  t->keepalive_permit_without_calls = g_default_keepalive_permit_without_calls;
405
398
 
399
+ t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY;
400
+
406
401
  if (channel_args) {
407
402
  for (i = 0; i < channel_args->num_args; i++) {
408
403
  if (0 == strcmp(channel_args->args[i].key,
@@ -462,7 +457,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
462
457
  (grpc_integer_options){0, 0, MAX_WRITE_BUFFER_SIZE});
463
458
  } else if (0 ==
464
459
  strcmp(channel_args->args[i].key, GRPC_ARG_HTTP2_BDP_PROBE)) {
465
- t->enable_bdp_probe = grpc_channel_arg_get_integer(
460
+ t->flow_control.enable_bdp_probe = grpc_channel_arg_get_integer(
466
461
  &channel_args->args[i], (grpc_integer_options){1, 0, 1});
467
462
  } else if (0 == strcmp(channel_args->args[i].key,
468
463
  GRPC_ARG_KEEPALIVE_TIME_MS)) {
@@ -491,6 +486,23 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
491
486
  t->keepalive_permit_without_calls =
492
487
  (uint32_t)grpc_channel_arg_get_integer(
493
488
  &channel_args->args[i], (grpc_integer_options){0, 0, 1});
489
+ } else if (0 == strcmp(channel_args->args[i].key,
490
+ GRPC_ARG_OPTIMIZATION_TARGET)) {
491
+ if (channel_args->args[i].type != GRPC_ARG_STRING) {
492
+ gpr_log(GPR_ERROR, "%s should be a string",
493
+ GRPC_ARG_OPTIMIZATION_TARGET);
494
+ } else if (0 == strcmp(channel_args->args[i].value.string, "blend")) {
495
+ t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY;
496
+ } else if (0 == strcmp(channel_args->args[i].value.string, "latency")) {
497
+ t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY;
498
+ } else if (0 ==
499
+ strcmp(channel_args->args[i].value.string, "throughput")) {
500
+ t->opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_THROUGHPUT;
501
+ } else {
502
+ gpr_log(GPR_ERROR, "%s value '%s' unknown, assuming 'blend'",
503
+ GRPC_ARG_OPTIMIZATION_TARGET,
504
+ channel_args->args[i].value.string);
505
+ }
494
506
  } else {
495
507
  static const struct {
496
508
  const char *channel_arg_name;
@@ -533,8 +545,8 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
533
545
  int value = grpc_channel_arg_get_integer(
534
546
  &channel_args->args[i], settings_map[j].integer_options);
535
547
  if (value >= 0) {
536
- push_setting(exec_ctx, t, settings_map[j].setting_id,
537
- (uint32_t)value);
548
+ queue_setting_update(exec_ctx, t, settings_map[j].setting_id,
549
+ (uint32_t)value);
538
550
  }
539
551
  }
540
552
  break;
@@ -544,6 +556,11 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
544
556
  }
545
557
  }
546
558
 
559
+ GRPC_CLOSURE_INIT(&t->write_action, write_action, t,
560
+ t->opt_target == GRPC_CHTTP2_OPTIMIZE_FOR_THROUGHPUT
561
+ ? grpc_executor_scheduler
562
+ : grpc_schedule_on_exec_ctx);
563
+
547
564
  t->ping_state.pings_before_data_required =
548
565
  t->ping_policy.max_pings_without_data;
549
566
  t->ping_state.is_delayed_ping_timer_set = false;
@@ -565,7 +582,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
565
582
  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED;
566
583
  }
567
584
 
568
- grpc_chttp2_initiate_write(exec_ctx, t, false, "init");
585
+ grpc_chttp2_initiate_write(exec_ctx, t, "init");
569
586
  post_benign_reclaimer(exec_ctx, t);
570
587
  }
571
588
 
@@ -583,9 +600,9 @@ static void destroy_transport_locked(grpc_exec_ctx *exec_ctx, void *tp,
583
600
 
584
601
  static void destroy_transport(grpc_exec_ctx *exec_ctx, grpc_transport *gt) {
585
602
  grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt;
586
- grpc_closure_sched(exec_ctx, grpc_closure_create(
587
- destroy_transport_locked, t,
588
- grpc_combiner_scheduler(t->combiner, false)),
603
+ GRPC_CLOSURE_SCHED(exec_ctx,
604
+ GRPC_CLOSURE_CREATE(destroy_transport_locked, t,
605
+ grpc_combiner_scheduler(t->combiner)),
589
606
  GRPC_ERROR_NONE);
590
607
  }
591
608
 
@@ -636,7 +653,7 @@ static void close_transport_locked(grpc_exec_ctx *exec_ctx,
636
653
  GRPC_ERROR_UNREF(error);
637
654
  }
638
655
 
639
- #ifdef GRPC_STREAM_REFCOUNT_DEBUG
656
+ #ifndef NDEBUG
640
657
  void grpc_chttp2_stream_ref(grpc_chttp2_stream *s, const char *reason) {
641
658
  grpc_stream_ref(s->refcount, reason);
642
659
  }
@@ -672,13 +689,13 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt,
672
689
  grpc_chttp2_data_parser_init(&s->data_parser);
673
690
  grpc_slice_buffer_init(&s->flow_controlled_buffer);
674
691
  s->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
675
- grpc_closure_init(&s->complete_fetch_locked, complete_fetch_locked, s,
692
+ GRPC_CLOSURE_INIT(&s->complete_fetch_locked, complete_fetch_locked, s,
676
693
  grpc_schedule_on_exec_ctx);
677
694
  grpc_slice_buffer_init(&s->unprocessed_incoming_frames_buffer);
678
695
  grpc_slice_buffer_init(&s->frame_storage);
679
696
  s->pending_byte_stream = false;
680
- grpc_closure_init(&s->reset_byte_stream, reset_byte_stream, s,
681
- grpc_combiner_scheduler(t->combiner, false));
697
+ GRPC_CLOSURE_INIT(&s->reset_byte_stream, reset_byte_stream, s,
698
+ grpc_combiner_scheduler(t->combiner));
682
699
 
683
700
  GRPC_CHTTP2_REF_TRANSPORT(t, "stream");
684
701
 
@@ -689,6 +706,7 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt,
689
706
  post_destructive_reclaimer(exec_ctx, t);
690
707
  }
691
708
 
709
+ s->flow_control.s = s;
692
710
  GPR_TIMER_END("init_stream", 0);
693
711
 
694
712
  return 0;
@@ -709,6 +727,14 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp,
709
727
  grpc_slice_buffer_destroy_internal(exec_ctx,
710
728
  &s->unprocessed_incoming_frames_buffer);
711
729
  grpc_slice_buffer_destroy_internal(exec_ctx, &s->frame_storage);
730
+ if (s->compressed_data_buffer) {
731
+ grpc_slice_buffer_destroy_internal(exec_ctx, s->compressed_data_buffer);
732
+ gpr_free(s->compressed_data_buffer);
733
+ }
734
+ if (s->decompressed_data_buffer) {
735
+ grpc_slice_buffer_destroy_internal(exec_ctx, s->decompressed_data_buffer);
736
+ gpr_free(s->decompressed_data_buffer);
737
+ }
712
738
 
713
739
  grpc_chttp2_list_remove_stalled_by_transport(t, s);
714
740
  grpc_chttp2_list_remove_stalled_by_stream(t, s);
@@ -737,19 +763,13 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp,
737
763
  GRPC_ERROR_UNREF(s->write_closed_error);
738
764
  GRPC_ERROR_UNREF(s->byte_stream_error);
739
765
 
740
- if (s->incoming_window_delta > 0) {
741
- GRPC_CHTTP2_FLOW_DEBIT_STREAM_INCOMING_WINDOW_DELTA(
742
- "destroy", t, s, s->incoming_window_delta);
743
- } else if (s->incoming_window_delta < 0) {
744
- GRPC_CHTTP2_FLOW_CREDIT_STREAM_INCOMING_WINDOW_DELTA(
745
- "destroy", t, s, -s->incoming_window_delta);
746
- }
766
+ grpc_chttp2_flowctl_destroy_stream(&t->flow_control, &s->flow_control);
747
767
 
748
768
  GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "stream");
749
769
 
750
770
  GPR_TIMER_END("destroy_stream", 0);
751
771
 
752
- grpc_closure_sched(exec_ctx, s->destroy_stream_arg, GRPC_ERROR_NONE);
772
+ GRPC_CLOSURE_SCHED(exec_ctx, s->destroy_stream_arg, GRPC_ERROR_NONE);
753
773
  }
754
774
 
755
775
  static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt,
@@ -759,10 +779,19 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt,
759
779
  grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt;
760
780
  grpc_chttp2_stream *s = (grpc_chttp2_stream *)gs;
761
781
 
782
+ if (s->stream_compression_ctx != NULL) {
783
+ grpc_stream_compression_context_destroy(s->stream_compression_ctx);
784
+ s->stream_compression_ctx = NULL;
785
+ }
786
+ if (s->stream_decompression_ctx != NULL) {
787
+ grpc_stream_compression_context_destroy(s->stream_decompression_ctx);
788
+ s->stream_decompression_ctx = NULL;
789
+ }
790
+
762
791
  s->destroy_stream_arg = then_schedule_closure;
763
- grpc_closure_sched(
764
- exec_ctx, grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s,
765
- grpc_combiner_scheduler(t->combiner, false)),
792
+ GRPC_CLOSURE_SCHED(
793
+ exec_ctx, GRPC_CLOSURE_INIT(&s->destroy_stream, destroy_stream_locked, s,
794
+ grpc_combiner_scheduler(t->combiner)),
766
795
  GRPC_ERROR_NONE);
767
796
  GPR_TIMER_END("destroy_stream", 0);
768
797
  }
@@ -800,8 +829,6 @@ static const char *write_state_name(grpc_chttp2_write_state st) {
800
829
  return "WRITING";
801
830
  case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE:
802
831
  return "WRITING+MORE";
803
- case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE_AND_COVERED_BY_POLLER:
804
- return "WRITING+MORE+COVERED";
805
832
  }
806
833
  GPR_UNREACHABLE_CODE(return "UNKNOWN");
807
834
  }
@@ -814,7 +841,7 @@ static void set_write_state(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
814
841
  write_state_name(st), reason));
815
842
  t->write_state = st;
816
843
  if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
817
- grpc_closure_list_sched(exec_ctx, &t->run_after_write);
844
+ GRPC_CLOSURE_LIST_SCHED(exec_ctx, &t->run_after_write);
818
845
  if (t->close_transport_on_writes_finished != NULL) {
819
846
  grpc_error *err = t->close_transport_on_writes_finished;
820
847
  t->close_transport_on_writes_finished = NULL;
@@ -824,38 +851,25 @@ static void set_write_state(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
824
851
  }
825
852
 
826
853
  void grpc_chttp2_initiate_write(grpc_exec_ctx *exec_ctx,
827
- grpc_chttp2_transport *t,
828
- bool covered_by_poller, const char *reason) {
854
+ grpc_chttp2_transport *t, const char *reason) {
829
855
  GPR_TIMER_BEGIN("grpc_chttp2_initiate_write", 0);
830
856
 
831
857
  switch (t->write_state) {
832
858
  case GRPC_CHTTP2_WRITE_STATE_IDLE:
833
859
  set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING, reason);
834
860
  GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
835
- grpc_closure_sched(
861
+ GRPC_CLOSURE_SCHED(
836
862
  exec_ctx,
837
- grpc_closure_init(
838
- &t->write_action_begin_locked, write_action_begin_locked, t,
839
- grpc_combiner_finally_scheduler(t->combiner, covered_by_poller)),
863
+ GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
864
+ write_action_begin_locked, t,
865
+ grpc_combiner_finally_scheduler(t->combiner)),
840
866
  GRPC_ERROR_NONE);
841
867
  break;
842
868
  case GRPC_CHTTP2_WRITE_STATE_WRITING:
843
- set_write_state(
844
- exec_ctx, t,
845
- covered_by_poller
846
- ? GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE_AND_COVERED_BY_POLLER
847
- : GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE,
848
- reason);
869
+ set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE,
870
+ reason);
849
871
  break;
850
872
  case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE:
851
- if (covered_by_poller) {
852
- set_write_state(
853
- exec_ctx, t,
854
- GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE_AND_COVERED_BY_POLLER,
855
- reason);
856
- }
857
- break;
858
- case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE_AND_COVERED_BY_POLLER:
859
873
  break;
860
874
  }
861
875
  GPR_TIMER_END("grpc_chttp2_initiate_write", 0);
@@ -871,10 +885,10 @@ void grpc_chttp2_become_writable(
871
885
  case GRPC_CHTTP2_STREAM_WRITE_PIGGYBACK:
872
886
  break;
873
887
  case GRPC_CHTTP2_STREAM_WRITE_INITIATE_COVERED:
874
- grpc_chttp2_initiate_write(exec_ctx, t, true, reason);
888
+ grpc_chttp2_initiate_write(exec_ctx, t, reason);
875
889
  break;
876
890
  case GRPC_CHTTP2_STREAM_WRITE_INITIATE_UNCOVERED:
877
- grpc_chttp2_initiate_write(exec_ctx, t, false, reason);
891
+ grpc_chttp2_initiate_write(exec_ctx, t, reason);
878
892
  break;
879
893
  }
880
894
  }
@@ -894,12 +908,12 @@ static void write_action_begin_locked(grpc_exec_ctx *exec_ctx, void *gt,
894
908
  case GRPC_CHTTP2_PARTIAL_WRITE:
895
909
  set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE,
896
910
  "begin writing partial");
897
- grpc_closure_sched(exec_ctx, &t->write_action, GRPC_ERROR_NONE);
911
+ GRPC_CLOSURE_SCHED(exec_ctx, &t->write_action, GRPC_ERROR_NONE);
898
912
  break;
899
913
  case GRPC_CHTTP2_FULL_WRITE:
900
914
  set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING,
901
915
  "begin writing");
902
- grpc_closure_sched(exec_ctx, &t->write_action, GRPC_ERROR_NONE);
916
+ GRPC_CLOSURE_SCHED(exec_ctx, &t->write_action, GRPC_ERROR_NONE);
903
917
  break;
904
918
  }
905
919
  GPR_TIMER_END("write_action_begin_locked", 0);
@@ -910,8 +924,8 @@ static void write_action(grpc_exec_ctx *exec_ctx, void *gt, grpc_error *error) {
910
924
  GPR_TIMER_BEGIN("write_action", 0);
911
925
  grpc_endpoint_write(
912
926
  exec_ctx, t->ep, &t->outbuf,
913
- grpc_closure_init(&t->write_action_end_locked, write_action_end_locked, t,
914
- grpc_combiner_scheduler(t->combiner, false)));
927
+ GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end_locked, t,
928
+ grpc_combiner_scheduler(t->combiner)));
915
929
  GPR_TIMER_END("write_action", 0);
916
930
  }
917
931
 
@@ -945,23 +959,11 @@ static void write_action_end_locked(grpc_exec_ctx *exec_ctx, void *tp,
945
959
  set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING,
946
960
  "continue writing [!covered]");
947
961
  GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
948
- grpc_closure_run(
949
- exec_ctx,
950
- grpc_closure_init(
951
- &t->write_action_begin_locked, write_action_begin_locked, t,
952
- grpc_combiner_finally_scheduler(t->combiner, false)),
953
- GRPC_ERROR_NONE);
954
- break;
955
- case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE_AND_COVERED_BY_POLLER:
956
- GPR_TIMER_MARK("state=writing_stale_with_poller", 0);
957
- set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING,
958
- "continue writing [covered]");
959
- GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
960
- grpc_closure_run(
962
+ GRPC_CLOSURE_RUN(
961
963
  exec_ctx,
962
- grpc_closure_init(&t->write_action_begin_locked,
964
+ GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
963
965
  write_action_begin_locked, t,
964
- grpc_combiner_finally_scheduler(t->combiner, true)),
966
+ grpc_combiner_finally_scheduler(t->combiner)),
965
967
  GRPC_ERROR_NONE);
966
968
  break;
967
969
  }
@@ -972,8 +974,11 @@ static void write_action_end_locked(grpc_exec_ctx *exec_ctx, void *tp,
972
974
  GPR_TIMER_END("terminate_writing_with_lock", 0);
973
975
  }
974
976
 
975
- static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
976
- grpc_chttp2_setting_id id, uint32_t value) {
977
+ // Dirties an HTTP2 setting to be sent out next time a writing path occurs.
978
+ // If the change needs to occur immediately, manually initiate a write.
979
+ static void queue_setting_update(grpc_exec_ctx *exec_ctx,
980
+ grpc_chttp2_transport *t,
981
+ grpc_chttp2_setting_id id, uint32_t value) {
977
982
  const grpc_chttp2_setting_parameters *sp =
978
983
  &grpc_chttp2_settings_parameters[id];
979
984
  uint32_t use_value = GPR_CLAMP(value, sp->min_value, sp->max_value);
@@ -984,7 +989,6 @@ static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
984
989
  if (use_value != t->settings[GRPC_LOCAL_SETTINGS][id]) {
985
990
  t->settings[GRPC_LOCAL_SETTINGS][id] = use_value;
986
991
  t->dirtied_local_settings = 1;
987
- grpc_chttp2_initiate_write(exec_ctx, t, false, "push_setting");
988
992
  }
989
993
  }
990
994
 
@@ -1089,7 +1093,7 @@ static void null_then_run_closure(grpc_exec_ctx *exec_ctx,
1089
1093
  grpc_closure **closure, grpc_error *error) {
1090
1094
  grpc_closure *c = *closure;
1091
1095
  *closure = NULL;
1092
- grpc_closure_run(exec_ctx, c, error);
1096
+ GRPC_CLOSURE_RUN(exec_ctx, c, error);
1093
1097
  }
1094
1098
 
1095
1099
  void grpc_chttp2_complete_closure_step(grpc_exec_ctx *exec_ctx,
@@ -1131,7 +1135,7 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx *exec_ctx,
1131
1135
  }
1132
1136
  if ((t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE) ||
1133
1137
  !(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) {
1134
- grpc_closure_run(exec_ctx, closure, closure->error_data.error);
1138
+ GRPC_CLOSURE_RUN(exec_ctx, closure, closure->error_data.error);
1135
1139
  } else {
1136
1140
  grpc_closure_list_append(&t->run_after_write, closure,
1137
1141
  closure->error_data.error);
@@ -1177,6 +1181,7 @@ static void continue_fetching_send_locked(grpc_exec_ctx *exec_ctx,
1177
1181
  return; /* early out */
1178
1182
  }
1179
1183
  if (s->fetched_send_message_length == s->fetching_send_message->length) {
1184
+ grpc_byte_stream_destroy(exec_ctx, s->fetching_send_message);
1180
1185
  int64_t notify_offset = s->next_message_end_offset;
1181
1186
  if (notify_offset <= s->flow_controlled_bytes_written) {
1182
1187
  grpc_chttp2_complete_closure_step(
@@ -1199,9 +1204,14 @@ static void continue_fetching_send_locked(grpc_exec_ctx *exec_ctx,
1199
1204
  return; /* early out */
1200
1205
  } else if (grpc_byte_stream_next(exec_ctx, s->fetching_send_message,
1201
1206
  UINT32_MAX, &s->complete_fetch_locked)) {
1202
- grpc_byte_stream_pull(exec_ctx, s->fetching_send_message,
1203
- &s->fetching_slice);
1204
- add_fetched_slice_locked(exec_ctx, t, s);
1207
+ grpc_error *error = grpc_byte_stream_pull(
1208
+ exec_ctx, s->fetching_send_message, &s->fetching_slice);
1209
+ if (error != GRPC_ERROR_NONE) {
1210
+ grpc_byte_stream_destroy(exec_ctx, s->fetching_send_message);
1211
+ grpc_chttp2_cancel_stream(exec_ctx, t, s, error);
1212
+ } else {
1213
+ add_fetched_slice_locked(exec_ctx, t, s);
1214
+ }
1205
1215
  }
1206
1216
  }
1207
1217
  }
@@ -1218,10 +1228,9 @@ static void complete_fetch_locked(grpc_exec_ctx *exec_ctx, void *gs,
1218
1228
  continue_fetching_send_locked(exec_ctx, t, s);
1219
1229
  }
1220
1230
  }
1221
-
1222
1231
  if (error != GRPC_ERROR_NONE) {
1223
- /* TODO(ctiller): what to do here */
1224
- abort();
1232
+ grpc_byte_stream_destroy(exec_ctx, s->fetching_send_message);
1233
+ grpc_chttp2_cancel_stream(exec_ctx, t, s, error);
1225
1234
  }
1226
1235
  }
1227
1236
 
@@ -1229,7 +1238,7 @@ static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {}
1229
1238
 
1230
1239
  static void log_metadata(const grpc_metadata_batch *md_batch, uint32_t id,
1231
1240
  bool is_client, bool is_initial) {
1232
- for (grpc_linked_mdelem *md = md_batch->list.head; md != md_batch->list.tail;
1241
+ for (grpc_linked_mdelem *md = md_batch->list.head; md != NULL;
1233
1242
  md = md->next) {
1234
1243
  char *key = grpc_slice_to_c_string(GRPC_MDKEY(md->md));
1235
1244
  char *value = grpc_slice_to_c_string(GRPC_MDVALUE(md->md));
@@ -1267,7 +1276,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
1267
1276
  grpc_closure *on_complete = op->on_complete;
1268
1277
  if (on_complete == NULL) {
1269
1278
  on_complete =
1270
- grpc_closure_create(do_nothing, NULL, grpc_schedule_on_exec_ctx);
1279
+ GRPC_CLOSURE_CREATE(do_nothing, NULL, grpc_schedule_on_exec_ctx);
1271
1280
  }
1272
1281
 
1273
1282
  /* use final_data as a barrier until enqueue time; the inital counter is
@@ -1366,8 +1375,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
1366
1375
  "fetching_send_message_finished");
1367
1376
  } else {
1368
1377
  GPR_ASSERT(s->fetching_send_message == NULL);
1369
- uint8_t *frame_hdr =
1370
- grpc_slice_buffer_tiny_add(&s->flow_controlled_buffer, 5);
1378
+ uint8_t *frame_hdr = grpc_slice_buffer_tiny_add(
1379
+ &s->flow_controlled_buffer, GRPC_HEADER_SIZE_IN_BYTES);
1371
1380
  uint32_t flags = op_payload->send_message.send_message->flags;
1372
1381
  frame_hdr[0] = (flags & GRPC_WRITE_INTERNAL_COMPRESS) != 0;
1373
1382
  size_t len = op_payload->send_message.send_message->length;
@@ -1380,7 +1389,6 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
1380
1389
  s->next_message_end_offset = s->flow_controlled_bytes_written +
1381
1390
  (int64_t)s->flow_controlled_buffer.length +
1382
1391
  (int64_t)len;
1383
- s->complete_fetch_covered_by_poller = op->covered_by_poller;
1384
1392
  if (flags & GRPC_WRITE_BUFFER_HINT) {
1385
1393
  s->next_message_end_offset -= t->write_buffer_size;
1386
1394
  s->write_buffering = true;
@@ -1447,6 +1455,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
1447
1455
  op_payload->recv_initial_metadata.recv_initial_metadata_ready;
1448
1456
  s->recv_initial_metadata =
1449
1457
  op_payload->recv_initial_metadata.recv_initial_metadata;
1458
+ s->trailing_metadata_available =
1459
+ op_payload->recv_initial_metadata.trailing_metadata_available;
1450
1460
  grpc_chttp2_maybe_complete_recv_initial_metadata(exec_ctx, t, s);
1451
1461
  }
1452
1462
 
@@ -1457,14 +1467,16 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
1457
1467
  s->recv_message_ready = op_payload->recv_message.recv_message_ready;
1458
1468
  s->recv_message = op_payload->recv_message.recv_message;
1459
1469
  if (s->id != 0) {
1460
- if (s->pending_byte_stream) {
1470
+ if (!s->read_closed) {
1461
1471
  already_received = s->frame_storage.length;
1462
- } else {
1463
- already_received = s->frame_storage.length +
1464
- s->unprocessed_incoming_frames_buffer.length;
1472
+ grpc_chttp2_flowctl_incoming_bs_update(
1473
+ &t->flow_control, &s->flow_control, GRPC_HEADER_SIZE_IN_BYTES,
1474
+ already_received);
1475
+ grpc_chttp2_act_on_flowctl_action(
1476
+ exec_ctx,
1477
+ grpc_chttp2_flowctl_get_action(&t->flow_control, &s->flow_control),
1478
+ t, s);
1465
1479
  }
1466
- incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5,
1467
- already_received);
1468
1480
  }
1469
1481
  grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s);
1470
1482
  }
@@ -1492,6 +1504,21 @@ static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt,
1492
1504
  grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt;
1493
1505
  grpc_chttp2_stream *s = (grpc_chttp2_stream *)gs;
1494
1506
 
1507
+ if (!t->is_client) {
1508
+ if (op->send_initial_metadata) {
1509
+ gpr_timespec deadline =
1510
+ op->payload->send_initial_metadata.send_initial_metadata->deadline;
1511
+ GPR_ASSERT(0 ==
1512
+ gpr_time_cmp(gpr_inf_future(deadline.clock_type), deadline));
1513
+ }
1514
+ if (op->send_trailing_metadata) {
1515
+ gpr_timespec deadline =
1516
+ op->payload->send_trailing_metadata.send_trailing_metadata->deadline;
1517
+ GPR_ASSERT(0 ==
1518
+ gpr_time_cmp(gpr_inf_future(deadline.clock_type), deadline));
1519
+ }
1520
+ }
1521
+
1495
1522
  if (GRPC_TRACER_ON(grpc_http_trace)) {
1496
1523
  char *str = grpc_transport_stream_op_batch_string(op);
1497
1524
  gpr_log(GPR_DEBUG, "perform_stream_op[s=%p]: %s", s, str);
@@ -1500,11 +1527,10 @@ static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt,
1500
1527
 
1501
1528
  op->handler_private.extra_arg = gs;
1502
1529
  GRPC_CHTTP2_STREAM_REF(s, "perform_stream_op");
1503
- grpc_closure_sched(
1530
+ GRPC_CLOSURE_SCHED(
1504
1531
  exec_ctx,
1505
- grpc_closure_init(
1506
- &op->handler_private.closure, perform_stream_op_locked, op,
1507
- grpc_combiner_scheduler(t->combiner, op->covered_by_poller)),
1532
+ GRPC_CLOSURE_INIT(&op->handler_private.closure, perform_stream_op_locked,
1533
+ op, grpc_combiner_scheduler(t->combiner)),
1508
1534
  GRPC_ERROR_NONE);
1509
1535
  GPR_TIMER_END("perform_stream_op", 0);
1510
1536
  }
@@ -1517,7 +1543,7 @@ static void cancel_pings(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
1517
1543
  grpc_chttp2_ping_queue *pq = &t->ping_queues[i];
1518
1544
  for (size_t j = 0; j < GRPC_CHTTP2_PCL_COUNT; j++) {
1519
1545
  grpc_closure_list_fail_all(&pq->lists[j], GRPC_ERROR_REF(error));
1520
- grpc_closure_list_sched(exec_ctx, &pq->lists[j]);
1546
+ GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pq->lists[j]);
1521
1547
  }
1522
1548
  }
1523
1549
  GRPC_ERROR_UNREF(error);
@@ -1531,7 +1557,7 @@ static void send_ping_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
1531
1557
  GRPC_ERROR_NONE);
1532
1558
  if (grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_NEXT], on_ack,
1533
1559
  GRPC_ERROR_NONE)) {
1534
- grpc_chttp2_initiate_write(exec_ctx, t, false, "send_ping");
1560
+ grpc_chttp2_initiate_write(exec_ctx, t, "send_ping");
1535
1561
  }
1536
1562
  }
1537
1563
 
@@ -1539,7 +1565,7 @@ static void retry_initiate_ping_locked(grpc_exec_ctx *exec_ctx, void *tp,
1539
1565
  grpc_error *error) {
1540
1566
  grpc_chttp2_transport *t = tp;
1541
1567
  t->ping_state.is_delayed_ping_timer_set = false;
1542
- grpc_chttp2_initiate_write(exec_ctx, t, false, "retry_send_ping");
1568
+ grpc_chttp2_initiate_write(exec_ctx, t, "retry_send_ping");
1543
1569
  }
1544
1570
 
1545
1571
  void grpc_chttp2_ack_ping(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
@@ -1552,9 +1578,9 @@ void grpc_chttp2_ack_ping(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
1552
1578
  gpr_free(from);
1553
1579
  return;
1554
1580
  }
1555
- grpc_closure_list_sched(exec_ctx, &pq->lists[GRPC_CHTTP2_PCL_INFLIGHT]);
1581
+ GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pq->lists[GRPC_CHTTP2_PCL_INFLIGHT]);
1556
1582
  if (!grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_NEXT])) {
1557
- grpc_chttp2_initiate_write(exec_ctx, t, false, "continue_pings");
1583
+ grpc_chttp2_initiate_write(exec_ctx, t, "continue_pings");
1558
1584
  }
1559
1585
  }
1560
1586
 
@@ -1567,7 +1593,7 @@ static void send_goaway(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
1567
1593
  &slice, &http_error);
1568
1594
  grpc_chttp2_goaway_append(t->last_new_stream_id, (uint32_t)http_error,
1569
1595
  grpc_slice_ref_internal(slice), &t->qbuf);
1570
- grpc_chttp2_initiate_write(exec_ctx, t, false, "goaway_sent");
1596
+ grpc_chttp2_initiate_write(exec_ctx, t, "goaway_sent");
1571
1597
  GRPC_ERROR_UNREF(error);
1572
1598
  }
1573
1599
 
@@ -1593,12 +1619,6 @@ static void perform_transport_op_locked(grpc_exec_ctx *exec_ctx,
1593
1619
  grpc_chttp2_transport *t = op->handler_private.extra_arg;
1594
1620
  grpc_error *close_transport = op->disconnect_with_error;
1595
1621
 
1596
- if (op->on_connectivity_state_change != NULL) {
1597
- grpc_connectivity_state_notify_on_state_change(
1598
- exec_ctx, &t->channel_callback.state_tracker, op->connectivity_state,
1599
- op->on_connectivity_state_change);
1600
- }
1601
-
1602
1622
  if (op->goaway_error) {
1603
1623
  send_goaway(exec_ctx, t, op->goaway_error);
1604
1624
  }
@@ -1622,11 +1642,17 @@ static void perform_transport_op_locked(grpc_exec_ctx *exec_ctx,
1622
1642
  op->send_ping);
1623
1643
  }
1624
1644
 
1645
+ if (op->on_connectivity_state_change != NULL) {
1646
+ grpc_connectivity_state_notify_on_state_change(
1647
+ exec_ctx, &t->channel_callback.state_tracker, op->connectivity_state,
1648
+ op->on_connectivity_state_change);
1649
+ }
1650
+
1625
1651
  if (close_transport != GRPC_ERROR_NONE) {
1626
1652
  close_transport_locked(exec_ctx, t, close_transport);
1627
1653
  }
1628
1654
 
1629
- grpc_closure_run(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
1655
+ GRPC_CLOSURE_RUN(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
1630
1656
 
1631
1657
  GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "transport_op");
1632
1658
  }
@@ -1638,11 +1664,11 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt,
1638
1664
  gpr_free(msg);
1639
1665
  op->handler_private.extra_arg = gt;
1640
1666
  GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op");
1641
- grpc_closure_sched(
1642
- exec_ctx, grpc_closure_init(&op->handler_private.closure,
1643
- perform_transport_op_locked, op,
1644
- grpc_combiner_scheduler(t->combiner, false)),
1645
- GRPC_ERROR_NONE);
1667
+ GRPC_CLOSURE_SCHED(exec_ctx,
1668
+ GRPC_CLOSURE_INIT(&op->handler_private.closure,
1669
+ perform_transport_op_locked, op,
1670
+ grpc_combiner_scheduler(t->combiner)),
1671
+ GRPC_ERROR_NONE);
1646
1672
  }
1647
1673
 
1648
1674
  /*******************************************************************************
@@ -1687,10 +1713,43 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx,
1687
1713
  if (s->unprocessed_incoming_frames_buffer.length == 0) {
1688
1714
  grpc_slice_buffer_swap(&s->unprocessed_incoming_frames_buffer,
1689
1715
  &s->frame_storage);
1716
+ s->unprocessed_incoming_frames_decompressed = false;
1717
+ }
1718
+ if (s->stream_compression_recv_enabled &&
1719
+ !s->unprocessed_incoming_frames_decompressed) {
1720
+ GPR_ASSERT(s->decompressed_data_buffer->length == 0);
1721
+ bool end_of_context;
1722
+ if (!s->stream_decompression_ctx) {
1723
+ s->stream_decompression_ctx =
1724
+ grpc_stream_compression_context_create(
1725
+ GRPC_STREAM_COMPRESSION_DECOMPRESS);
1726
+ }
1727
+ if (!grpc_stream_decompress(s->stream_decompression_ctx,
1728
+ &s->unprocessed_incoming_frames_buffer,
1729
+ s->decompressed_data_buffer, NULL,
1730
+ GRPC_HEADER_SIZE_IN_BYTES,
1731
+ &end_of_context)) {
1732
+ grpc_slice_buffer_reset_and_unref_internal(exec_ctx,
1733
+ &s->frame_storage);
1734
+ grpc_slice_buffer_reset_and_unref_internal(
1735
+ exec_ctx, &s->unprocessed_incoming_frames_buffer);
1736
+ error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1737
+ "Stream decompression error.");
1738
+ } else {
1739
+ error = grpc_deframe_unprocessed_incoming_frames(
1740
+ exec_ctx, &s->data_parser, s, s->decompressed_data_buffer, NULL,
1741
+ s->recv_message);
1742
+ if (end_of_context) {
1743
+ grpc_stream_compression_context_destroy(
1744
+ s->stream_decompression_ctx);
1745
+ s->stream_decompression_ctx = NULL;
1746
+ }
1747
+ }
1748
+ } else {
1749
+ error = grpc_deframe_unprocessed_incoming_frames(
1750
+ exec_ctx, &s->data_parser, s,
1751
+ &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message);
1690
1752
  }
1691
- error = grpc_deframe_unprocessed_incoming_frames(
1692
- exec_ctx, &s->data_parser, s,
1693
- &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message);
1694
1753
  if (error != GRPC_ERROR_NONE) {
1695
1754
  s->seen_error = true;
1696
1755
  grpc_slice_buffer_reset_and_unref_internal(exec_ctx,
@@ -1728,6 +1787,34 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx,
1728
1787
  }
1729
1788
  bool pending_data = s->pending_byte_stream ||
1730
1789
  s->unprocessed_incoming_frames_buffer.length > 0;
1790
+ if (s->stream_compression_recv_enabled && s->read_closed &&
1791
+ s->frame_storage.length > 0 && !pending_data && !s->seen_error &&
1792
+ s->recv_trailing_metadata_finished != NULL) {
1793
+ /* Maybe some SYNC_FLUSH data is left in frame_storage. Consume them and
1794
+ * maybe decompress the next 5 bytes in the stream. */
1795
+ bool end_of_context;
1796
+ if (!s->stream_decompression_ctx) {
1797
+ s->stream_decompression_ctx = grpc_stream_compression_context_create(
1798
+ GRPC_STREAM_COMPRESSION_DECOMPRESS);
1799
+ }
1800
+ if (!grpc_stream_decompress(s->stream_decompression_ctx,
1801
+ &s->frame_storage,
1802
+ &s->unprocessed_incoming_frames_buffer, NULL,
1803
+ GRPC_HEADER_SIZE_IN_BYTES, &end_of_context)) {
1804
+ grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage);
1805
+ grpc_slice_buffer_reset_and_unref_internal(
1806
+ exec_ctx, &s->unprocessed_incoming_frames_buffer);
1807
+ s->seen_error = true;
1808
+ } else {
1809
+ if (s->unprocessed_incoming_frames_buffer.length > 0) {
1810
+ s->unprocessed_incoming_frames_decompressed = true;
1811
+ }
1812
+ if (end_of_context) {
1813
+ grpc_stream_compression_context_destroy(s->stream_decompression_ctx);
1814
+ s->stream_decompression_ctx = NULL;
1815
+ }
1816
+ }
1817
+ }
1731
1818
  if (s->read_closed && s->frame_storage.length == 0 &&
1732
1819
  (!pending_data || s->seen_error) &&
1733
1820
  s->recv_trailing_metadata_finished != NULL) {
@@ -1797,7 +1884,7 @@ void grpc_chttp2_cancel_stream(grpc_exec_ctx *exec_ctx,
1797
1884
  grpc_slice_buffer_add(
1798
1885
  &t->qbuf, grpc_chttp2_rst_stream_create(s->id, (uint32_t)http_error,
1799
1886
  &s->stats.outgoing));
1800
- grpc_chttp2_initiate_write(exec_ctx, t, false, "rst_stream");
1887
+ grpc_chttp2_initiate_write(exec_ctx, t, "rst_stream");
1801
1888
  }
1802
1889
  }
1803
1890
  if (due_to_error != GRPC_ERROR_NONE && !s->seen_error) {
@@ -2110,7 +2197,7 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
2110
2197
  &s->stats.outgoing));
2111
2198
 
2112
2199
  grpc_chttp2_mark_stream_closed(exec_ctx, t, s, 1, 1, error);
2113
- grpc_chttp2_initiate_write(exec_ctx, t, false, "close_from_api");
2200
+ grpc_chttp2_initiate_write(exec_ctx, t, "close_from_api");
2114
2201
  }
2115
2202
 
2116
2203
  typedef struct {
@@ -2137,43 +2224,56 @@ static void end_all_the_calls(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
2137
2224
  * INPUT PROCESSING - PARSING
2138
2225
  */
2139
2226
 
2140
- static void update_bdp(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
2141
- double bdp_dbl) {
2142
- // initial window size bounded [1,2^31-1], but we set the min to 128.
2143
- int32_t bdp = GPR_CLAMP((int32_t)bdp_dbl, 128, INT32_MAX);
2144
- int64_t delta =
2145
- (int64_t)bdp -
2146
- (int64_t)t->settings[GRPC_LOCAL_SETTINGS]
2147
- [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE];
2148
- if (delta == 0 || (delta > -bdp / 10 && delta < bdp / 10)) {
2149
- return;
2227
+ void grpc_chttp2_act_on_flowctl_action(grpc_exec_ctx *exec_ctx,
2228
+ grpc_chttp2_flowctl_action action,
2229
+ grpc_chttp2_transport *t,
2230
+ grpc_chttp2_stream *s) {
2231
+ switch (action.send_stream_update) {
2232
+ case GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED:
2233
+ break;
2234
+ case GRPC_CHTTP2_FLOWCTL_UPDATE_IMMEDIATELY:
2235
+ grpc_chttp2_become_writable(exec_ctx, t, s,
2236
+ GRPC_CHTTP2_STREAM_WRITE_INITIATE_COVERED,
2237
+ "immediate stream flowctl");
2238
+ break;
2239
+ case GRPC_CHTTP2_FLOWCTL_QUEUE_UPDATE:
2240
+ grpc_chttp2_become_writable(exec_ctx, t, s,
2241
+ GRPC_CHTTP2_STREAM_WRITE_PIGGYBACK,
2242
+ "queue stream flowctl");
2243
+ break;
2150
2244
  }
2151
- if (GRPC_TRACER_ON(grpc_bdp_estimator_trace)) {
2152
- gpr_log(GPR_DEBUG, "%s: update initial window size to %d", t->peer_string,
2153
- (int)bdp);
2245
+ switch (action.send_transport_update) {
2246
+ case GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED:
2247
+ break;
2248
+ case GRPC_CHTTP2_FLOWCTL_UPDATE_IMMEDIATELY:
2249
+ grpc_chttp2_initiate_write(exec_ctx, t, "immediate transport flowctl");
2250
+ break;
2251
+ // this is the same as no action b/c every time the transport enters the
2252
+ // writing path it will maybe do an update
2253
+ case GRPC_CHTTP2_FLOWCTL_QUEUE_UPDATE:
2254
+ break;
2154
2255
  }
2155
- push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
2156
- (uint32_t)bdp);
2157
- }
2158
-
2159
- static void update_frame(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
2160
- double bw_dbl, double bdp_dbl) {
2161
- int32_t bdp = GPR_CLAMP((int32_t)bdp_dbl, 128, INT32_MAX);
2162
- int32_t target = GPR_MAX((int32_t)bw_dbl / 1000, bdp);
2163
- // frame size is bounded [2^14,2^24-1]
2164
- int32_t frame_size = GPR_CLAMP(target, 16384, 16777215);
2165
- int64_t delta = (int64_t)frame_size -
2166
- (int64_t)t->settings[GRPC_LOCAL_SETTINGS]
2167
- [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE];
2168
- if (delta == 0 || (delta > -frame_size / 10 && delta < frame_size / 10)) {
2169
- return;
2256
+ if (action.send_setting_update != GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED) {
2257
+ if (action.initial_window_size > 0) {
2258
+ queue_setting_update(exec_ctx, t,
2259
+ GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
2260
+ (uint32_t)action.initial_window_size);
2261
+ }
2262
+ if (action.max_frame_size > 0) {
2263
+ queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE,
2264
+ (uint32_t)action.max_frame_size);
2265
+ }
2266
+ if (action.send_setting_update == GRPC_CHTTP2_FLOWCTL_UPDATE_IMMEDIATELY) {
2267
+ grpc_chttp2_initiate_write(exec_ctx, t, "immediate setting update");
2268
+ }
2170
2269
  }
2171
- if (GRPC_TRACER_ON(grpc_bdp_estimator_trace)) {
2172
- gpr_log(GPR_DEBUG, "%s: update max_frame size to %d", t->peer_string,
2173
- (int)frame_size);
2270
+ if (action.need_ping) {
2271
+ GRPC_CHTTP2_REF_TRANSPORT(t, "bdp_ping");
2272
+ grpc_bdp_estimator_schedule_ping(&t->flow_control.bdp_estimator);
2273
+ send_ping_locked(exec_ctx, t,
2274
+ GRPC_CHTTP2_PING_BEFORE_TRANSPORT_WINDOW_UPDATE,
2275
+ &t->start_bdp_ping_locked, &t->finish_bdp_ping_locked);
2174
2276
  }
2175
- push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE,
2176
- (uint32_t)frame_size);
2177
2277
  }
2178
2278
 
2179
2279
  static grpc_error *try_http_parsing(grpc_exec_ctx *exec_ctx,
@@ -2211,7 +2311,6 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
2211
2311
  GPR_TIMER_BEGIN("reading_action_locked", 0);
2212
2312
 
2213
2313
  grpc_chttp2_transport *t = tp;
2214
- bool need_bdp_ping = false;
2215
2314
 
2216
2315
  GRPC_ERROR_REF(error);
2217
2316
 
@@ -2230,11 +2329,9 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
2230
2329
  grpc_error *errors[3] = {GRPC_ERROR_REF(error), GRPC_ERROR_NONE,
2231
2330
  GRPC_ERROR_NONE};
2232
2331
  for (; i < t->read_buffer.count && errors[1] == GRPC_ERROR_NONE; i++) {
2233
- if (grpc_bdp_estimator_add_incoming_bytes(
2234
- &t->bdp_estimator,
2235
- (int64_t)GRPC_SLICE_LENGTH(t->read_buffer.slices[i]))) {
2236
- need_bdp_ping = true;
2237
- }
2332
+ grpc_bdp_estimator_add_incoming_bytes(
2333
+ &t->flow_control.bdp_estimator,
2334
+ (int64_t)GRPC_SLICE_LENGTH(t->read_buffer.slices[i]));
2238
2335
  errors[1] =
2239
2336
  grpc_chttp2_perform_read(exec_ctx, t, t->read_buffer.slices[i]);
2240
2337
  }
@@ -2250,8 +2347,8 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
2250
2347
  GPR_TIMER_END("reading_action.parse", 0);
2251
2348
 
2252
2349
  GPR_TIMER_BEGIN("post_parse_locked", 0);
2253
- if (t->initial_window_update != 0) {
2254
- if (t->initial_window_update > 0) {
2350
+ if (t->flow_control.initial_window_update != 0) {
2351
+ if (t->flow_control.initial_window_update > 0) {
2255
2352
  grpc_chttp2_stream *s;
2256
2353
  while (grpc_chttp2_list_pop_stalled_by_stream(t, &s)) {
2257
2354
  grpc_chttp2_become_writable(
@@ -2259,7 +2356,7 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
2259
2356
  "unstalled");
2260
2357
  }
2261
2358
  }
2262
- t->initial_window_update = 0;
2359
+ t->flow_control.initial_window_update = 0;
2263
2360
  }
2264
2361
  GPR_TIMER_END("post_parse_locked", 0);
2265
2362
  }
@@ -2281,45 +2378,9 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
2281
2378
  if (keep_reading) {
2282
2379
  grpc_endpoint_read(exec_ctx, t->ep, &t->read_buffer,
2283
2380
  &t->read_action_locked);
2284
-
2285
- if (t->enable_bdp_probe) {
2286
- if (need_bdp_ping) {
2287
- GRPC_CHTTP2_REF_TRANSPORT(t, "bdp_ping");
2288
- grpc_bdp_estimator_schedule_ping(&t->bdp_estimator);
2289
- send_ping_locked(exec_ctx, t,
2290
- GRPC_CHTTP2_PING_BEFORE_TRANSPORT_WINDOW_UPDATE,
2291
- &t->start_bdp_ping_locked, &t->finish_bdp_ping_locked);
2292
- }
2293
-
2294
- int64_t estimate = -1;
2295
- double bdp_guess = -1;
2296
- if (grpc_bdp_estimator_get_estimate(&t->bdp_estimator, &estimate)) {
2297
- double target = 1 + log2((double)estimate);
2298
- double memory_pressure = grpc_resource_quota_get_memory_pressure(
2299
- grpc_resource_user_quota(grpc_endpoint_get_resource_user(t->ep)));
2300
- if (memory_pressure > 0.8) {
2301
- target *= 1 - GPR_MIN(1, (memory_pressure - 0.8) / 0.1);
2302
- }
2303
- double bdp_error =
2304
- target - grpc_pid_controller_last(&t->pid_controller);
2305
- gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
2306
- gpr_timespec dt_timespec = gpr_time_sub(now, t->last_pid_update);
2307
- double dt = (double)dt_timespec.tv_sec + dt_timespec.tv_nsec * 1e-9;
2308
- if (dt > 0.1) {
2309
- dt = 0.1;
2310
- }
2311
- double log2_bdp_guess =
2312
- grpc_pid_controller_update(&t->pid_controller, bdp_error, dt);
2313
- bdp_guess = pow(2, log2_bdp_guess);
2314
- update_bdp(exec_ctx, t, bdp_guess);
2315
- t->last_pid_update = now;
2316
- }
2317
-
2318
- double bw = -1;
2319
- if (grpc_bdp_estimator_get_bw(&t->bdp_estimator, &bw)) {
2320
- update_frame(exec_ctx, t, bw, bdp_guess);
2321
- }
2322
- }
2381
+ grpc_chttp2_act_on_flowctl_action(
2382
+ exec_ctx, grpc_chttp2_flowctl_get_bdp_action(&t->flow_control), t,
2383
+ NULL);
2323
2384
  GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "keep_reading");
2324
2385
  } else {
2325
2386
  GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "reading_action");
@@ -2342,7 +2403,7 @@ static void start_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp,
2342
2403
  if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
2343
2404
  grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer);
2344
2405
  }
2345
- grpc_bdp_estimator_start_ping(&t->bdp_estimator);
2406
+ grpc_bdp_estimator_start_ping(&t->flow_control.bdp_estimator);
2346
2407
  }
2347
2408
 
2348
2409
  static void finish_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp,
@@ -2351,7 +2412,7 @@ static void finish_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp,
2351
2412
  if (GRPC_TRACER_ON(grpc_http_trace)) {
2352
2413
  gpr_log(GPR_DEBUG, "%s: Complete BDP ping", t->peer_string);
2353
2414
  }
2354
- grpc_bdp_estimator_complete_ping(&t->bdp_estimator);
2415
+ grpc_bdp_estimator_complete_ping(&t->flow_control.bdp_estimator);
2355
2416
 
2356
2417
  GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "bdp_ping");
2357
2418
  }
@@ -2517,7 +2578,7 @@ static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg,
2517
2578
  grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, s->t, s);
2518
2579
  } else {
2519
2580
  GPR_ASSERT(error != GRPC_ERROR_NONE);
2520
- grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error));
2581
+ GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_REF(error));
2521
2582
  s->on_next = NULL;
2522
2583
  GRPC_ERROR_UNREF(s->byte_stream_error);
2523
2584
  s->byte_stream_error = GRPC_ERROR_NONE;
@@ -2533,54 +2594,6 @@ static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx,
2533
2594
  }
2534
2595
  }
2535
2596
 
2536
- static void incoming_byte_stream_update_flow_control(grpc_exec_ctx *exec_ctx,
2537
- grpc_chttp2_transport *t,
2538
- grpc_chttp2_stream *s,
2539
- size_t max_size_hint,
2540
- size_t have_already) {
2541
- uint32_t max_recv_bytes;
2542
- uint32_t initial_window_size =
2543
- t->settings[GRPC_SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE];
2544
-
2545
- /* clamp max recv hint to an allowable size */
2546
- if (max_size_hint >= UINT32_MAX - initial_window_size) {
2547
- max_recv_bytes = UINT32_MAX - initial_window_size;
2548
- } else {
2549
- max_recv_bytes = (uint32_t)max_size_hint;
2550
- }
2551
-
2552
- /* account for bytes already received but unknown to higher layers */
2553
- if (max_recv_bytes >= have_already) {
2554
- max_recv_bytes -= (uint32_t)have_already;
2555
- } else {
2556
- max_recv_bytes = 0;
2557
- }
2558
-
2559
- /* add some small lookahead to keep pipelines flowing */
2560
- GPR_ASSERT(max_recv_bytes <= UINT32_MAX - initial_window_size);
2561
- if (s->incoming_window_delta < max_recv_bytes && !s->read_closed) {
2562
- uint32_t add_max_recv_bytes =
2563
- (uint32_t)(max_recv_bytes - s->incoming_window_delta);
2564
- grpc_chttp2_stream_write_type write_type =
2565
- GRPC_CHTTP2_STREAM_WRITE_INITIATE_UNCOVERED;
2566
- if (s->incoming_window_delta + initial_window_size <
2567
- (int64_t)have_already) {
2568
- write_type = GRPC_CHTTP2_STREAM_WRITE_INITIATE_COVERED;
2569
- }
2570
- GRPC_CHTTP2_FLOW_CREDIT_STREAM_INCOMING_WINDOW_DELTA("op", t, s,
2571
- add_max_recv_bytes);
2572
- GRPC_CHTTP2_FLOW_CREDIT_STREAM("op", t, s, announce_window,
2573
- add_max_recv_bytes);
2574
- if ((int64_t)s->incoming_window_delta + (int64_t)initial_window_size -
2575
- (int64_t)s->announce_window >
2576
- (int64_t)initial_window_size / 2) {
2577
- write_type = GRPC_CHTTP2_STREAM_WRITE_PIGGYBACK;
2578
- }
2579
- grpc_chttp2_become_writable(exec_ctx, t, s, write_type,
2580
- "read_incoming_stream");
2581
- }
2582
- }
2583
-
2584
2597
  static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx,
2585
2598
  void *argp,
2586
2599
  grpc_error *error_ignored) {
@@ -2589,16 +2602,23 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx,
2589
2602
  grpc_chttp2_stream *s = bs->stream;
2590
2603
 
2591
2604
  size_t cur_length = s->frame_storage.length;
2592
- incoming_byte_stream_update_flow_control(
2593
- exec_ctx, t, s, bs->next_action.max_size_hint, cur_length);
2594
-
2605
+ if (!s->read_closed) {
2606
+ grpc_chttp2_flowctl_incoming_bs_update(&t->flow_control, &s->flow_control,
2607
+ bs->next_action.max_size_hint,
2608
+ cur_length);
2609
+ grpc_chttp2_act_on_flowctl_action(
2610
+ exec_ctx,
2611
+ grpc_chttp2_flowctl_get_action(&t->flow_control, &s->flow_control), t,
2612
+ s);
2613
+ }
2595
2614
  GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0);
2596
2615
  if (s->frame_storage.length > 0) {
2597
2616
  grpc_slice_buffer_swap(&s->frame_storage,
2598
2617
  &s->unprocessed_incoming_frames_buffer);
2599
- grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE);
2618
+ s->unprocessed_incoming_frames_decompressed = false;
2619
+ GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE);
2600
2620
  } else if (s->byte_stream_error != GRPC_ERROR_NONE) {
2601
- grpc_closure_sched(exec_ctx, bs->next_action.on_complete,
2621
+ GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete,
2602
2622
  GRPC_ERROR_REF(s->byte_stream_error));
2603
2623
  if (s->data_parser.parsing_frame != NULL) {
2604
2624
  incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame);
@@ -2608,7 +2628,7 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx,
2608
2628
  if (bs->remaining_bytes != 0) {
2609
2629
  s->byte_stream_error =
2610
2630
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
2611
- grpc_closure_sched(exec_ctx, bs->next_action.on_complete,
2631
+ GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete,
2612
2632
  GRPC_ERROR_REF(s->byte_stream_error));
2613
2633
  if (s->data_parser.parsing_frame != NULL) {
2614
2634
  incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame);
@@ -2639,11 +2659,11 @@ static bool incoming_byte_stream_next(grpc_exec_ctx *exec_ctx,
2639
2659
  gpr_ref(&bs->refs);
2640
2660
  bs->next_action.max_size_hint = max_size_hint;
2641
2661
  bs->next_action.on_complete = on_complete;
2642
- grpc_closure_sched(
2662
+ GRPC_CLOSURE_SCHED(
2643
2663
  exec_ctx,
2644
- grpc_closure_init(
2645
- &bs->next_action.closure, incoming_byte_stream_next_locked, bs,
2646
- grpc_combiner_scheduler(bs->transport->combiner, false)),
2664
+ GRPC_CLOSURE_INIT(&bs->next_action.closure,
2665
+ incoming_byte_stream_next_locked, bs,
2666
+ grpc_combiner_scheduler(bs->transport->combiner)),
2647
2667
  GRPC_ERROR_NONE);
2648
2668
  GPR_TIMER_END("incoming_byte_stream_next", 0);
2649
2669
  return false;
@@ -2657,51 +2677,61 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx,
2657
2677
  grpc_chttp2_incoming_byte_stream *bs =
2658
2678
  (grpc_chttp2_incoming_byte_stream *)byte_stream;
2659
2679
  grpc_chttp2_stream *s = bs->stream;
2680
+ grpc_error *error;
2660
2681
 
2661
2682
  if (s->unprocessed_incoming_frames_buffer.length > 0) {
2662
- grpc_error *error = grpc_deframe_unprocessed_incoming_frames(
2683
+ if (s->stream_compression_recv_enabled &&
2684
+ !s->unprocessed_incoming_frames_decompressed) {
2685
+ bool end_of_context;
2686
+ if (!s->stream_decompression_ctx) {
2687
+ s->stream_decompression_ctx = grpc_stream_compression_context_create(
2688
+ GRPC_STREAM_COMPRESSION_DECOMPRESS);
2689
+ }
2690
+ if (!grpc_stream_decompress(s->stream_decompression_ctx,
2691
+ &s->unprocessed_incoming_frames_buffer,
2692
+ s->decompressed_data_buffer, NULL, MAX_SIZE_T,
2693
+ &end_of_context)) {
2694
+ error =
2695
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream decompression error.");
2696
+ return error;
2697
+ }
2698
+ GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0);
2699
+ grpc_slice_buffer_swap(&s->unprocessed_incoming_frames_buffer,
2700
+ s->decompressed_data_buffer);
2701
+ s->unprocessed_incoming_frames_decompressed = true;
2702
+ if (end_of_context) {
2703
+ grpc_stream_compression_context_destroy(s->stream_decompression_ctx);
2704
+ s->stream_decompression_ctx = NULL;
2705
+ }
2706
+ }
2707
+ error = grpc_deframe_unprocessed_incoming_frames(
2663
2708
  exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer,
2664
2709
  slice, NULL);
2665
2710
  if (error != GRPC_ERROR_NONE) {
2666
2711
  return error;
2667
2712
  }
2668
2713
  } else {
2669
- grpc_error *error =
2670
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
2671
- grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
2714
+ error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
2715
+ GRPC_CLOSURE_SCHED(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
2672
2716
  return error;
2673
2717
  }
2674
2718
  GPR_TIMER_END("incoming_byte_stream_pull", 0);
2675
2719
  return GRPC_ERROR_NONE;
2676
2720
  }
2677
2721
 
2678
- static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx,
2679
- grpc_byte_stream *byte_stream);
2680
-
2681
2722
  static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx,
2682
2723
  void *byte_stream,
2683
- grpc_error *error_ignored) {
2684
- grpc_chttp2_incoming_byte_stream *bs = byte_stream;
2685
- grpc_chttp2_stream *s = bs->stream;
2686
- grpc_chttp2_transport *t = s->t;
2687
-
2688
- GPR_ASSERT(bs->base.destroy == incoming_byte_stream_destroy);
2689
- incoming_byte_stream_unref(exec_ctx, bs);
2690
- s->pending_byte_stream = false;
2691
- grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s);
2692
- grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s);
2693
- }
2724
+ grpc_error *error_ignored);
2694
2725
 
2695
2726
  static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx,
2696
2727
  grpc_byte_stream *byte_stream) {
2697
2728
  GPR_TIMER_BEGIN("incoming_byte_stream_destroy", 0);
2698
2729
  grpc_chttp2_incoming_byte_stream *bs =
2699
2730
  (grpc_chttp2_incoming_byte_stream *)byte_stream;
2700
- grpc_closure_sched(
2701
- exec_ctx,
2702
- grpc_closure_init(
2703
- &bs->destroy_action, incoming_byte_stream_destroy_locked, bs,
2704
- grpc_combiner_scheduler(bs->transport->combiner, false)),
2731
+ GRPC_CLOSURE_SCHED(
2732
+ exec_ctx, GRPC_CLOSURE_INIT(
2733
+ &bs->destroy_action, incoming_byte_stream_destroy_locked,
2734
+ bs, grpc_combiner_scheduler(bs->transport->combiner)),
2705
2735
  GRPC_ERROR_NONE);
2706
2736
  GPR_TIMER_END("incoming_byte_stream_destroy", 0);
2707
2737
  }
@@ -2712,7 +2742,7 @@ static void incoming_byte_stream_publish_error(
2712
2742
  grpc_chttp2_stream *s = bs->stream;
2713
2743
 
2714
2744
  GPR_ASSERT(error != GRPC_ERROR_NONE);
2715
- grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error));
2745
+ GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_REF(error));
2716
2746
  s->on_next = NULL;
2717
2747
  GRPC_ERROR_UNREF(s->byte_stream_error);
2718
2748
  s->byte_stream_error = GRPC_ERROR_REF(error);
@@ -2729,7 +2759,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_push(
2729
2759
  grpc_error *error =
2730
2760
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream");
2731
2761
 
2732
- grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
2762
+ GRPC_CLOSURE_SCHED(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
2733
2763
  grpc_slice_unref_internal(exec_ctx, slice);
2734
2764
  return error;
2735
2765
  } else {
@@ -2752,12 +2782,39 @@ grpc_error *grpc_chttp2_incoming_byte_stream_finished(
2752
2782
  }
2753
2783
  }
2754
2784
  if (error != GRPC_ERROR_NONE && reset_on_error) {
2755
- grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
2785
+ GRPC_CLOSURE_SCHED(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
2756
2786
  }
2757
2787
  incoming_byte_stream_unref(exec_ctx, bs);
2758
2788
  return error;
2759
2789
  }
2760
2790
 
2791
+ static void incoming_byte_stream_shutdown(grpc_exec_ctx *exec_ctx,
2792
+ grpc_byte_stream *byte_stream,
2793
+ grpc_error *error) {
2794
+ grpc_chttp2_incoming_byte_stream *bs =
2795
+ (grpc_chttp2_incoming_byte_stream *)byte_stream;
2796
+ GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished(
2797
+ exec_ctx, bs, error, true /* reset_on_error */));
2798
+ }
2799
+
2800
+ static const grpc_byte_stream_vtable grpc_chttp2_incoming_byte_stream_vtable = {
2801
+ incoming_byte_stream_next, incoming_byte_stream_pull,
2802
+ incoming_byte_stream_shutdown, incoming_byte_stream_destroy};
2803
+
2804
+ static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx,
2805
+ void *byte_stream,
2806
+ grpc_error *error_ignored) {
2807
+ grpc_chttp2_incoming_byte_stream *bs = byte_stream;
2808
+ grpc_chttp2_stream *s = bs->stream;
2809
+ grpc_chttp2_transport *t = s->t;
2810
+
2811
+ GPR_ASSERT(bs->base.vtable == &grpc_chttp2_incoming_byte_stream_vtable);
2812
+ incoming_byte_stream_unref(exec_ctx, bs);
2813
+ s->pending_byte_stream = false;
2814
+ grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s);
2815
+ grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s);
2816
+ }
2817
+
2761
2818
  grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create(
2762
2819
  grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s,
2763
2820
  uint32_t frame_size, uint32_t flags) {
@@ -2766,9 +2823,7 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create(
2766
2823
  incoming_byte_stream->base.length = frame_size;
2767
2824
  incoming_byte_stream->remaining_bytes = frame_size;
2768
2825
  incoming_byte_stream->base.flags = flags;
2769
- incoming_byte_stream->base.next = incoming_byte_stream_next;
2770
- incoming_byte_stream->base.pull = incoming_byte_stream_pull;
2771
- incoming_byte_stream->base.destroy = incoming_byte_stream_destroy;
2826
+ incoming_byte_stream->base.vtable = &grpc_chttp2_incoming_byte_stream_vtable;
2772
2827
  gpr_ref_init(&incoming_byte_stream->refs, 2);
2773
2828
  incoming_byte_stream->transport = t;
2774
2829
  incoming_byte_stream->stream = s;
@@ -2864,83 +2919,6 @@ static void destructive_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg,
2864
2919
  GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "destructive_reclaimer");
2865
2920
  }
2866
2921
 
2867
- /*******************************************************************************
2868
- * TRACING
2869
- */
2870
-
2871
- static char *format_flowctl_context_var(const char *context, const char *var,
2872
- int64_t val, uint32_t id) {
2873
- char *name;
2874
- if (context == NULL) {
2875
- name = gpr_strdup(var);
2876
- } else if (0 == strcmp(context, "t")) {
2877
- GPR_ASSERT(id == 0);
2878
- gpr_asprintf(&name, "TRANSPORT:%s", var);
2879
- } else if (0 == strcmp(context, "s")) {
2880
- GPR_ASSERT(id != 0);
2881
- gpr_asprintf(&name, "STREAM[%d]:%s", id, var);
2882
- } else {
2883
- gpr_asprintf(&name, "BAD_CONTEXT[%s][%d]:%s", context, id, var);
2884
- }
2885
- char *name_fld = gpr_leftpad(name, ' ', 64);
2886
- char *value;
2887
- gpr_asprintf(&value, "%" PRId64, val);
2888
- char *value_fld = gpr_leftpad(value, ' ', 8);
2889
- char *result;
2890
- gpr_asprintf(&result, "%s %s", name_fld, value_fld);
2891
- gpr_free(name);
2892
- gpr_free(name_fld);
2893
- gpr_free(value);
2894
- gpr_free(value_fld);
2895
- return result;
2896
- }
2897
-
2898
- void grpc_chttp2_flowctl_trace(const char *file, int line, const char *phase,
2899
- grpc_chttp2_flowctl_op op, const char *context1,
2900
- const char *var1, const char *context2,
2901
- const char *var2, int is_client,
2902
- uint32_t stream_id, int64_t val1, int64_t val2) {
2903
- char *tmp_phase;
2904
- char *label1 = format_flowctl_context_var(context1, var1, val1, stream_id);
2905
- char *label2 = format_flowctl_context_var(context2, var2, val2, stream_id);
2906
- char *clisvr = is_client ? "client" : "server";
2907
- char *prefix;
2908
-
2909
- tmp_phase = gpr_leftpad(phase, ' ', 8);
2910
- gpr_asprintf(&prefix, "FLOW %s: %s ", tmp_phase, clisvr);
2911
- gpr_free(tmp_phase);
2912
-
2913
- switch (op) {
2914
- case GRPC_CHTTP2_FLOWCTL_MOVE:
2915
- if (val2 != 0) {
2916
- gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
2917
- "%sMOVE %s <- %s giving %" PRId64, prefix, label1, label2,
2918
- val1 + val2);
2919
- }
2920
- break;
2921
- case GRPC_CHTTP2_FLOWCTL_CREDIT:
2922
- GPR_ASSERT(val2 >= 0);
2923
- if (val2 != 0) {
2924
- gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
2925
- "%sCREDIT %s by %s giving %" PRId64, prefix, label1, label2,
2926
- val1 + val2);
2927
- }
2928
- break;
2929
- case GRPC_CHTTP2_FLOWCTL_DEBIT:
2930
- GPR_ASSERT(val2 >= 0);
2931
- if (val2 != 0) {
2932
- gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
2933
- "%sDEBIT %s by %s giving %" PRId64, prefix, label1, label2,
2934
- val1 - val2);
2935
- }
2936
- break;
2937
- }
2938
-
2939
- gpr_free(label1);
2940
- gpr_free(label2);
2941
- gpr_free(prefix);
2942
- }
2943
-
2944
2922
  /*******************************************************************************
2945
2923
  * INTEGRATION GLUE
2946
2924
  */
@@ -2987,5 +2965,5 @@ void grpc_chttp2_transport_start_reading(grpc_exec_ctx *exec_ctx,
2987
2965
  grpc_slice_buffer_move_into(read_buffer, &t->read_buffer);
2988
2966
  gpr_free(read_buffer);
2989
2967
  }
2990
- grpc_closure_sched(exec_ctx, &t->read_action_locked, GRPC_ERROR_NONE);
2968
+ GRPC_CLOSURE_SCHED(exec_ctx, &t->read_action_locked, GRPC_ERROR_NONE);
2991
2969
  }