grpc-flamingo 1.11.0 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (452) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1150 -176
  3. data/etc/roots.pem +40 -196
  4. data/include/grpc/grpc.h +49 -8
  5. data/include/grpc/grpc_security.h +123 -2
  6. data/include/grpc/grpc_security_constants.h +6 -0
  7. data/include/grpc/impl/codegen/fork.h +4 -4
  8. data/include/grpc/impl/codegen/grpc_types.h +26 -5
  9. data/include/grpc/impl/codegen/log.h +112 -0
  10. data/include/grpc/impl/codegen/port_platform.h +55 -4
  11. data/include/grpc/module.modulemap +2 -0
  12. data/include/grpc/support/log.h +2 -80
  13. data/include/grpc/support/string_util.h +2 -0
  14. data/include/grpc/support/sync.h +0 -16
  15. data/src/boringssl/err_data.c +602 -588
  16. data/src/core/ext/{census → filters/census}/grpc_context.cc +0 -0
  17. data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -1
  18. data/src/core/ext/filters/client_channel/client_channel.cc +1234 -1070
  19. data/src/core/ext/filters/client_channel/client_channel.h +5 -0
  20. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +113 -0
  21. data/src/core/ext/filters/client_channel/client_channel_channelz.h +71 -0
  22. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +9 -0
  23. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
  24. data/src/core/ext/filters/client_channel/http_proxy.cc +22 -5
  25. data/src/core/ext/filters/client_channel/lb_policy.cc +2 -2
  26. data/src/core/ext/filters/client_channel/lb_policy.h +30 -10
  27. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +11 -9
  28. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +120 -127
  29. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +36 -0
  30. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +36 -102
  31. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +37 -32
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +25 -22
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +4 -2
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +19 -0
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +54 -0
  36. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +19 -0
  37. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +54 -0
  38. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +4 -17
  39. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +37 -63
  40. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +306 -239
  41. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +444 -392
  42. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +538 -98
  43. data/src/core/ext/filters/client_channel/lb_policy_factory.cc +8 -0
  44. data/src/core/ext/filters/client_channel/lb_policy_factory.h +4 -0
  45. data/src/core/ext/filters/client_channel/method_params.h +4 -0
  46. data/src/core/ext/filters/client_channel/resolver.h +10 -0
  47. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +36 -19
  48. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +320 -0
  49. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +62 -9
  50. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +49 -294
  51. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +537 -0
  52. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +112 -87
  53. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +17 -2
  54. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +6 -5
  55. data/src/core/ext/filters/{load_reporting/server_load_reporting_filter.h → client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc} +7 -8
  56. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +29 -0
  57. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +32 -15
  58. data/src/core/ext/filters/client_channel/retry_throttle.h +4 -0
  59. data/src/core/ext/filters/client_channel/subchannel.cc +58 -15
  60. data/src/core/ext/filters/client_channel/subchannel.h +11 -0
  61. data/src/core/ext/filters/deadline/deadline_filter.cc +18 -15
  62. data/src/core/ext/filters/deadline/deadline_filter.h +5 -5
  63. data/src/core/ext/filters/http/client/http_client_filter.cc +10 -9
  64. data/src/core/ext/filters/http/client_authority_filter.cc +6 -5
  65. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +6 -6
  66. data/src/core/ext/filters/http/server/http_server_filter.cc +123 -131
  67. data/src/core/ext/filters/http/server/http_server_filter.h +1 -1
  68. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
  69. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
  70. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -2
  71. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +9 -8
  72. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +97 -48
  73. data/src/core/ext/transport/chttp2/transport/flow_control.cc +10 -7
  74. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +3 -3
  75. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +12 -8
  76. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -3
  77. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +2 -2
  78. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +2 -2
  79. data/src/core/ext/transport/chttp2/transport/parsing.cc +14 -12
  80. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
  81. data/src/core/ext/transport/chttp2/transport/writing.cc +32 -27
  82. data/src/core/ext/transport/inproc/inproc_transport.cc +87 -49
  83. data/src/core/lib/channel/channel_args.cc +28 -0
  84. data/src/core/lib/channel/channel_args.h +4 -0
  85. data/src/core/lib/channel/channel_stack.cc +22 -29
  86. data/src/core/lib/channel/channel_stack.h +2 -2
  87. data/src/core/lib/channel/channel_stack_builder.cc +0 -3
  88. data/src/core/lib/channel/channel_stack_builder.h +0 -2
  89. data/src/core/lib/channel/channel_trace.cc +28 -63
  90. data/src/core/lib/channel/channel_trace.h +13 -17
  91. data/src/core/lib/channel/channelz.cc +153 -0
  92. data/src/core/lib/channel/channelz.h +133 -0
  93. data/src/core/lib/channel/channelz_registry.cc +145 -0
  94. data/src/core/lib/channel/channelz_registry.h +120 -0
  95. data/src/core/lib/channel/connected_channel.cc +8 -1
  96. data/src/core/lib/channel/handshaker.cc +71 -0
  97. data/src/core/lib/channel/handshaker.h +4 -0
  98. data/src/core/lib/debug/stats.h +7 -0
  99. data/src/core/lib/debug/stats_data.cc +5 -0
  100. data/src/core/lib/debug/stats_data.h +120 -0
  101. data/src/core/lib/debug/trace.cc +2 -1
  102. data/src/core/lib/debug/trace.h +12 -1
  103. data/src/core/lib/gpr/alloc.h +28 -0
  104. data/src/core/lib/gpr/arena.cc +38 -45
  105. data/src/core/lib/gpr/log.cc +8 -2
  106. data/src/core/lib/gpr/log_android.cc +4 -0
  107. data/src/core/lib/gpr/log_linux.cc +4 -0
  108. data/src/core/lib/gpr/log_posix.cc +4 -0
  109. data/src/core/lib/gpr/log_windows.cc +5 -0
  110. data/src/core/lib/gpr/string.cc +28 -0
  111. data/src/core/lib/gpr/string.h +10 -0
  112. data/src/core/lib/gprpp/abstract.h +5 -2
  113. data/src/core/lib/gprpp/fork.cc +268 -0
  114. data/src/core/lib/gprpp/fork.h +88 -0
  115. data/src/core/lib/gprpp/inlined_vector.h +87 -37
  116. data/src/core/lib/gprpp/memory.h +12 -0
  117. data/src/core/lib/gprpp/mutex_lock.h +42 -0
  118. data/src/core/lib/gprpp/orphanable.h +10 -12
  119. data/src/core/lib/gprpp/ref_counted.h +10 -12
  120. data/src/core/lib/gprpp/ref_counted_ptr.h +65 -8
  121. data/src/core/lib/gprpp/thd.h +0 -3
  122. data/src/core/lib/gprpp/thd_posix.cc +5 -54
  123. data/src/core/lib/gprpp/thd_windows.cc +0 -7
  124. data/src/core/lib/http/httpcli_security_connector.cc +1 -3
  125. data/src/core/lib/iomgr/call_combiner.cc +13 -13
  126. data/src/core/lib/iomgr/call_combiner.h +84 -1
  127. data/src/core/lib/iomgr/closure.h +6 -5
  128. data/src/core/lib/iomgr/combiner.cc +30 -13
  129. data/src/core/lib/iomgr/combiner.h +1 -1
  130. data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
  131. data/src/core/lib/iomgr/error.cc +12 -0
  132. data/src/core/lib/iomgr/error.h +5 -0
  133. data/src/core/lib/iomgr/ev_epoll1_linux.cc +138 -51
  134. data/src/core/lib/iomgr/ev_epollex_linux.cc +276 -93
  135. data/src/core/lib/iomgr/ev_epollsig_linux.cc +58 -50
  136. data/src/core/lib/iomgr/ev_poll_posix.cc +163 -42
  137. data/src/core/lib/iomgr/ev_posix.cc +88 -24
  138. data/src/core/lib/iomgr/ev_posix.h +48 -12
  139. data/src/core/lib/iomgr/exec_ctx.cc +15 -9
  140. data/src/core/lib/iomgr/exec_ctx.h +48 -20
  141. data/src/core/lib/iomgr/executor.cc +274 -142
  142. data/src/core/lib/iomgr/executor.h +82 -16
  143. data/src/core/lib/iomgr/fork_posix.cc +42 -19
  144. data/src/core/lib/iomgr/iocp_windows.cc +9 -4
  145. data/src/core/lib/iomgr/iomgr.cc +2 -0
  146. data/src/core/lib/iomgr/iomgr.h +5 -0
  147. data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
  148. data/src/core/lib/iomgr/is_epollexclusive_available.cc +1 -0
  149. data/src/core/lib/iomgr/lockfree_event.cc +5 -1
  150. data/src/core/lib/iomgr/polling_entity.cc +11 -2
  151. data/src/core/lib/iomgr/pollset_custom.cc +2 -2
  152. data/src/core/lib/iomgr/port.h +51 -1
  153. data/src/core/lib/iomgr/resolve_address.h +1 -1
  154. data/src/core/lib/iomgr/resolve_address_posix.cc +4 -3
  155. data/src/core/lib/iomgr/resolve_address_windows.cc +3 -2
  156. data/src/core/lib/iomgr/resource_quota.cc +89 -12
  157. data/src/core/lib/iomgr/resource_quota.h +16 -0
  158. data/src/core/lib/iomgr/sockaddr_posix.h +1 -1
  159. data/src/core/lib/iomgr/socket_factory_posix.cc +1 -1
  160. data/src/core/lib/iomgr/socket_mutator.cc +1 -1
  161. data/src/core/lib/iomgr/socket_mutator.h +1 -1
  162. data/src/core/lib/iomgr/socket_utils.h +9 -0
  163. data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -1
  164. data/src/core/lib/iomgr/socket_utils_linux.cc +0 -1
  165. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -3
  166. data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
  167. data/src/core/lib/iomgr/socket_utils_uv.cc +4 -0
  168. data/src/core/lib/iomgr/socket_utils_windows.cc +4 -0
  169. data/src/core/lib/iomgr/socket_windows.cc +33 -0
  170. data/src/core/lib/iomgr/socket_windows.h +6 -0
  171. data/src/core/lib/iomgr/tcp_client_custom.cc +5 -5
  172. data/src/core/lib/iomgr/tcp_client_posix.cc +10 -11
  173. data/src/core/lib/iomgr/tcp_custom.cc +11 -11
  174. data/src/core/lib/iomgr/tcp_posix.cc +49 -36
  175. data/src/core/lib/iomgr/tcp_server_custom.cc +5 -5
  176. data/src/core/lib/iomgr/tcp_server_posix.cc +16 -36
  177. data/src/core/lib/iomgr/tcp_server_utils_posix.h +1 -1
  178. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +17 -5
  179. data/src/core/lib/iomgr/tcp_server_windows.cc +1 -0
  180. data/src/core/lib/iomgr/tcp_uv.cc +3 -0
  181. data/src/core/lib/iomgr/tcp_windows.cc +18 -2
  182. data/src/core/lib/iomgr/tcp_windows.h +2 -0
  183. data/src/core/lib/iomgr/timer.h +4 -3
  184. data/src/core/lib/iomgr/timer_generic.cc +133 -51
  185. data/src/core/lib/iomgr/timer_manager.cc +12 -14
  186. data/src/core/lib/iomgr/timer_uv.cc +3 -0
  187. data/src/core/lib/iomgr/udp_server.cc +106 -52
  188. data/src/core/lib/iomgr/udp_server.h +8 -4
  189. data/src/core/lib/json/json.cc +12 -1
  190. data/src/core/lib/json/json.h +5 -0
  191. data/src/core/lib/profiling/basic_timers.cc +1 -0
  192. data/src/core/lib/security/context/security_context.cc +8 -8
  193. data/src/core/lib/security/context/security_context.h +6 -2
  194. data/src/core/lib/security/credentials/alts/alts_credentials.h +0 -20
  195. data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +3 -2
  196. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +7 -7
  197. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +1 -38
  198. data/src/core/lib/security/credentials/credentials.h +1 -0
  199. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +89 -115
  200. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +16 -0
  201. data/src/core/lib/security/credentials/jwt/json_token.h +2 -0
  202. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -0
  203. data/src/core/lib/security/credentials/local/local_credentials.cc +77 -0
  204. data/src/core/lib/security/credentials/local/local_credentials.h +40 -0
  205. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +11 -7
  206. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -1
  207. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +17 -3
  208. data/src/core/lib/security/security_connector/alts_security_connector.cc +2 -1
  209. data/src/core/lib/security/security_connector/load_system_roots.h +29 -0
  210. data/src/core/lib/{gpr/fork.h → security/security_connector/load_system_roots_fallback.cc} +10 -13
  211. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +165 -0
  212. data/src/core/lib/security/security_connector/load_system_roots_linux.h +44 -0
  213. data/src/core/lib/security/security_connector/local_security_connector.cc +245 -0
  214. data/src/core/lib/security/security_connector/local_security_connector.h +58 -0
  215. data/src/core/lib/security/security_connector/security_connector.cc +79 -32
  216. data/src/core/lib/security/security_connector/security_connector.h +5 -3
  217. data/src/core/lib/security/transport/client_auth_filter.cc +5 -5
  218. data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
  219. data/src/core/lib/security/transport/security_handshaker.cc +7 -2
  220. data/src/core/lib/security/transport/server_auth_filter.cc +4 -7
  221. data/src/core/lib/security/util/json_util.cc +4 -0
  222. data/src/core/lib/slice/slice.cc +6 -2
  223. data/src/core/lib/slice/slice_buffer.cc +27 -7
  224. data/src/core/lib/slice/slice_hash_table.h +4 -0
  225. data/src/core/lib/slice/slice_weak_hash_table.h +4 -0
  226. data/src/core/lib/surface/call.cc +119 -58
  227. data/src/core/lib/surface/call.h +7 -0
  228. data/src/core/lib/surface/channel.cc +50 -18
  229. data/src/core/lib/surface/channel.h +4 -0
  230. data/src/core/lib/surface/completion_queue.cc +153 -18
  231. data/src/core/lib/surface/completion_queue.h +20 -2
  232. data/src/core/lib/surface/completion_queue_factory.cc +13 -4
  233. data/src/core/lib/surface/init.cc +7 -8
  234. data/src/core/lib/surface/init.h +0 -1
  235. data/src/core/lib/surface/server.cc +16 -0
  236. data/src/core/lib/surface/version.cc +1 -1
  237. data/src/core/lib/transport/bdp_estimator.cc +3 -3
  238. data/src/core/lib/transport/bdp_estimator.h +2 -2
  239. data/src/core/lib/transport/byte_stream.cc +1 -1
  240. data/src/core/lib/transport/connectivity_state.cc +6 -7
  241. data/src/core/lib/transport/service_config.cc +2 -2
  242. data/src/core/lib/transport/service_config.h +3 -3
  243. data/src/core/lib/transport/transport.cc +22 -10
  244. data/src/core/lib/transport/transport.h +18 -18
  245. data/src/core/lib/transport/transport_op_string.cc +1 -8
  246. data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -4
  247. data/src/core/tsi/alts/crypt/aes_gcm.cc +2 -0
  248. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +19 -7
  249. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +10 -0
  250. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +2 -2
  251. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +38 -3
  252. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +3 -0
  253. data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -1
  254. data/src/core/tsi/alts/handshaker/altscontext.pb.h +1 -2
  255. data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -1
  256. data/src/core/tsi/alts/handshaker/handshaker.pb.h +1 -2
  257. data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -1
  258. data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +1 -1
  259. data/src/core/tsi/alts/handshaker/transport_security_common_api.h +2 -2
  260. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +47 -1
  261. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +3 -1
  262. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +12 -11
  263. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +7 -2
  264. data/src/core/tsi/fake_transport_security.cc +1 -0
  265. data/src/core/tsi/grpc_shadow_boringssl.h +3006 -0
  266. data/src/core/tsi/local_transport_security.cc +209 -0
  267. data/src/core/tsi/local_transport_security.h +51 -0
  268. data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -0
  269. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +5 -5
  270. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +6 -0
  271. data/src/core/tsi/ssl_transport_security.cc +245 -116
  272. data/src/core/tsi/ssl_types.h +2 -0
  273. data/src/core/tsi/transport_security.cc +14 -0
  274. data/src/core/tsi/transport_security.h +2 -0
  275. data/src/core/tsi/transport_security_interface.h +11 -1
  276. data/src/ruby/bin/math_client.rb +17 -9
  277. data/src/ruby/ext/grpc/extconf.rb +1 -26
  278. data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -3
  279. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +42 -16
  280. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +65 -26
  281. data/src/ruby/lib/grpc/generic/active_call.rb +19 -23
  282. data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -1
  283. data/src/ruby/lib/grpc/version.rb +1 -1
  284. data/src/ruby/pb/generate_proto_ruby.sh +7 -1
  285. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +4 -1
  286. data/src/ruby/spec/call_credentials_spec.rb +1 -1
  287. data/src/ruby/spec/call_spec.rb +1 -1
  288. data/src/ruby/spec/channel_credentials_spec.rb +1 -1
  289. data/src/ruby/spec/channel_spec.rb +1 -1
  290. data/src/ruby/spec/client_auth_spec.rb +1 -12
  291. data/src/ruby/spec/client_server_spec.rb +1 -1
  292. data/src/ruby/spec/compression_options_spec.rb +1 -1
  293. data/src/ruby/spec/error_sanity_spec.rb +1 -1
  294. data/src/ruby/spec/generic/client_stub_spec.rb +16 -4
  295. data/src/ruby/spec/generic/rpc_desc_spec.rb +1 -1
  296. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +1 -1
  297. data/src/ruby/spec/generic/service_spec.rb +1 -1
  298. data/src/ruby/spec/google_rpc_status_utils_spec.rb +1 -12
  299. data/src/ruby/spec/pb/duplicate/codegen_spec.rb +1 -0
  300. data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
  301. data/src/ruby/spec/server_credentials_spec.rb +1 -1
  302. data/src/ruby/spec/server_spec.rb +1 -1
  303. data/src/ruby/spec/spec_helper.rb +1 -0
  304. data/src/ruby/spec/support/services.rb +1 -1
  305. data/src/ruby/spec/time_consts_spec.rb +1 -1
  306. data/third_party/address_sorting/address_sorting.c +17 -11
  307. data/third_party/address_sorting/address_sorting_windows.c +43 -3
  308. data/third_party/address_sorting/include/address_sorting/address_sorting.h +3 -0
  309. data/third_party/boringssl/crypto/asn1/a_int.c +33 -28
  310. data/third_party/boringssl/crypto/asn1/a_mbstr.c +24 -22
  311. data/third_party/boringssl/crypto/asn1/a_utf8.c +13 -11
  312. data/third_party/boringssl/crypto/asn1/asn1_locl.h +3 -0
  313. data/third_party/boringssl/crypto/asn1/tasn_dec.c +40 -19
  314. data/third_party/boringssl/crypto/bio/fd.c +1 -0
  315. data/third_party/boringssl/crypto/bio/file.c +2 -0
  316. data/third_party/boringssl/crypto/bn_extra/convert.c +6 -5
  317. data/third_party/boringssl/crypto/bytestring/ber.c +1 -4
  318. data/third_party/boringssl/crypto/bytestring/cbb.c +116 -16
  319. data/third_party/boringssl/crypto/bytestring/cbs.c +151 -20
  320. data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +203 -0
  321. data/third_party/boringssl/crypto/cipher_extra/e_rc2.c +2 -0
  322. data/third_party/boringssl/crypto/cipher_extra/e_tls.c +1 -2
  323. data/third_party/boringssl/crypto/cpu-aarch64-fuchsia.c +55 -0
  324. data/third_party/boringssl/crypto/cpu-aarch64-linux.c +2 -1
  325. data/third_party/boringssl/crypto/dsa/dsa.c +16 -54
  326. data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +9 -10
  327. data/third_party/boringssl/crypto/ecdh/ecdh.c +4 -3
  328. data/third_party/boringssl/crypto/fipsmodule/bcm.c +11 -542
  329. data/third_party/boringssl/crypto/fipsmodule/bn/add.c +57 -112
  330. data/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.c +4 -3
  331. data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +128 -70
  332. data/third_party/boringssl/crypto/fipsmodule/bn/bytes.c +32 -71
  333. data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +64 -118
  334. data/third_party/boringssl/crypto/fipsmodule/bn/div.c +284 -122
  335. data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +31 -65
  336. data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +274 -218
  337. data/third_party/boringssl/crypto/fipsmodule/bn/generic.c +2 -1
  338. data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +187 -27
  339. data/third_party/boringssl/crypto/fipsmodule/bn/jacobi.c +1 -1
  340. data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +124 -81
  341. data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +8 -30
  342. data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +321 -347
  343. data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +326 -66
  344. data/third_party/boringssl/crypto/fipsmodule/bn/random.c +77 -25
  345. data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c +199 -222
  346. data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +27 -47
  347. data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +155 -96
  348. data/third_party/boringssl/crypto/fipsmodule/bn/sqrt.c +1 -1
  349. data/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c +10 -10
  350. data/third_party/boringssl/crypto/fipsmodule/des/internal.h +2 -0
  351. data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +78 -47
  352. data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +99 -163
  353. data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +3 -10
  354. data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +44 -23
  355. data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +59 -90
  356. data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +38 -65
  357. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +5378 -5418
  358. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +17 -26
  359. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h +15 -11
  360. data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +45 -51
  361. data/third_party/boringssl/crypto/fipsmodule/ec/{util-64.c → util.c} +0 -5
  362. data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +144 -264
  363. data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +78 -62
  364. data/third_party/boringssl/crypto/fipsmodule/modes/ccm.c +256 -0
  365. data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +36 -32
  366. data/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c +9 -7
  367. data/third_party/boringssl/crypto/fipsmodule/rsa/blinding.c +16 -40
  368. data/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +1 -6
  369. data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +57 -39
  370. data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +309 -142
  371. data/third_party/boringssl/crypto/fipsmodule/self_check/self_check.c +581 -0
  372. data/third_party/boringssl/crypto/fipsmodule/tls/internal.h +39 -0
  373. data/third_party/boringssl/crypto/fipsmodule/tls/kdf.c +165 -0
  374. data/third_party/boringssl/crypto/internal.h +65 -2
  375. data/third_party/boringssl/crypto/mem.c +0 -2
  376. data/third_party/boringssl/crypto/obj/obj.c +6 -73
  377. data/third_party/boringssl/crypto/thread_pthread.c +35 -5
  378. data/third_party/boringssl/crypto/x509/a_strex.c +11 -11
  379. data/third_party/boringssl/crypto/x509/vpm_int.h +1 -0
  380. data/third_party/boringssl/crypto/x509/x509_vfy.c +4 -0
  381. data/third_party/boringssl/crypto/x509/x509_vpm.c +44 -22
  382. data/third_party/boringssl/crypto/x509/x_name.c +13 -0
  383. data/third_party/boringssl/include/openssl/aead.h +10 -0
  384. data/third_party/boringssl/include/openssl/asn1.h +2 -3
  385. data/third_party/boringssl/include/openssl/base.h +5 -14
  386. data/third_party/boringssl/include/openssl/bio.h +1 -1
  387. data/third_party/boringssl/include/openssl/bn.h +62 -18
  388. data/third_party/boringssl/include/openssl/bytestring.h +53 -28
  389. data/third_party/boringssl/include/openssl/crypto.h +4 -0
  390. data/third_party/boringssl/include/openssl/ec.h +10 -4
  391. data/third_party/boringssl/include/openssl/ec_key.h +7 -6
  392. data/third_party/boringssl/include/openssl/err.h +9 -9
  393. data/third_party/boringssl/include/openssl/evp.h +1 -1
  394. data/third_party/boringssl/include/openssl/rsa.h +35 -10
  395. data/third_party/boringssl/include/openssl/ssl.h +167 -19
  396. data/third_party/boringssl/include/openssl/ssl3.h +0 -1
  397. data/third_party/boringssl/include/openssl/stack.h +1 -1
  398. data/third_party/boringssl/include/openssl/tls1.h +10 -2
  399. data/third_party/boringssl/include/openssl/x509.h +4 -0
  400. data/third_party/boringssl/include/openssl/x509v3.h +1 -0
  401. data/third_party/boringssl/ssl/d1_both.cc +16 -2
  402. data/third_party/boringssl/ssl/dtls_method.cc +1 -1
  403. data/third_party/boringssl/ssl/handoff.cc +285 -0
  404. data/third_party/boringssl/ssl/handshake.cc +26 -12
  405. data/third_party/boringssl/ssl/handshake_client.cc +101 -95
  406. data/third_party/boringssl/ssl/handshake_server.cc +14 -2
  407. data/third_party/boringssl/ssl/internal.h +132 -79
  408. data/third_party/boringssl/ssl/s3_both.cc +2 -2
  409. data/third_party/boringssl/ssl/s3_lib.cc +3 -1
  410. data/third_party/boringssl/ssl/s3_pkt.cc +0 -18
  411. data/third_party/boringssl/ssl/ssl_aead_ctx.cc +1 -4
  412. data/third_party/boringssl/ssl/ssl_asn1.cc +47 -43
  413. data/third_party/boringssl/ssl/ssl_cipher.cc +12 -8
  414. data/third_party/boringssl/ssl/ssl_key_share.cc +3 -1
  415. data/third_party/boringssl/ssl/ssl_lib.cc +83 -14
  416. data/third_party/boringssl/ssl/ssl_privkey.cc +6 -0
  417. data/third_party/boringssl/ssl/ssl_stat.cc +6 -6
  418. data/third_party/boringssl/ssl/ssl_versions.cc +12 -85
  419. data/third_party/boringssl/ssl/ssl_x509.cc +59 -61
  420. data/third_party/boringssl/ssl/t1_enc.cc +73 -124
  421. data/third_party/boringssl/ssl/t1_lib.cc +367 -41
  422. data/third_party/boringssl/ssl/tls13_both.cc +8 -0
  423. data/third_party/boringssl/ssl/tls13_client.cc +98 -184
  424. data/third_party/boringssl/ssl/tls13_enc.cc +88 -158
  425. data/third_party/boringssl/ssl/tls13_server.cc +91 -137
  426. data/third_party/boringssl/ssl/tls_method.cc +0 -17
  427. data/third_party/boringssl/ssl/tls_record.cc +1 -10
  428. data/third_party/boringssl/third_party/fiat/curve25519.c +921 -2753
  429. data/third_party/boringssl/third_party/fiat/curve25519_tables.h +7880 -0
  430. data/third_party/boringssl/third_party/fiat/internal.h +32 -20
  431. data/third_party/boringssl/third_party/fiat/p256.c +1824 -0
  432. metadata +86 -71
  433. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +0 -253
  434. data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +0 -222
  435. data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +0 -71
  436. data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +0 -61
  437. data/src/core/lib/channel/channel_trace_registry.cc +0 -80
  438. data/src/core/lib/channel/channel_trace_registry.h +0 -43
  439. data/src/core/lib/gpr/fork.cc +0 -78
  440. data/src/core/tsi/transport_security_adapter.cc +0 -235
  441. data/src/core/tsi/transport_security_adapter.h +0 -41
  442. data/src/ruby/bin/apis/google/protobuf/empty.rb +0 -29
  443. data/src/ruby/bin/apis/pubsub_demo.rb +0 -241
  444. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +0 -159
  445. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +0 -88
  446. data/src/ruby/pb/test/client.rb +0 -764
  447. data/src/ruby/pb/test/server.rb +0 -252
  448. data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +0 -54
  449. data/src/ruby/spec/pb/package_with_underscore/data.proto +0 -23
  450. data/src/ruby/spec/pb/package_with_underscore/service.proto +0 -23
  451. data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +0 -247
  452. data/third_party/boringssl/crypto/fipsmodule/ec/p256-64.c +0 -1674
@@ -40,6 +40,7 @@ namespace chttp2 {
40
40
  namespace {
41
41
 
42
42
  static constexpr const int kTracePadding = 30;
43
+ static constexpr const uint32_t kMaxWindowUpdateSize = (1u << 31) - 1;
43
44
 
44
45
  static char* fmt_int64_diff_str(int64_t old_val, int64_t new_val) {
45
46
  char* str;
@@ -55,7 +56,7 @@ static char* fmt_int64_diff_str(int64_t old_val, int64_t new_val) {
55
56
 
56
57
  static char* fmt_uint32_diff_str(uint32_t old_val, uint32_t new_val) {
57
58
  char* str;
58
- if (new_val > 0 && old_val != new_val) {
59
+ if (old_val != new_val) {
59
60
  gpr_asprintf(&str, "%" PRIu32 " -> %" PRIu32 "", old_val, new_val);
60
61
  } else {
61
62
  gpr_asprintf(&str, "%" PRIu32 "", old_val);
@@ -98,10 +99,12 @@ void FlowControlTrace::Finish() {
98
99
  if (sfc_ != nullptr) {
99
100
  srw_str = fmt_int64_diff_str(remote_window_delta_ + remote_window,
100
101
  sfc_->remote_window_delta() + remote_window);
101
- slw_str = fmt_int64_diff_str(local_window_delta_ + acked_local_window,
102
- local_window_delta_ + acked_local_window);
103
- saw_str = fmt_int64_diff_str(announced_window_delta_ + acked_local_window,
104
- announced_window_delta_ + acked_local_window);
102
+ slw_str =
103
+ fmt_int64_diff_str(local_window_delta_ + acked_local_window,
104
+ sfc_->local_window_delta() + acked_local_window);
105
+ saw_str =
106
+ fmt_int64_diff_str(announced_window_delta_ + acked_local_window,
107
+ sfc_->announced_window_delta() + acked_local_window);
105
108
  } else {
106
109
  srw_str = gpr_leftpad("", ' ', kTracePadding);
107
110
  slw_str = gpr_leftpad("", ' ', kTracePadding);
@@ -191,7 +194,7 @@ uint32_t TransportFlowControl::MaybeSendUpdate(bool writing_anyway) {
191
194
  if ((writing_anyway || announced_window_ <= target_announced_window / 2) &&
192
195
  announced_window_ != target_announced_window) {
193
196
  const uint32_t announce = static_cast<uint32_t> GPR_CLAMP(
194
- target_announced_window - announced_window_, 0, UINT32_MAX);
197
+ target_announced_window - announced_window_, 0, kMaxWindowUpdateSize);
195
198
  announced_window_ += announce;
196
199
  return announce;
197
200
  }
@@ -265,7 +268,7 @@ uint32_t StreamFlowControl::MaybeSendUpdate() {
265
268
  FlowControlTrace trace("s updt sent", tfc_, this);
266
269
  if (local_window_delta_ > announced_window_delta_) {
267
270
  uint32_t announce = static_cast<uint32_t> GPR_CLAMP(
268
- local_window_delta_ - announced_window_delta_, 0, UINT32_MAX);
271
+ local_window_delta_ - announced_window_delta_, 0, kMaxWindowUpdateSize);
269
272
  UpdateAnnouncedWindowDelta(tfc_, announce);
270
273
  return announce;
271
274
  }
@@ -217,14 +217,14 @@ grpc_error* grpc_chttp2_settings_parser_parse(void* p, grpc_chttp2_transport* t,
217
217
  t->initial_window_update += static_cast<int64_t>(parser->value) -
218
218
  parser->incoming_settings[id];
219
219
  if (grpc_http_trace.enabled() || grpc_flowctl_trace.enabled()) {
220
- gpr_log(GPR_DEBUG, "%p[%s] adding %d for initial_window change",
221
- t, t->is_client ? "cli" : "svr",
220
+ gpr_log(GPR_INFO, "%p[%s] adding %d for initial_window change", t,
221
+ t->is_client ? "cli" : "svr",
222
222
  static_cast<int>(t->initial_window_update));
223
223
  }
224
224
  }
225
225
  parser->incoming_settings[id] = parser->value;
226
226
  if (grpc_http_trace.enabled()) {
227
- gpr_log(GPR_DEBUG, "CHTTP2:%s:%s: got setting %s = %d",
227
+ gpr_log(GPR_INFO, "CHTTP2:%s:%s: got setting %s = %d",
228
228
  t->is_client ? "CLI" : "SVR", t->peer_string, sp->name,
229
229
  parser->value);
230
230
  }
@@ -41,14 +41,18 @@
41
41
  #include "src/core/lib/transport/static_metadata.h"
42
42
  #include "src/core/lib/transport/timeout_encoding.h"
43
43
 
44
- #define HASH_FRAGMENT_1(x) ((x)&255)
45
- #define HASH_FRAGMENT_2(x) ((x >> 8) & 255)
46
- #define HASH_FRAGMENT_3(x) ((x >> 16) & 255)
47
- #define HASH_FRAGMENT_4(x) ((x >> 24) & 255)
44
+ #define HASH_FRAGMENT_MASK (GRPC_CHTTP2_HPACKC_NUM_VALUES - 1)
45
+ #define HASH_FRAGMENT_1(x) ((x)&HASH_FRAGMENT_MASK)
46
+ #define HASH_FRAGMENT_2(x) \
47
+ (((x) >> GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS) & HASH_FRAGMENT_MASK)
48
+ #define HASH_FRAGMENT_3(x) \
49
+ (((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 2)) & HASH_FRAGMENT_MASK)
50
+ #define HASH_FRAGMENT_4(x) \
51
+ (((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 3)) & HASH_FRAGMENT_MASK)
48
52
 
49
53
  /* if the probability of this item being seen again is < 1/x then don't add
50
54
  it to the table */
51
- #define ONE_ON_ADD_PROBABILITY 128
55
+ #define ONE_ON_ADD_PROBABILITY (GRPC_CHTTP2_HPACKC_NUM_VALUES >> 1)
52
56
  /* don't consider adding anything bigger than this to the hpack table */
53
57
  #define MAX_DECODER_SPACE_USAGE 512
54
58
 
@@ -135,7 +139,7 @@ static void inc_filter(uint8_t idx, uint32_t* sum, uint8_t* elems) {
135
139
  } else {
136
140
  int i;
137
141
  *sum = 0;
138
- for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_FILTERS; i++) {
142
+ for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) {
139
143
  elems[i] /= 2;
140
144
  (*sum) += elems[i];
141
145
  }
@@ -470,7 +474,7 @@ static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
470
474
  v = grpc_slice_to_c_string(GRPC_MDVALUE(elem));
471
475
  }
472
476
  gpr_log(
473
- GPR_DEBUG,
477
+ GPR_INFO,
474
478
  "Encode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
475
479
  k, v, GRPC_MDELEM_IS_INTERNED(elem), GRPC_MDELEM_STORAGE(elem),
476
480
  grpc_slice_is_interned(GRPC_MDKEY(elem)),
@@ -654,7 +658,7 @@ void grpc_chttp2_hpack_compressor_set_max_table_size(
654
658
  }
655
659
  c->advertise_table_size_change = 1;
656
660
  if (grpc_http_trace.enabled()) {
657
- gpr_log(GPR_DEBUG, "set max table size from encoder to %d", max_table_size);
661
+ gpr_log(GPR_INFO, "set max table size from encoder to %d", max_table_size);
658
662
  }
659
663
  }
660
664
 
@@ -28,8 +28,9 @@
28
28
  #include "src/core/lib/transport/metadata_batch.h"
29
29
  #include "src/core/lib/transport/transport.h"
30
30
 
31
- #define GRPC_CHTTP2_HPACKC_NUM_FILTERS 256
32
- #define GRPC_CHTTP2_HPACKC_NUM_VALUES 256
31
+ // This should be <= 8. We use 6 to save space.
32
+ #define GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS 6
33
+ #define GRPC_CHTTP2_HPACKC_NUM_VALUES (1 << GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS)
33
34
  /* initial table size, per spec */
34
35
  #define GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE 4096
35
36
  /* maximum table size we'll actually use */
@@ -58,7 +59,7 @@ typedef struct {
58
59
  a new literal should be added to the compression table or not.
59
60
  They track a single integer that counts how often a particular value has
60
61
  been seen. When that count reaches max (255), all values are halved. */
61
- uint8_t filter_elems[GRPC_CHTTP2_HPACKC_NUM_FILTERS];
62
+ uint8_t filter_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];
62
63
 
63
64
  /* entry tables for keys & elems: these tables track values that have been
64
65
  seen and *may* be in the decompressor table */
@@ -633,7 +633,7 @@ static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md,
633
633
  v = grpc_slice_to_c_string(GRPC_MDVALUE(md));
634
634
  }
635
635
  gpr_log(
636
- GPR_DEBUG,
636
+ GPR_INFO,
637
637
  "Decode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
638
638
  k, v, GRPC_MDELEM_IS_INTERNED(md), GRPC_MDELEM_STORAGE(md),
639
639
  grpc_slice_is_interned(GRPC_MDKEY(md)),
@@ -1622,7 +1622,7 @@ grpc_error* grpc_chttp2_header_parser_parse(void* hpack_parser,
1622
1622
  grpc_chttp2_transport* t,
1623
1623
  grpc_chttp2_stream* s,
1624
1624
  grpc_slice slice, int is_last) {
1625
- GPR_TIMER_SCOPE("grpc_chttp2_hpack_parser_parse", 0);
1625
+ GPR_TIMER_SCOPE("grpc_chttp2_header_parser_parse", 0);
1626
1626
  grpc_chttp2_hpack_parser* parser =
1627
1627
  static_cast<grpc_chttp2_hpack_parser*>(hpack_parser);
1628
1628
  if (s != nullptr) {
@@ -247,7 +247,7 @@ void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl* tbl,
247
247
  return;
248
248
  }
249
249
  if (grpc_http_trace.enabled()) {
250
- gpr_log(GPR_DEBUG, "Update hpack parser max size to %d", max_bytes);
250
+ gpr_log(GPR_INFO, "Update hpack parser max size to %d", max_bytes);
251
251
  }
252
252
  while (tbl->mem_used > max_bytes) {
253
253
  evict1(tbl);
@@ -270,7 +270,7 @@ grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
270
270
  return err;
271
271
  }
272
272
  if (grpc_http_trace.enabled()) {
273
- gpr_log(GPR_DEBUG, "Update hpack parser table size to %d", bytes);
273
+ gpr_log(GPR_INFO, "Update hpack parser table size to %d", bytes);
274
274
  }
275
275
  while (tbl->mem_used > bytes) {
276
276
  evict1(tbl);
@@ -422,7 +422,8 @@ static void on_initial_header(void* tp, grpc_mdelem md) {
422
422
  if (cached_timeout != nullptr) {
423
423
  timeout = *cached_timeout;
424
424
  } else {
425
- if (!grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout)) {
425
+ if (GPR_UNLIKELY(
426
+ !grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout))) {
426
427
  char* val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
427
428
  gpr_log(GPR_ERROR, "Ignoring bad timeout value '%s'", val);
428
429
  gpr_free(val);
@@ -550,15 +551,15 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
550
551
  /* could be a new grpc_chttp2_stream or an existing grpc_chttp2_stream */
551
552
  s = grpc_chttp2_parsing_lookup_stream(t, t->incoming_stream_id);
552
553
  if (s == nullptr) {
553
- if (is_continuation) {
554
+ if (GPR_UNLIKELY(is_continuation)) {
554
555
  GRPC_CHTTP2_IF_TRACING(
555
556
  gpr_log(GPR_ERROR,
556
557
  "grpc_chttp2_stream disbanded before CONTINUATION received"));
557
558
  return init_skip_frame_parser(t, 1);
558
559
  }
559
560
  if (t->is_client) {
560
- if ((t->incoming_stream_id & 1) &&
561
- t->incoming_stream_id < t->next_stream_id) {
561
+ if (GPR_LIKELY((t->incoming_stream_id & 1) &&
562
+ t->incoming_stream_id < t->next_stream_id)) {
562
563
  /* this is an old (probably cancelled) grpc_chttp2_stream */
563
564
  } else {
564
565
  GRPC_CHTTP2_IF_TRACING(gpr_log(
@@ -569,7 +570,7 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
569
570
  grpc_chttp2_hpack_parser_set_has_priority(&t->hpack_parser);
570
571
  }
571
572
  return err;
572
- } else if (t->last_new_stream_id >= t->incoming_stream_id) {
573
+ } else if (GPR_UNLIKELY(t->last_new_stream_id >= t->incoming_stream_id)) {
573
574
  GRPC_CHTTP2_IF_TRACING(gpr_log(
574
575
  GPR_ERROR,
575
576
  "ignoring out of order new grpc_chttp2_stream request on server; "
@@ -577,21 +578,22 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
577
578
  "id=%d, new grpc_chttp2_stream id=%d",
578
579
  t->last_new_stream_id, t->incoming_stream_id));
579
580
  return init_skip_frame_parser(t, 1);
580
- } else if ((t->incoming_stream_id & 1) == 0) {
581
+ } else if (GPR_UNLIKELY((t->incoming_stream_id & 1) == 0)) {
581
582
  GRPC_CHTTP2_IF_TRACING(gpr_log(
582
583
  GPR_ERROR,
583
584
  "ignoring grpc_chttp2_stream with non-client generated index %d",
584
585
  t->incoming_stream_id));
585
586
  return init_skip_frame_parser(t, 1);
586
- } else if (grpc_chttp2_stream_map_size(&t->stream_map) >=
587
- t->settings[GRPC_ACKED_SETTINGS]
588
- [GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]) {
587
+ } else if (GPR_UNLIKELY(
588
+ grpc_chttp2_stream_map_size(&t->stream_map) >=
589
+ t->settings[GRPC_ACKED_SETTINGS]
590
+ [GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS])) {
589
591
  return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Max stream count exceeded");
590
592
  }
591
593
  t->last_new_stream_id = t->incoming_stream_id;
592
594
  s = t->incoming_stream =
593
595
  grpc_chttp2_parsing_accept_stream(t, t->incoming_stream_id);
594
- if (s == nullptr) {
596
+ if (GPR_UNLIKELY(s == nullptr)) {
595
597
  GRPC_CHTTP2_IF_TRACING(
596
598
  gpr_log(GPR_ERROR, "grpc_chttp2_stream not accepted"));
597
599
  return init_skip_frame_parser(t, 1);
@@ -601,7 +603,7 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
601
603
  }
602
604
  GPR_ASSERT(s != nullptr);
603
605
  s->stats.incoming.framing_bytes += 9;
604
- if (s->read_closed) {
606
+ if (GPR_UNLIKELY(s->read_closed)) {
605
607
  GRPC_CHTTP2_IF_TRACING(gpr_log(
606
608
  GPR_ERROR, "skipping already closed grpc_chttp2_stream header"));
607
609
  t->incoming_stream = nullptr;
@@ -723,7 +725,7 @@ static grpc_error* parse_frame_slice(grpc_chttp2_transport* t, grpc_slice slice,
723
725
  int is_last) {
724
726
  grpc_chttp2_stream* s = t->incoming_stream;
725
727
  grpc_error* err = t->parser(t->parser_data, t, s, slice, is_last);
726
- if (err == GRPC_ERROR_NONE) {
728
+ if (GPR_LIKELY(err == GRPC_ERROR_NONE)) {
727
729
  return err;
728
730
  } else if (grpc_error_get_int(err, GRPC_ERROR_INT_STREAM_ID, nullptr)) {
729
731
  if (grpc_http_trace.enabled()) {
@@ -68,7 +68,7 @@ static bool stream_list_pop(grpc_chttp2_transport* t,
68
68
  }
69
69
  *stream = s;
70
70
  if (s && grpc_trace_http2_stream_state.enabled()) {
71
- gpr_log(GPR_DEBUG, "%p[%d][%s]: pop from %s", t, s->id,
71
+ gpr_log(GPR_INFO, "%p[%d][%s]: pop from %s", t, s->id,
72
72
  t->is_client ? "cli" : "svr", stream_list_id_string(id));
73
73
  }
74
74
  return s != nullptr;
@@ -90,7 +90,7 @@ static void stream_list_remove(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
90
90
  t->lists[id].tail = s->links[id].prev;
91
91
  }
92
92
  if (grpc_trace_http2_stream_state.enabled()) {
93
- gpr_log(GPR_DEBUG, "%p[%d][%s]: remove from %s", t, s->id,
93
+ gpr_log(GPR_INFO, "%p[%d][%s]: remove from %s", t, s->id,
94
94
  t->is_client ? "cli" : "svr", stream_list_id_string(id));
95
95
  }
96
96
  }
@@ -122,7 +122,7 @@ static void stream_list_add_tail(grpc_chttp2_transport* t,
122
122
  t->lists[id].tail = s;
123
123
  s->included[id] = 1;
124
124
  if (grpc_trace_http2_stream_state.enabled()) {
125
- gpr_log(GPR_DEBUG, "%p[%d][%s]: add to %s", t, s->id,
125
+ gpr_log(GPR_INFO, "%p[%d][%s]: add to %s", t, s->id,
126
126
  t->is_client ? "cli" : "svr", stream_list_id_string(id));
127
127
  }
128
128
  }
@@ -52,7 +52,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
52
52
  if (!grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_INFLIGHT])) {
53
53
  /* ping already in-flight: wait */
54
54
  if (grpc_http_trace.enabled() || grpc_bdp_estimator_trace.enabled()) {
55
- gpr_log(GPR_DEBUG, "%s: Ping delayed [%p]: already pinging",
55
+ gpr_log(GPR_INFO, "%s: Ping delayed [%p]: already pinging",
56
56
  t->is_client ? "CLIENT" : "SERVER", t->peer_string);
57
57
  }
58
58
  return;
@@ -61,7 +61,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
61
61
  t->ping_policy.max_pings_without_data != 0) {
62
62
  /* need to receive something of substance before sending a ping again */
63
63
  if (grpc_http_trace.enabled() || grpc_bdp_estimator_trace.enabled()) {
64
- gpr_log(GPR_DEBUG, "%s: Ping delayed [%p]: too many recent pings: %d/%d",
64
+ gpr_log(GPR_INFO, "%s: Ping delayed [%p]: too many recent pings: %d/%d",
65
65
  t->is_client ? "CLIENT" : "SERVER", t->peer_string,
66
66
  t->ping_state.pings_before_data_required,
67
67
  t->ping_policy.max_pings_without_data);
@@ -81,7 +81,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
81
81
  if (next_allowed_ping > now) {
82
82
  /* not enough elapsed time between successive pings */
83
83
  if (grpc_http_trace.enabled() || grpc_bdp_estimator_trace.enabled()) {
84
- gpr_log(GPR_DEBUG,
84
+ gpr_log(GPR_INFO,
85
85
  "%s: Ping delayed [%p]: not enough time elapsed since last ping. "
86
86
  " Last ping %f: Next ping %f: Now %f",
87
87
  t->is_client ? "CLIENT" : "SERVER", t->peer_string,
@@ -107,7 +107,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
107
107
  GRPC_STATS_INC_HTTP2_PINGS_SENT();
108
108
  t->ping_state.last_ping_sent_time = now;
109
109
  if (grpc_http_trace.enabled() || grpc_bdp_estimator_trace.enabled()) {
110
- gpr_log(GPR_DEBUG, "%s: Ping sent [%p]: %d/%d",
110
+ gpr_log(GPR_INFO, "%s: Ping sent [%p]: %d/%d",
111
111
  t->is_client ? "CLIENT" : "SERVER", t->peer_string,
112
112
  t->ping_state.pings_before_data_required,
113
113
  t->ping_policy.max_pings_without_data);
@@ -139,22 +139,27 @@ static bool update_list(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
139
139
 
140
140
  static void report_stall(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
141
141
  const char* staller) {
142
- gpr_log(
143
- GPR_DEBUG,
144
- "%s:%p stream %d stalled by %s [fc:pending=%" PRIdPTR
145
- ":pending-compressed=%" PRIdPTR ":flowed=%" PRId64
146
- ":peer_initwin=%d:t_win=%" PRId64 ":s_win=%d:s_delta=%" PRId64 "]",
147
- t->peer_string, t, s->id, staller, s->flow_controlled_buffer.length,
148
- s->compressed_data_buffer.length, s->flow_controlled_bytes_flowed,
149
- t->settings[GRPC_ACKED_SETTINGS]
150
- [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE],
151
- t->flow_control->remote_window(),
152
- static_cast<uint32_t> GPR_MAX(
153
- 0,
154
- s->flow_control->remote_window_delta() +
155
- (int64_t)t->settings[GRPC_PEER_SETTINGS]
156
- [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]),
157
- s->flow_control->remote_window_delta());
142
+ if (grpc_flowctl_trace.enabled()) {
143
+ gpr_log(
144
+ GPR_DEBUG,
145
+ "%s:%p stream %d moved to stalled list by %s. This is FULLY expected "
146
+ "to happen in a healthy program that is not seeing flow control stalls."
147
+ " However, if you know that there are unwanted stalls, here is some "
148
+ "helpful data: [fc:pending=%" PRIdPTR ":pending-compressed=%" PRIdPTR
149
+ ":flowed=%" PRId64 ":peer_initwin=%d:t_win=%" PRId64
150
+ ":s_win=%d:s_delta=%" PRId64 "]",
151
+ t->peer_string, t, s->id, staller, s->flow_controlled_buffer.length,
152
+ s->compressed_data_buffer.length, s->flow_controlled_bytes_flowed,
153
+ t->settings[GRPC_ACKED_SETTINGS]
154
+ [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE],
155
+ t->flow_control->remote_window(),
156
+ static_cast<uint32_t> GPR_MAX(
157
+ 0,
158
+ s->flow_control->remote_window_delta() +
159
+ (int64_t)t->settings[GRPC_PEER_SETTINGS]
160
+ [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]),
161
+ s->flow_control->remote_window_delta());
162
+ }
158
163
  }
159
164
 
160
165
  static bool stream_ref_if_not_destroyed(gpr_refcount* r) {
@@ -337,10 +342,10 @@ class DataSendContext {
337
342
  s_->fetching_send_message == nullptr);
338
343
  if (is_last_data_frame && s_->send_trailing_metadata != nullptr &&
339
344
  s_->stream_compression_ctx != nullptr) {
340
- if (!grpc_stream_compress(
345
+ if (GPR_UNLIKELY(!grpc_stream_compress(
341
346
  s_->stream_compression_ctx, &s_->flow_controlled_buffer,
342
347
  &s_->compressed_data_buffer, nullptr, MAX_SIZE_T,
343
- GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) {
348
+ GRPC_STREAM_COMPRESSION_FLUSH_FINISH))) {
344
349
  gpr_log(GPR_ERROR, "Stream compression failed.");
345
350
  }
346
351
  grpc_stream_compression_context_destroy(s_->stream_compression_ctx);
@@ -368,10 +373,10 @@ class DataSendContext {
368
373
  grpc_stream_compression_context_create(s_->stream_compression_method);
369
374
  }
370
375
  s_->uncompressed_data_size = s_->flow_controlled_buffer.length;
371
- if (!grpc_stream_compress(s_->stream_compression_ctx,
372
- &s_->flow_controlled_buffer,
373
- &s_->compressed_data_buffer, nullptr, MAX_SIZE_T,
374
- GRPC_STREAM_COMPRESSION_FLUSH_SYNC)) {
376
+ if (GPR_UNLIKELY(!grpc_stream_compress(
377
+ s_->stream_compression_ctx, &s_->flow_controlled_buffer,
378
+ &s_->compressed_data_buffer, nullptr, MAX_SIZE_T,
379
+ GRPC_STREAM_COMPRESSION_FLUSH_SYNC))) {
375
380
  gpr_log(GPR_ERROR, "Stream compression failed.");
376
381
  }
377
382
  }
@@ -401,7 +406,7 @@ class StreamWriteContext {
401
406
  StreamWriteContext(WriteContext* write_context, grpc_chttp2_stream* s)
402
407
  : write_context_(write_context), t_(write_context->transport()), s_(s) {
403
408
  GRPC_CHTTP2_IF_TRACING(
404
- gpr_log(GPR_DEBUG, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t_,
409
+ gpr_log(GPR_INFO, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t_,
405
410
  t_->is_client ? "CLIENT" : "SERVER", s->id,
406
411
  s->sent_initial_metadata, s->send_initial_metadata != nullptr,
407
412
  (int)(s->flow_control->local_window_delta() -
@@ -120,17 +120,16 @@ typedef struct inproc_stream {
120
120
  struct inproc_stream* stream_list_next;
121
121
  } inproc_stream;
122
122
 
123
- static grpc_closure do_nothing_closure;
124
123
  static bool cancel_stream_locked(inproc_stream* s, grpc_error* error);
125
124
  static void op_state_machine(void* arg, grpc_error* error);
126
125
 
127
126
  static void ref_transport(inproc_transport* t) {
128
- INPROC_LOG(GPR_DEBUG, "ref_transport %p", t);
127
+ INPROC_LOG(GPR_INFO, "ref_transport %p", t);
129
128
  gpr_ref(&t->refs);
130
129
  }
131
130
 
132
131
  static void really_destroy_transport(inproc_transport* t) {
133
- INPROC_LOG(GPR_DEBUG, "really_destroy_transport %p", t);
132
+ INPROC_LOG(GPR_INFO, "really_destroy_transport %p", t);
134
133
  grpc_connectivity_state_destroy(&t->connectivity);
135
134
  if (gpr_unref(&t->mu->refs)) {
136
135
  gpr_free(t->mu);
@@ -139,7 +138,7 @@ static void really_destroy_transport(inproc_transport* t) {
139
138
  }
140
139
 
141
140
  static void unref_transport(inproc_transport* t) {
142
- INPROC_LOG(GPR_DEBUG, "unref_transport %p", t);
141
+ INPROC_LOG(GPR_INFO, "unref_transport %p", t);
143
142
  if (gpr_unref(&t->refs)) {
144
143
  really_destroy_transport(t);
145
144
  }
@@ -154,17 +153,17 @@ static void unref_transport(inproc_transport* t) {
154
153
  #endif
155
154
 
156
155
  static void ref_stream(inproc_stream* s, const char* reason) {
157
- INPROC_LOG(GPR_DEBUG, "ref_stream %p %s", s, reason);
156
+ INPROC_LOG(GPR_INFO, "ref_stream %p %s", s, reason);
158
157
  STREAM_REF(s->refs, reason);
159
158
  }
160
159
 
161
160
  static void unref_stream(inproc_stream* s, const char* reason) {
162
- INPROC_LOG(GPR_DEBUG, "unref_stream %p %s", s, reason);
161
+ INPROC_LOG(GPR_INFO, "unref_stream %p %s", s, reason);
163
162
  STREAM_UNREF(s->refs, reason);
164
163
  }
165
164
 
166
165
  static void really_destroy_stream(inproc_stream* s) {
167
- INPROC_LOG(GPR_DEBUG, "really_destroy_stream %p", s);
166
+ INPROC_LOG(GPR_INFO, "really_destroy_stream %p", s);
168
167
 
169
168
  GRPC_ERROR_UNREF(s->write_buffer_cancel_error);
170
169
  GRPC_ERROR_UNREF(s->cancel_self_error);
@@ -225,7 +224,7 @@ static grpc_error* fill_in_metadata(inproc_stream* s,
225
224
  static int init_stream(grpc_transport* gt, grpc_stream* gs,
226
225
  grpc_stream_refcount* refcount, const void* server_data,
227
226
  gpr_arena* arena) {
228
- INPROC_LOG(GPR_DEBUG, "init_stream %p %p %p", gt, gs, server_data);
227
+ INPROC_LOG(GPR_INFO, "init_stream %p %p %p", gt, gs, server_data);
229
228
  inproc_transport* t = reinterpret_cast<inproc_transport*>(gt);
230
229
  inproc_stream* s = reinterpret_cast<inproc_stream*>(gs);
231
230
  s->arena = arena;
@@ -282,8 +281,8 @@ static int init_stream(grpc_transport* gt, grpc_stream* gs,
282
281
  // Pass the client-side stream address to the server-side for a ref
283
282
  ref_stream(s, "inproc_init_stream:clt"); // ref it now on behalf of server
284
283
  // side to avoid destruction
285
- INPROC_LOG(GPR_DEBUG, "calling accept stream cb %p %p",
286
- st->accept_stream_cb, st->accept_stream_data);
284
+ INPROC_LOG(GPR_INFO, "calling accept stream cb %p %p", st->accept_stream_cb,
285
+ st->accept_stream_data);
287
286
  (*st->accept_stream_cb)(st->accept_stream_data, &st->base, (void*)s);
288
287
  } else {
289
288
  // This is the server-side and is being called through accept_stream_cb
@@ -373,12 +372,16 @@ static void complete_if_batch_end_locked(inproc_stream* s, grpc_error* error,
373
372
  const char* msg) {
374
373
  int is_sm = static_cast<int>(op == s->send_message_op);
375
374
  int is_stm = static_cast<int>(op == s->send_trailing_md_op);
375
+ // TODO(vjpai): We should not consider the recv ops here, since they
376
+ // have their own callbacks. We should invoke a batch's on_complete
377
+ // as soon as all of the batch's send ops are complete, even if there
378
+ // are still recv ops pending.
376
379
  int is_rim = static_cast<int>(op == s->recv_initial_md_op);
377
380
  int is_rm = static_cast<int>(op == s->recv_message_op);
378
381
  int is_rtm = static_cast<int>(op == s->recv_trailing_md_op);
379
382
 
380
383
  if ((is_sm + is_stm + is_rim + is_rm + is_rtm) == 1) {
381
- INPROC_LOG(GPR_DEBUG, "%s %p %p %p", msg, s, op, error);
384
+ INPROC_LOG(GPR_INFO, "%s %p %p %p", msg, s, op, error);
382
385
  GRPC_CLOSURE_SCHED(op->on_complete, GRPC_ERROR_REF(error));
383
386
  }
384
387
  }
@@ -393,7 +396,7 @@ static void maybe_schedule_op_closure_locked(inproc_stream* s,
393
396
  }
394
397
 
395
398
  static void fail_helper_locked(inproc_stream* s, grpc_error* error) {
396
- INPROC_LOG(GPR_DEBUG, "op_state_machine %p fail_helper", s);
399
+ INPROC_LOG(GPR_INFO, "op_state_machine %p fail_helper", s);
397
400
  // If we're failing this side, we need to make sure that
398
401
  // we also send or have already sent trailing metadata
399
402
  if (!s->trailing_md_sent) {
@@ -458,7 +461,7 @@ static void fail_helper_locked(inproc_stream* s, grpc_error* error) {
458
461
  *s->recv_initial_md_op->payload->recv_initial_metadata
459
462
  .trailing_metadata_available = true;
460
463
  }
461
- INPROC_LOG(GPR_DEBUG,
464
+ INPROC_LOG(GPR_INFO,
462
465
  "fail_helper %p scheduling initial-metadata-ready %p %p", s,
463
466
  error, err);
464
467
  GRPC_CLOSURE_SCHED(s->recv_initial_md_op->payload->recv_initial_metadata
@@ -472,7 +475,7 @@ static void fail_helper_locked(inproc_stream* s, grpc_error* error) {
472
475
  s->recv_initial_md_op = nullptr;
473
476
  }
474
477
  if (s->recv_message_op) {
475
- INPROC_LOG(GPR_DEBUG, "fail_helper %p scheduling message-ready %p", s,
478
+ INPROC_LOG(GPR_INFO, "fail_helper %p scheduling message-ready %p", s,
476
479
  error);
477
480
  GRPC_CLOSURE_SCHED(
478
481
  s->recv_message_op->payload->recv_message.recv_message_ready,
@@ -496,9 +499,13 @@ static void fail_helper_locked(inproc_stream* s, grpc_error* error) {
496
499
  s->send_trailing_md_op = nullptr;
497
500
  }
498
501
  if (s->recv_trailing_md_op) {
499
- INPROC_LOG(GPR_DEBUG,
500
- "fail_helper %p scheduling trailing-md-on-complete %p", s,
501
- error);
502
+ INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-metadata-ready %p",
503
+ s, error);
504
+ GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->payload->recv_trailing_metadata
505
+ .recv_trailing_metadata_ready,
506
+ GRPC_ERROR_REF(error));
507
+ INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-md-on-complete %p",
508
+ s, error);
502
509
  complete_if_batch_end_locked(
503
510
  s, error, s->recv_trailing_md_op,
504
511
  "fail_helper scheduling recv-trailing-metadata-on-complete");
@@ -549,7 +556,7 @@ static void message_transfer_locked(inproc_stream* sender,
549
556
  receiver->recv_stream.Init(&receiver->recv_message, 0);
550
557
  receiver->recv_message_op->payload->recv_message.recv_message->reset(
551
558
  receiver->recv_stream.get());
552
- INPROC_LOG(GPR_DEBUG, "message_transfer_locked %p scheduling message-ready",
559
+ INPROC_LOG(GPR_INFO, "message_transfer_locked %p scheduling message-ready",
553
560
  receiver);
554
561
  GRPC_CLOSURE_SCHED(
555
562
  receiver->recv_message_op->payload->recv_message.recv_message_ready,
@@ -577,7 +584,7 @@ static void op_state_machine(void* arg, grpc_error* error) {
577
584
 
578
585
  bool needs_close = false;
579
586
 
580
- INPROC_LOG(GPR_DEBUG, "op_state_machine %p", arg);
587
+ INPROC_LOG(GPR_INFO, "op_state_machine %p", arg);
581
588
  inproc_stream* s = static_cast<inproc_stream*>(arg);
582
589
  gpr_mu* mu = &s->t->mu->mu; // keep aside in case s gets closed
583
590
  gpr_mu_lock(mu);
@@ -626,7 +633,7 @@ static void op_state_machine(void* arg, grpc_error* error) {
626
633
  : &other->to_read_trailing_md_filled;
627
634
  if (*destfilled || s->trailing_md_sent) {
628
635
  // The buffer is already in use; that's an error!
629
- INPROC_LOG(GPR_DEBUG, "Extra trailing metadata %p", s);
636
+ INPROC_LOG(GPR_INFO, "Extra trailing metadata %p", s);
630
637
  new_err = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Extra trailing metadata");
631
638
  fail_helper_locked(s, GRPC_ERROR_REF(new_err));
632
639
  goto done;
@@ -639,7 +646,13 @@ static void op_state_machine(void* arg, grpc_error* error) {
639
646
  }
640
647
  s->trailing_md_sent = true;
641
648
  if (!s->t->is_client && s->trailing_md_recvd && s->recv_trailing_md_op) {
642
- INPROC_LOG(GPR_DEBUG,
649
+ INPROC_LOG(GPR_INFO,
650
+ "op_state_machine %p scheduling trailing-metadata-ready", s);
651
+ GRPC_CLOSURE_SCHED(
652
+ s->recv_trailing_md_op->payload->recv_trailing_metadata
653
+ .recv_trailing_metadata_ready,
654
+ GRPC_ERROR_NONE);
655
+ INPROC_LOG(GPR_INFO,
643
656
  "op_state_machine %p scheduling trailing-md-on-complete", s);
644
657
  GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->on_complete,
645
658
  GRPC_ERROR_NONE);
@@ -658,7 +671,7 @@ static void op_state_machine(void* arg, grpc_error* error) {
658
671
  new_err =
659
672
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Already recvd initial md");
660
673
  INPROC_LOG(
661
- GPR_DEBUG,
674
+ GPR_INFO,
662
675
  "op_state_machine %p scheduling on_complete errors for already "
663
676
  "recvd initial md %p",
664
677
  s, new_err);
@@ -684,7 +697,7 @@ static void op_state_machine(void* arg, grpc_error* error) {
684
697
  }
685
698
  grpc_metadata_batch_clear(&s->to_read_initial_md);
686
699
  s->to_read_initial_md_filled = false;
687
- INPROC_LOG(GPR_DEBUG,
700
+ INPROC_LOG(GPR_INFO,
688
701
  "op_state_machine %p scheduling initial-metadata-ready %p", s,
689
702
  new_err);
690
703
  GRPC_CLOSURE_SCHED(s->recv_initial_md_op->payload->recv_initial_metadata
@@ -696,7 +709,7 @@ static void op_state_machine(void* arg, grpc_error* error) {
696
709
  s->recv_initial_md_op = nullptr;
697
710
 
698
711
  if (new_err != GRPC_ERROR_NONE) {
699
- INPROC_LOG(GPR_DEBUG,
712
+ INPROC_LOG(GPR_INFO,
700
713
  "op_state_machine %p scheduling on_complete errors2 %p", s,
701
714
  new_err);
702
715
  fail_helper_locked(s, GRPC_ERROR_REF(new_err));
@@ -712,6 +725,12 @@ static void op_state_machine(void* arg, grpc_error* error) {
712
725
  }
713
726
  if (s->recv_trailing_md_op && s->t->is_client && other &&
714
727
  other->send_message_op) {
728
+ INPROC_LOG(GPR_INFO,
729
+ "op_state_machine %p scheduling trailing-metadata-ready %p", s,
730
+ GRPC_ERROR_NONE);
731
+ GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->payload->recv_trailing_metadata
732
+ .recv_trailing_metadata_ready,
733
+ GRPC_ERROR_NONE);
715
734
  maybe_schedule_op_closure_locked(other, GRPC_ERROR_NONE);
716
735
  }
717
736
  if (s->to_read_trailing_md_filled) {
@@ -719,7 +738,7 @@ static void op_state_machine(void* arg, grpc_error* error) {
719
738
  new_err =
720
739
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Already recvd trailing md");
721
740
  INPROC_LOG(
722
- GPR_DEBUG,
741
+ GPR_INFO,
723
742
  "op_state_machine %p scheduling on_complete errors for already "
724
743
  "recvd trailing md %p",
725
744
  s, new_err);
@@ -729,7 +748,7 @@ static void op_state_machine(void* arg, grpc_error* error) {
729
748
  if (s->recv_message_op != nullptr) {
730
749
  // This message needs to be wrapped up because it will never be
731
750
  // satisfied
732
- INPROC_LOG(GPR_DEBUG, "op_state_machine %p scheduling message-ready", s);
751
+ INPROC_LOG(GPR_INFO, "op_state_machine %p scheduling message-ready", s);
733
752
  GRPC_CLOSURE_SCHED(
734
753
  s->recv_message_op->payload->recv_message.recv_message_ready,
735
754
  GRPC_ERROR_NONE);
@@ -764,29 +783,33 @@ static void op_state_machine(void* arg, grpc_error* error) {
764
783
  // (If the server hasn't already sent its trailing md, it doesn't have
765
784
  // a final status, so don't mark this op complete)
766
785
  if (s->t->is_client || s->trailing_md_sent) {
767
- INPROC_LOG(GPR_DEBUG,
786
+ INPROC_LOG(GPR_INFO,
768
787
  "op_state_machine %p scheduling trailing-md-on-complete %p",
769
788
  s, new_err);
789
+ GRPC_CLOSURE_SCHED(
790
+ s->recv_trailing_md_op->payload->recv_trailing_metadata
791
+ .recv_trailing_metadata_ready,
792
+ GRPC_ERROR_REF(new_err));
770
793
  GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->on_complete,
771
794
  GRPC_ERROR_REF(new_err));
772
795
  s->recv_trailing_md_op = nullptr;
773
796
  needs_close = true;
774
797
  } else {
775
- INPROC_LOG(GPR_DEBUG,
798
+ INPROC_LOG(GPR_INFO,
776
799
  "op_state_machine %p server needs to delay handling "
777
800
  "trailing-md-on-complete %p",
778
801
  s, new_err);
779
802
  }
780
803
  } else {
781
804
  INPROC_LOG(
782
- GPR_DEBUG,
805
+ GPR_INFO,
783
806
  "op_state_machine %p has trailing md but not yet waiting for it", s);
784
807
  }
785
808
  }
786
809
  if (s->trailing_md_recvd && s->recv_message_op) {
787
810
  // No further message will come on this stream, so finish off the
788
811
  // recv_message_op
789
- INPROC_LOG(GPR_DEBUG, "op_state_machine %p scheduling message-ready", s);
812
+ INPROC_LOG(GPR_INFO, "op_state_machine %p scheduling message-ready", s);
790
813
  GRPC_CLOSURE_SCHED(
791
814
  s->recv_message_op->payload->recv_message.recv_message_ready,
792
815
  GRPC_ERROR_NONE);
@@ -810,7 +833,7 @@ static void op_state_machine(void* arg, grpc_error* error) {
810
833
  // Didn't get the item we wanted so we still need to get
811
834
  // rescheduled
812
835
  INPROC_LOG(
813
- GPR_DEBUG, "op_state_machine %p still needs closure %p %p %p %p %p", s,
836
+ GPR_INFO, "op_state_machine %p still needs closure %p %p %p %p %p", s,
814
837
  s->send_message_op, s->send_trailing_md_op, s->recv_initial_md_op,
815
838
  s->recv_message_op, s->recv_trailing_md_op);
816
839
  s->ops_needed = true;
@@ -826,8 +849,7 @@ done:
826
849
 
827
850
  static bool cancel_stream_locked(inproc_stream* s, grpc_error* error) {
828
851
  bool ret = false; // was the cancel accepted
829
- INPROC_LOG(GPR_DEBUG, "cancel_stream %p with %s", s,
830
- grpc_error_string(error));
852
+ INPROC_LOG(GPR_INFO, "cancel_stream %p with %s", s, grpc_error_string(error));
831
853
  if (s->cancel_self_error == GRPC_ERROR_NONE) {
832
854
  ret = true;
833
855
  s->cancel_self_error = GRPC_ERROR_REF(error);
@@ -861,6 +883,9 @@ static bool cancel_stream_locked(inproc_stream* s, grpc_error* error) {
861
883
  // couldn't complete that because we hadn't yet sent out trailing
862
884
  // md, now's the chance
863
885
  if (!s->t->is_client && s->trailing_md_recvd && s->recv_trailing_md_op) {
886
+ GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->payload->recv_trailing_metadata
887
+ .recv_trailing_metadata_ready,
888
+ GRPC_ERROR_REF(s->cancel_self_error));
864
889
  complete_if_batch_end_locked(
865
890
  s, s->cancel_self_error, s->recv_trailing_md_op,
866
891
  "cancel_stream scheduling trailing-md-on-complete");
@@ -875,9 +900,11 @@ static bool cancel_stream_locked(inproc_stream* s, grpc_error* error) {
875
900
  return ret;
876
901
  }
877
902
 
903
+ static void do_nothing(void* arg, grpc_error* error) {}
904
+
878
905
  static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
879
906
  grpc_transport_stream_op_batch* op) {
880
- INPROC_LOG(GPR_DEBUG, "perform_stream_op %p %p %p", gt, gs, op);
907
+ INPROC_LOG(GPR_INFO, "perform_stream_op %p %p %p", gt, gs, op);
881
908
  inproc_stream* s = reinterpret_cast<inproc_stream*>(gs);
882
909
  gpr_mu* mu = &s->t->mu->mu; // save aside in case s gets closed
883
910
  gpr_mu_lock(mu);
@@ -894,8 +921,14 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
894
921
  }
895
922
  grpc_error* error = GRPC_ERROR_NONE;
896
923
  grpc_closure* on_complete = op->on_complete;
924
+ // TODO(roth): This is a hack needed because we use data inside of the
925
+ // closure itself to do the barrier calculation (i.e., to ensure that
926
+ // we don't schedule the closure until all ops in the batch have been
927
+ // completed). This can go away once we move to a new C++ closure API
928
+ // that provides the ability to create a barrier closure.
897
929
  if (on_complete == nullptr) {
898
- on_complete = &do_nothing_closure;
930
+ on_complete = GRPC_CLOSURE_INIT(&op->handler_private.closure, do_nothing,
931
+ nullptr, grpc_schedule_on_exec_ctx);
899
932
  }
900
933
 
901
934
  if (op->cancel_stream) {
@@ -907,7 +940,7 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
907
940
  // already self-canceled so still give it an error
908
941
  error = GRPC_ERROR_REF(s->cancel_self_error);
909
942
  } else {
910
- INPROC_LOG(GPR_DEBUG, "perform_stream_op %p %s%s%s%s%s%s%s", s,
943
+ INPROC_LOG(GPR_INFO, "perform_stream_op %p %s%s%s%s%s%s%s", s,
911
944
  s->t->is_client ? "client" : "server",
912
945
  op->send_initial_metadata ? " send_initial_metadata" : "",
913
946
  op->send_message ? " send_message" : "",
@@ -936,7 +969,7 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
936
969
  : &other->to_read_initial_md_filled;
937
970
  if (*destfilled || s->initial_md_sent) {
938
971
  // The buffer is already in use; that's an error!
939
- INPROC_LOG(GPR_DEBUG, "Extra initial metadata %p", s);
972
+ INPROC_LOG(GPR_INFO, "Extra initial metadata %p", s);
940
973
  error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Extra initial metadata");
941
974
  } else {
942
975
  if (!other || !other->closed) {
@@ -1013,7 +1046,7 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
1013
1046
  true;
1014
1047
  }
1015
1048
  INPROC_LOG(
1016
- GPR_DEBUG,
1049
+ GPR_INFO,
1017
1050
  "perform_stream_op error %p scheduling initial-metadata-ready %p",
1018
1051
  s, error);
1019
1052
  GRPC_CLOSURE_SCHED(
@@ -1022,14 +1055,23 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
1022
1055
  }
1023
1056
  if (op->recv_message) {
1024
1057
  INPROC_LOG(
1025
- GPR_DEBUG,
1058
+ GPR_INFO,
1026
1059
  "perform_stream_op error %p scheduling recv message-ready %p", s,
1027
1060
  error);
1028
1061
  GRPC_CLOSURE_SCHED(op->payload->recv_message.recv_message_ready,
1029
1062
  GRPC_ERROR_REF(error));
1030
1063
  }
1064
+ if (op->recv_trailing_metadata) {
1065
+ INPROC_LOG(
1066
+ GPR_INFO,
1067
+ "perform_stream_op error %p scheduling trailing-metadata-ready %p",
1068
+ s, error);
1069
+ GRPC_CLOSURE_SCHED(
1070
+ op->payload->recv_trailing_metadata.recv_trailing_metadata_ready,
1071
+ GRPC_ERROR_REF(error));
1072
+ }
1031
1073
  }
1032
- INPROC_LOG(GPR_DEBUG, "perform_stream_op %p scheduling on_complete %p", s,
1074
+ INPROC_LOG(GPR_INFO, "perform_stream_op %p scheduling on_complete %p", s,
1033
1075
  error);
1034
1076
  GRPC_CLOSURE_SCHED(on_complete, GRPC_ERROR_REF(error));
1035
1077
  }
@@ -1042,7 +1084,7 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
1042
1084
  }
1043
1085
 
1044
1086
  static void close_transport_locked(inproc_transport* t) {
1045
- INPROC_LOG(GPR_DEBUG, "close_transport %p %d", t, t->is_closed);
1087
+ INPROC_LOG(GPR_INFO, "close_transport %p %d", t, t->is_closed);
1046
1088
  grpc_connectivity_state_set(
1047
1089
  &t->connectivity, GRPC_CHANNEL_SHUTDOWN,
1048
1090
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Closing transport."),
@@ -1063,7 +1105,7 @@ static void close_transport_locked(inproc_transport* t) {
1063
1105
 
1064
1106
  static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
1065
1107
  inproc_transport* t = reinterpret_cast<inproc_transport*>(gt);
1066
- INPROC_LOG(GPR_DEBUG, "perform_transport_op %p %p", t, op);
1108
+ INPROC_LOG(GPR_INFO, "perform_transport_op %p %p", t, op);
1067
1109
  gpr_mu_lock(&t->mu->mu);
1068
1110
  if (op->on_connectivity_state_change) {
1069
1111
  grpc_connectivity_state_notify_on_state_change(
@@ -1096,7 +1138,7 @@ static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
1096
1138
 
1097
1139
  static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
1098
1140
  grpc_closure* then_schedule_closure) {
1099
- INPROC_LOG(GPR_DEBUG, "destroy_stream %p %p", gs, then_schedule_closure);
1141
+ INPROC_LOG(GPR_INFO, "destroy_stream %p %p", gs, then_schedule_closure);
1100
1142
  inproc_stream* s = reinterpret_cast<inproc_stream*>(gs);
1101
1143
  s->closure_at_destroy = then_schedule_closure;
1102
1144
  really_destroy_stream(s);
@@ -1104,7 +1146,7 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
1104
1146
 
1105
1147
  static void destroy_transport(grpc_transport* gt) {
1106
1148
  inproc_transport* t = reinterpret_cast<inproc_transport*>(gt);
1107
- INPROC_LOG(GPR_DEBUG, "destroy_transport %p", t);
1149
+ INPROC_LOG(GPR_INFO, "destroy_transport %p", t);
1108
1150
  gpr_mu_lock(&t->mu->mu);
1109
1151
  close_transport_locked(t);
1110
1152
  gpr_mu_unlock(&t->mu->mu);
@@ -1131,12 +1173,8 @@ static grpc_endpoint* get_endpoint(grpc_transport* t) { return nullptr; }
1131
1173
  /*******************************************************************************
1132
1174
  * GLOBAL INIT AND DESTROY
1133
1175
  */
1134
- static void do_nothing(void* arg, grpc_error* error) {}
1135
-
1136
1176
  void grpc_inproc_transport_init(void) {
1137
1177
  grpc_core::ExecCtx exec_ctx;
1138
- GRPC_CLOSURE_INIT(&do_nothing_closure, do_nothing, nullptr,
1139
- grpc_schedule_on_exec_ctx);
1140
1178
  g_empty_slice = grpc_slice_from_static_buffer(nullptr, 0);
1141
1179
 
1142
1180
  grpc_slice key_tmp = grpc_slice_from_static_string(":path");
@@ -1165,7 +1203,7 @@ static void inproc_transports_create(grpc_transport** server_transport,
1165
1203
  const grpc_channel_args* server_args,
1166
1204
  grpc_transport** client_transport,
1167
1205
  const grpc_channel_args* client_args) {
1168
- INPROC_LOG(GPR_DEBUG, "inproc_transports_create");
1206
+ INPROC_LOG(GPR_INFO, "inproc_transports_create");
1169
1207
  inproc_transport* st =
1170
1208
  static_cast<inproc_transport*>(gpr_zalloc(sizeof(*st)));
1171
1209
  inproc_transport* ct =