grpc 1.7.3 → 1.8.0

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 (616) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +2106 -2116
  3. data/include/grpc/census.h +1 -432
  4. data/include/grpc/compression.h +9 -9
  5. data/include/grpc/grpc.h +115 -98
  6. data/include/grpc/grpc_cronet.h +3 -3
  7. data/include/grpc/grpc_posix.h +4 -4
  8. data/include/grpc/grpc_security.h +160 -88
  9. data/include/grpc/grpc_security_constants.h +7 -0
  10. data/include/grpc/impl/codegen/atm.h +9 -1
  11. data/include/grpc/impl/codegen/atm_gcc_atomic.h +13 -4
  12. data/include/grpc/impl/codegen/atm_gcc_sync.h +6 -5
  13. data/include/grpc/impl/codegen/atm_windows.h +23 -22
  14. data/include/grpc/impl/codegen/byte_buffer.h +14 -14
  15. data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -2
  16. data/include/grpc/impl/codegen/connectivity_state.h +0 -2
  17. data/include/grpc/impl/codegen/grpc_types.h +32 -28
  18. data/include/grpc/impl/codegen/port_platform.h +48 -0
  19. data/include/grpc/impl/codegen/slice.h +10 -10
  20. data/include/grpc/impl/codegen/sync_generic.h +9 -3
  21. data/include/grpc/slice.h +16 -17
  22. data/include/grpc/slice_buffer.h +22 -22
  23. data/include/grpc/support/alloc.h +11 -11
  24. data/include/grpc/support/avl.h +28 -20
  25. data/include/grpc/support/cmdline.h +13 -13
  26. data/include/grpc/support/histogram.h +17 -17
  27. data/include/grpc/support/host_port.h +2 -2
  28. data/include/grpc/support/log.h +9 -9
  29. data/include/grpc/support/log_windows.h +1 -1
  30. data/include/grpc/support/string_util.h +2 -2
  31. data/include/grpc/support/subprocess.h +5 -5
  32. data/include/grpc/support/sync.h +43 -27
  33. data/include/grpc/support/thd.h +6 -6
  34. data/include/grpc/support/tls_gcc.h +1 -1
  35. data/include/grpc/support/tls_pthread.h +1 -1
  36. data/src/core/ext/census/{grpc_context.c → grpc_context.cc} +5 -8
  37. data/src/core/ext/filters/client_channel/backup_poller.cc +165 -0
  38. data/src/core/ext/{census/grpc_filter.h → filters/client_channel/backup_poller.h} +12 -7
  39. data/src/core/ext/filters/client_channel/{channel_connectivity.c → channel_connectivity.cc} +45 -42
  40. data/src/core/ext/filters/client_channel/{client_channel.c → client_channel.cc} +452 -417
  41. data/src/core/ext/filters/client_channel/client_channel.h +16 -8
  42. data/src/core/ext/filters/client_channel/{client_channel_factory.c → client_channel_factory.cc} +0 -0
  43. data/src/core/ext/filters/client_channel/client_channel_factory.h +29 -21
  44. data/src/core/ext/filters/client_channel/{client_channel_plugin.c → client_channel_plugin.cc} +15 -19
  45. data/src/core/ext/filters/client_channel/{connector.c → connector.cc} +0 -0
  46. data/src/core/ext/filters/client_channel/connector.h +29 -21
  47. data/src/core/ext/filters/client_channel/{http_connect_handshaker.c → http_connect_handshaker.cc} +10 -10
  48. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +8 -0
  49. data/src/core/ext/filters/client_channel/{http_proxy.c → http_proxy.cc} +14 -14
  50. data/src/core/ext/filters/client_channel/http_proxy.h +8 -0
  51. data/src/core/ext/filters/client_channel/{lb_policy.c → lb_policy.cc} +47 -48
  52. data/src/core/ext/filters/client_channel/lb_policy.h +76 -70
  53. data/src/core/ext/filters/client_channel/lb_policy/grpclb/{client_load_reporting_filter.c → client_load_reporting_filter.cc} +28 -29
  54. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +9 -1
  55. data/src/core/ext/filters/client_channel/lb_policy/grpclb/{grpclb.c → grpclb.cc} +554 -563
  56. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +9 -1
  57. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +17 -9
  58. data/src/core/ext/filters/client_channel/lb_policy/grpclb/{grpclb_channel_secure.c → grpclb_channel_secure.cc} +17 -17
  59. data/src/core/ext/filters/client_channel/lb_policy/grpclb/{grpclb_client_stats.c → grpclb_client_stats.cc} +3 -3
  60. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +9 -1
  61. data/src/core/ext/filters/client_channel/lb_policy/grpclb/{load_balancer_api.c → load_balancer_api.cc} +64 -67
  62. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +20 -21
  63. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +599 -0
  64. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +695 -0
  65. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +270 -0
  66. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +153 -0
  67. data/src/core/ext/filters/client_channel/{lb_policy_factory.c → lb_policy_factory.cc} +10 -10
  68. data/src/core/ext/filters/client_channel/lb_policy_factory.h +48 -40
  69. data/src/core/ext/filters/client_channel/{lb_policy_registry.c → lb_policy_registry.cc} +9 -9
  70. data/src/core/ext/filters/client_channel/lb_policy_registry.h +11 -3
  71. data/src/core/ext/filters/client_channel/{parse_address.c → parse_address.cc} +24 -24
  72. data/src/core/ext/filters/client_channel/parse_address.h +14 -6
  73. data/src/core/ext/filters/client_channel/{proxy_mapper.c → proxy_mapper.cc} +0 -0
  74. data/src/core/ext/filters/client_channel/proxy_mapper.h +8 -0
  75. data/src/core/ext/filters/client_channel/{proxy_mapper_registry.c → proxy_mapper_registry.cc} +0 -0
  76. data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +8 -0
  77. data/src/core/ext/filters/client_channel/{resolver.c → resolver.cc} +21 -23
  78. data/src/core/ext/filters/client_channel/resolver.h +33 -27
  79. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/{dns_resolver_ares.c → dns_resolver_ares.cc} +133 -133
  80. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +18 -9
  81. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/{grpc_ares_ev_driver_posix.c → grpc_ares_ev_driver_posix.cc} +58 -56
  82. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/{grpc_ares_wrapper.c → grpc_ares_wrapper.cc} +118 -115
  83. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +23 -15
  84. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +60 -0
  85. data/src/core/ext/filters/client_channel/resolver/dns/native/{dns_resolver.c → dns_resolver.cc} +100 -94
  86. data/src/core/ext/filters/client_channel/resolver/fake/{fake_resolver.c → fake_resolver.cc} +14 -14
  87. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +9 -1
  88. data/src/core/ext/filters/client_channel/resolver/sockaddr/{sockaddr_resolver.c → sockaddr_resolver.cc} +60 -60
  89. data/src/core/ext/filters/client_channel/{resolver_factory.c → resolver_factory.cc} +2 -2
  90. data/src/core/ext/filters/client_channel/resolver_factory.h +27 -19
  91. data/src/core/ext/filters/client_channel/{resolver_registry.c → resolver_registry.cc} +35 -35
  92. data/src/core/ext/filters/client_channel/resolver_registry.h +18 -10
  93. data/src/core/ext/filters/client_channel/{retry_throttle.c → retry_throttle.cc} +10 -10
  94. data/src/core/ext/filters/client_channel/retry_throttle.h +8 -0
  95. data/src/core/ext/filters/client_channel/{subchannel.c → subchannel.cc} +210 -213
  96. data/src/core/ext/filters/client_channel/subchannel.h +68 -60
  97. data/src/core/ext/filters/client_channel/{subchannel_index.c → subchannel_index.cc} +52 -52
  98. data/src/core/ext/filters/client_channel/subchannel_index.h +22 -14
  99. data/src/core/ext/filters/client_channel/{uri_parser.c → uri_parser.cc} +29 -27
  100. data/src/core/ext/filters/client_channel/uri_parser.h +18 -10
  101. data/src/core/ext/filters/deadline/{deadline_filter.c → deadline_filter.cc} +12 -15
  102. data/src/core/ext/filters/deadline/deadline_filter.h +11 -2
  103. data/src/core/ext/filters/http/client/{http_client_filter.c → http_client_filter.cc} +83 -83
  104. data/src/core/ext/filters/http/client/http_client_filter.h +8 -0
  105. data/src/core/ext/filters/http/{http_filters_plugin.c → http_filters_plugin.cc} +20 -21
  106. data/src/core/ext/filters/http/message_compress/{message_compress_filter.c → message_compress_filter.cc} +84 -83
  107. data/src/core/ext/filters/http/message_compress/message_compress_filter.h +9 -1
  108. data/src/core/ext/filters/http/server/{http_server_filter.c → http_server_filter.cc} +80 -78
  109. data/src/core/ext/filters/http/server/http_server_filter.h +8 -0
  110. data/src/core/ext/filters/load_reporting/{server_load_reporting_filter.c → server_load_reporting_filter.cc} +29 -29
  111. data/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +9 -1
  112. data/src/core/ext/filters/load_reporting/{server_load_reporting_plugin.c → server_load_reporting_plugin.cc} +11 -11
  113. data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +13 -5
  114. data/src/core/ext/filters/max_age/{max_age_filter.c → max_age_filter.cc} +46 -56
  115. data/src/core/ext/filters/max_age/max_age_filter.h +8 -0
  116. data/src/core/ext/filters/message_size/{message_size_filter.c → message_size_filter.cc} +62 -40
  117. data/src/core/ext/filters/message_size/message_size_filter.h +8 -0
  118. data/src/core/ext/filters/workarounds/{workaround_cronet_compression_filter.c → workaround_cronet_compression_filter.cc} +11 -11
  119. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +8 -0
  120. data/src/core/ext/filters/workarounds/{workaround_utils.c → workaround_utils.cc} +7 -7
  121. data/src/core/ext/filters/workarounds/workaround_utils.h +9 -1
  122. data/src/core/ext/transport/chttp2/alpn/{alpn.c → alpn.cc} +3 -3
  123. data/src/core/ext/transport/chttp2/alpn/alpn.h +10 -2
  124. data/src/core/ext/transport/chttp2/client/{chttp2_connector.c → chttp2_connector.cc} +49 -45
  125. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +8 -0
  126. data/src/core/ext/transport/chttp2/client/insecure/{channel_create.c → channel_create.cc} +28 -27
  127. data/src/core/ext/transport/chttp2/client/insecure/{channel_create_posix.c → channel_create_posix.cc} +14 -13
  128. data/src/core/ext/transport/chttp2/client/secure/{secure_channel_create.c → secure_channel_create.cc} +68 -66
  129. data/src/core/ext/transport/chttp2/server/{chttp2_server.c → chttp2_server.cc} +76 -77
  130. data/src/core/ext/transport/chttp2/server/chttp2_server.h +11 -3
  131. data/src/core/ext/transport/chttp2/server/insecure/{server_chttp2.c → server_chttp2.cc} +3 -3
  132. data/src/core/ext/transport/chttp2/server/insecure/{server_chttp2_posix.c → server_chttp2_posix.cc} +13 -12
  133. data/src/core/ext/transport/chttp2/server/secure/{server_secure_chttp2.c → server_secure_chttp2.cc} +12 -10
  134. data/src/core/ext/transport/chttp2/transport/{bin_decoder.c → bin_decoder.cc} +7 -7
  135. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +15 -7
  136. data/src/core/ext/transport/chttp2/transport/{bin_encoder.c → bin_encoder.cc} +11 -11
  137. data/src/core/ext/transport/chttp2/transport/bin_encoder.h +8 -0
  138. data/src/core/ext/transport/chttp2/transport/{chttp2_plugin.c → chttp2_plugin.cc} +2 -9
  139. data/src/core/ext/transport/chttp2/transport/{chttp2_transport.c → chttp2_transport.cc} +778 -778
  140. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +14 -10
  141. data/src/core/ext/transport/chttp2/transport/flow_control.cc +385 -0
  142. data/src/core/ext/transport/chttp2/transport/flow_control.h +337 -0
  143. data/src/core/ext/transport/chttp2/transport/frame.h +8 -0
  144. data/src/core/ext/transport/chttp2/transport/{frame_data.c → frame_data.cc} +34 -34
  145. data/src/core/ext/transport/chttp2/transport/frame_data.h +25 -17
  146. data/src/core/ext/transport/chttp2/transport/{frame_goaway.c → frame_goaway.cc} +18 -18
  147. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +18 -10
  148. data/src/core/ext/transport/chttp2/transport/{frame_ping.c → frame_ping.cc} +18 -19
  149. data/src/core/ext/transport/chttp2/transport/frame_ping.h +12 -4
  150. data/src/core/ext/transport/chttp2/transport/{frame_rst_stream.c → frame_rst_stream.cc} +16 -16
  151. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +16 -8
  152. data/src/core/ext/transport/chttp2/transport/{frame_settings.c → frame_settings.cc} +23 -24
  153. data/src/core/ext/transport/chttp2/transport/frame_settings.h +17 -9
  154. data/src/core/ext/transport/chttp2/transport/{frame_window_update.c → frame_window_update.cc} +22 -24
  155. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +14 -6
  156. data/src/core/ext/transport/chttp2/transport/{hpack_encoder.c → hpack_encoder.cc} +206 -161
  157. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +23 -13
  158. data/src/core/ext/transport/chttp2/transport/{hpack_parser.c → hpack_parser.cc} +340 -334
  159. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +30 -22
  160. data/src/core/ext/transport/chttp2/transport/{hpack_table.c → hpack_table.cc} +25 -25
  161. data/src/core/ext/transport/chttp2/transport/hpack_table.h +19 -11
  162. data/src/core/ext/transport/chttp2/transport/{http2_settings.c → http2_settings.cc} +1 -1
  163. data/src/core/ext/transport/chttp2/transport/http2_settings.h +10 -2
  164. data/src/core/ext/transport/chttp2/transport/{huffsyms.c → huffsyms.cc} +0 -0
  165. data/src/core/ext/transport/chttp2/transport/huffsyms.h +8 -0
  166. data/src/core/ext/transport/chttp2/transport/{incoming_metadata.c → incoming_metadata.cc} +14 -13
  167. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +18 -10
  168. data/src/core/ext/transport/chttp2/transport/internal.h +214 -340
  169. data/src/core/ext/transport/chttp2/transport/{parsing.c → parsing.cc} +152 -141
  170. data/src/core/ext/transport/chttp2/transport/{stream_lists.c → stream_lists.cc} +53 -53
  171. data/src/core/ext/transport/chttp2/transport/{stream_map.c → stream_map.cc} +35 -34
  172. data/src/core/ext/transport/chttp2/transport/stream_map.h +22 -14
  173. data/src/core/ext/transport/chttp2/transport/{varint.c → varint.cc} +0 -0
  174. data/src/core/ext/transport/chttp2/transport/varint.h +8 -0
  175. data/src/core/ext/transport/chttp2/transport/writing.cc +636 -0
  176. data/src/core/ext/transport/inproc/{inproc_plugin.c → inproc_plugin.cc} +5 -6
  177. data/src/core/ext/transport/inproc/{inproc_transport.c → inproc_transport.cc} +479 -544
  178. data/src/core/ext/transport/inproc/inproc_transport.h +4 -4
  179. data/src/core/lib/backoff/backoff.cc +80 -0
  180. data/src/core/lib/backoff/backoff.h +83 -0
  181. data/src/core/lib/channel/{channel_args.c → channel_args.cc} +92 -92
  182. data/src/core/lib/channel/channel_args.h +45 -37
  183. data/src/core/lib/channel/{channel_stack.c → channel_stack.cc} +67 -68
  184. data/src/core/lib/channel/channel_stack.h +76 -75
  185. data/src/core/lib/channel/{channel_stack_builder.c → channel_stack_builder.cc} +91 -91
  186. data/src/core/lib/channel/channel_stack_builder.h +45 -45
  187. data/src/core/lib/channel/{connected_channel.c → connected_channel.cc} +70 -70
  188. data/src/core/lib/channel/connected_channel.h +12 -4
  189. data/src/core/lib/channel/context.h +2 -2
  190. data/src/core/lib/channel/{handshaker.c → handshaker.cc} +7 -9
  191. data/src/core/lib/channel/handshaker.h +9 -1
  192. data/src/core/lib/channel/{handshaker_factory.c → handshaker_factory.cc} +7 -7
  193. data/src/core/lib/channel/handshaker_factory.h +18 -10
  194. data/src/core/lib/channel/{handshaker_registry.c → handshaker_registry.cc} +0 -0
  195. data/src/core/lib/channel/handshaker_registry.h +8 -0
  196. data/src/core/lib/compression/algorithm_metadata.h +8 -0
  197. data/src/core/lib/compression/{compression.c → compression.cc} +9 -9
  198. data/src/core/lib/compression/{message_compress.c → message_compress.cc} +0 -0
  199. data/src/core/lib/compression/message_compress.h +8 -0
  200. data/src/core/lib/compression/{stream_compression.c → stream_compression.cc} +12 -12
  201. data/src/core/lib/compression/stream_compression.h +27 -19
  202. data/src/core/lib/compression/{stream_compression_gzip.c → stream_compression_gzip.cc} +35 -36
  203. data/src/core/lib/compression/stream_compression_gzip.h +8 -0
  204. data/src/core/lib/compression/{stream_compression_identity.c → stream_compression_identity.cc} +19 -20
  205. data/src/core/lib/compression/stream_compression_identity.h +8 -0
  206. data/src/core/lib/debug/{stats.c → stats.cc} +19 -19
  207. data/src/core/lib/debug/stats.h +17 -9
  208. data/src/core/lib/debug/{stats_data.c → stats_data.cc} +45 -22
  209. data/src/core/lib/debug/stats_data.h +58 -19
  210. data/src/core/lib/debug/trace.cc +142 -0
  211. data/src/core/lib/debug/trace.h +74 -14
  212. data/src/core/lib/http/{format_request.c → format_request.cc} +10 -10
  213. data/src/core/lib/http/format_request.h +12 -4
  214. data/src/core/lib/http/{httpcli.c → httpcli.cc} +80 -80
  215. data/src/core/lib/http/httpcli.h +41 -33
  216. data/src/core/lib/http/{httpcli_security_connector.c → httpcli_security_connector.cc} +69 -55
  217. data/src/core/lib/http/{parser.c → parser.cc} +42 -42
  218. data/src/core/lib/http/parser.h +28 -20
  219. data/src/core/lib/{support → iomgr}/block_annotate.h +17 -8
  220. data/src/core/lib/iomgr/{call_combiner.c → call_combiner.cc} +29 -17
  221. data/src/core/lib/iomgr/call_combiner.h +9 -1
  222. data/src/core/lib/iomgr/closure.h +220 -62
  223. data/src/core/lib/iomgr/{combiner.c → combiner.cc} +63 -62
  224. data/src/core/lib/iomgr/combiner.h +16 -8
  225. data/src/core/lib/iomgr/{endpoint.c → endpoint.cc} +6 -0
  226. data/src/core/lib/iomgr/endpoint.h +47 -32
  227. data/src/core/lib/iomgr/endpoint_pair.h +12 -4
  228. data/src/core/lib/iomgr/{endpoint_pair_posix.c → endpoint_pair_posix.cc} +3 -3
  229. data/src/core/lib/iomgr/{endpoint_pair_uv.c → endpoint_pair_uv.cc} +2 -2
  230. data/src/core/lib/iomgr/{endpoint_pair_windows.c → endpoint_pair_windows.cc} +6 -6
  231. data/src/core/lib/iomgr/{error.c → error.cc} +125 -124
  232. data/src/core/lib/iomgr/error.h +32 -27
  233. data/src/core/lib/iomgr/error_internal.h +11 -2
  234. data/src/core/lib/iomgr/{ev_epoll1_linux.c → ev_epoll1_linux.cc} +214 -215
  235. data/src/core/lib/iomgr/ev_epoll1_linux.h +9 -1
  236. data/src/core/lib/iomgr/ev_epollex_linux.cc +1488 -0
  237. data/src/core/lib/iomgr/ev_epollex_linux.h +9 -1
  238. data/src/core/lib/iomgr/{ev_epollsig_linux.c → ev_epollsig_linux.cc} +304 -305
  239. data/src/core/lib/iomgr/ev_epollsig_linux.h +12 -4
  240. data/src/core/lib/iomgr/{ev_poll_posix.c → ev_poll_posix.cc} +272 -283
  241. data/src/core/lib/iomgr/ev_poll_posix.h +10 -2
  242. data/src/core/lib/iomgr/ev_posix.cc +288 -0
  243. data/src/core/lib/iomgr/ev_posix.h +75 -67
  244. data/src/core/lib/iomgr/{ev_windows.c → ev_windows.cc} +2 -2
  245. data/src/core/lib/iomgr/exec_ctx.cc +177 -0
  246. data/src/core/lib/iomgr/exec_ctx.h +35 -13
  247. data/src/core/lib/iomgr/{executor.c → executor.cc} +34 -35
  248. data/src/core/lib/iomgr/executor.h +12 -4
  249. data/src/core/lib/iomgr/{fork_posix.c → fork_posix.cc} +0 -0
  250. data/src/core/lib/iomgr/{fork_windows.c → fork_windows.cc} +0 -0
  251. data/src/core/lib/iomgr/gethostname.h +9 -1
  252. data/src/core/lib/iomgr/{gethostname_fallback.c → gethostname_fallback.cc} +2 -1
  253. data/src/core/lib/iomgr/{gethostname_host_name_max.c → gethostname_host_name_max.cc} +4 -3
  254. data/src/core/lib/iomgr/{gethostname_sysconf.c → gethostname_sysconf.cc} +3 -2
  255. data/src/core/lib/iomgr/{iocp_windows.c → iocp_windows.cc} +23 -25
  256. data/src/core/lib/iomgr/iocp_windows.h +17 -3
  257. data/src/core/lib/iomgr/{iomgr.c → iomgr.cc} +25 -19
  258. data/src/core/lib/iomgr/iomgr.h +11 -3
  259. data/src/core/lib/iomgr/iomgr_internal.h +13 -5
  260. data/src/core/lib/iomgr/{iomgr_posix.c → iomgr_posix.cc} +0 -1
  261. data/src/core/lib/iomgr/{iomgr_uv.c → iomgr_uv.cc} +1 -1
  262. data/src/core/lib/iomgr/iomgr_uv.h +8 -0
  263. data/src/core/lib/iomgr/{iomgr_windows.c → iomgr_windows.cc} +0 -0
  264. data/src/core/lib/iomgr/{is_epollexclusive_available.c → is_epollexclusive_available.cc} +1 -1
  265. data/src/core/lib/iomgr/is_epollexclusive_available.h +8 -0
  266. data/src/core/lib/iomgr/{load_file.c → load_file.cc} +12 -12
  267. data/src/core/lib/iomgr/load_file.h +2 -2
  268. data/src/core/lib/iomgr/{lockfree_event.c → lockfree_event.cc} +76 -68
  269. data/src/core/lib/iomgr/lockfree_event.h +30 -11
  270. data/src/core/lib/iomgr/{network_status_tracker.c → network_status_tracker.cc} +3 -2
  271. data/src/core/lib/iomgr/network_status_tracker.h +2 -2
  272. data/src/core/lib/iomgr/{polling_entity.c → polling_entity.cc} +18 -18
  273. data/src/core/lib/iomgr/polling_entity.h +21 -13
  274. data/src/core/lib/iomgr/pollset.h +17 -11
  275. data/src/core/lib/iomgr/pollset_set.h +23 -15
  276. data/src/core/lib/iomgr/{pollset_set_uv.c → pollset_set_uv.cc} +0 -0
  277. data/src/core/lib/iomgr/{pollset_set_windows.c → pollset_set_windows.cc} +0 -0
  278. data/src/core/lib/iomgr/{pollset_uv.c → pollset_uv.cc} +31 -29
  279. data/src/core/lib/iomgr/pollset_uv.h +8 -0
  280. data/src/core/lib/iomgr/{pollset_windows.c → pollset_windows.cc} +24 -24
  281. data/src/core/lib/iomgr/pollset_windows.h +17 -4
  282. data/src/core/lib/iomgr/port.h +10 -0
  283. data/src/core/lib/iomgr/resolve_address.h +18 -10
  284. data/src/core/lib/iomgr/{resolve_address_posix.c → resolve_address_posix.cc} +40 -40
  285. data/src/core/lib/iomgr/{resolve_address_uv.c → resolve_address_uv.cc} +61 -56
  286. data/src/core/lib/iomgr/{resolve_address_windows.c → resolve_address_windows.cc} +36 -34
  287. data/src/core/lib/iomgr/{resource_quota.c → resource_quota.cc} +209 -180
  288. data/src/core/lib/iomgr/resource_quota.h +45 -37
  289. data/src/core/lib/iomgr/{sockaddr_utils.c → sockaddr_utils.cc} +61 -61
  290. data/src/core/lib/iomgr/sockaddr_utils.h +23 -15
  291. data/src/core/lib/iomgr/sockaddr_windows.h +6 -0
  292. data/src/core/lib/iomgr/{socket_factory_posix.c → socket_factory_posix.cc} +20 -20
  293. data/src/core/lib/iomgr/socket_factory_posix.h +15 -15
  294. data/src/core/lib/iomgr/{socket_mutator.c → socket_mutator.cc} +18 -18
  295. data/src/core/lib/iomgr/socket_mutator.h +11 -11
  296. data/src/core/lib/iomgr/socket_utils.h +9 -1
  297. data/src/core/lib/iomgr/{socket_utils_common_posix.c → socket_utils_common_posix.cc} +28 -28
  298. data/src/core/lib/iomgr/{socket_utils_linux.c → socket_utils_linux.cc} +3 -3
  299. data/src/core/lib/iomgr/{socket_utils_posix.c → socket_utils_posix.cc} +3 -3
  300. data/src/core/lib/iomgr/socket_utils_posix.h +26 -18
  301. data/src/core/lib/iomgr/{socket_utils_uv.c → socket_utils_uv.cc} +1 -1
  302. data/src/core/lib/iomgr/{socket_utils_windows.c → socket_utils_windows.cc} +2 -2
  303. data/src/core/lib/iomgr/{socket_windows.c → socket_windows.cc} +18 -18
  304. data/src/core/lib/iomgr/socket_windows.h +26 -13
  305. data/src/core/lib/iomgr/tcp_client.h +14 -6
  306. data/src/core/lib/iomgr/{tcp_client_posix.c → tcp_client_posix.cc} +69 -70
  307. data/src/core/lib/iomgr/tcp_client_posix.h +11 -3
  308. data/src/core/lib/iomgr/{tcp_client_uv.c → tcp_client_uv.cc} +47 -48
  309. data/src/core/lib/iomgr/{tcp_client_windows.c → tcp_client_windows.cc} +46 -44
  310. data/src/core/lib/iomgr/{tcp_posix.c → tcp_posix.cc} +198 -175
  311. data/src/core/lib/iomgr/tcp_posix.h +15 -7
  312. data/src/core/lib/iomgr/tcp_server.h +31 -23
  313. data/src/core/lib/iomgr/{tcp_server_posix.c → tcp_server_posix.cc} +78 -77
  314. data/src/core/lib/iomgr/tcp_server_utils_posix.h +27 -19
  315. data/src/core/lib/iomgr/{tcp_server_utils_posix_common.c → tcp_server_utils_posix_common.cc} +27 -27
  316. data/src/core/lib/iomgr/{tcp_server_utils_posix_ifaddrs.c → tcp_server_utils_posix_ifaddrs.cc} +25 -25
  317. data/src/core/lib/iomgr/{tcp_server_utils_posix_noifaddrs.c → tcp_server_utils_posix_noifaddrs.cc} +2 -2
  318. data/src/core/lib/iomgr/{tcp_server_uv.c → tcp_server_uv.cc} +133 -105
  319. data/src/core/lib/iomgr/{tcp_server_windows.c → tcp_server_windows.cc} +81 -77
  320. data/src/core/lib/iomgr/tcp_uv.cc +420 -0
  321. data/src/core/lib/iomgr/tcp_uv.h +18 -4
  322. data/src/core/lib/iomgr/{tcp_windows.c → tcp_windows.cc} +90 -79
  323. data/src/core/lib/iomgr/tcp_windows.h +17 -4
  324. data/src/core/lib/iomgr/{time_averaged_stats.c → time_averaged_stats.cc} +0 -0
  325. data/src/core/lib/iomgr/time_averaged_stats.h +8 -0
  326. data/src/core/lib/iomgr/timer.h +16 -9
  327. data/src/core/lib/iomgr/{timer_generic.c → timer_generic.cc} +130 -171
  328. data/src/core/lib/iomgr/timer_generic.h +4 -4
  329. data/src/core/lib/iomgr/{timer_heap.c → timer_heap.cc} +20 -21
  330. data/src/core/lib/iomgr/timer_heap.h +16 -8
  331. data/src/core/lib/iomgr/{timer_manager.c → timer_manager.cc} +54 -52
  332. data/src/core/lib/iomgr/timer_manager.h +8 -0
  333. data/src/core/lib/iomgr/{timer_uv.c → timer_uv.cc} +22 -24
  334. data/src/core/lib/iomgr/timer_uv.h +2 -2
  335. data/src/core/lib/iomgr/{udp_server.c → udp_server.cc} +75 -75
  336. data/src/core/lib/iomgr/udp_server.h +25 -17
  337. data/src/core/lib/iomgr/{unix_sockets_posix.c → unix_sockets_posix.cc} +22 -21
  338. data/src/core/lib/iomgr/unix_sockets_posix.h +14 -6
  339. data/src/core/lib/iomgr/{unix_sockets_posix_noop.c → unix_sockets_posix_noop.cc} +5 -5
  340. data/src/core/lib/iomgr/{wakeup_fd_cv.c → wakeup_fd_cv.cc} +2 -2
  341. data/src/core/lib/iomgr/wakeup_fd_cv.h +10 -0
  342. data/src/core/lib/iomgr/{wakeup_fd_eventfd.c → wakeup_fd_eventfd.cc} +0 -0
  343. data/src/core/lib/iomgr/{wakeup_fd_nospecial.c → wakeup_fd_nospecial.cc} +0 -0
  344. data/src/core/lib/iomgr/{wakeup_fd_pipe.c → wakeup_fd_pipe.cc} +1 -0
  345. data/src/core/lib/iomgr/wakeup_fd_pipe.h +9 -1
  346. data/src/core/lib/iomgr/{wakeup_fd_posix.c → wakeup_fd_posix.cc} +6 -7
  347. data/src/core/lib/iomgr/wakeup_fd_posix.h +8 -0
  348. data/src/core/lib/json/{json.c → json.cc} +0 -0
  349. data/src/core/lib/json/json.h +8 -0
  350. data/src/core/lib/json/{json_reader.c → json_reader.cc} +18 -18
  351. data/src/core/lib/json/json_reader.h +26 -18
  352. data/src/core/lib/json/{json_string.c → json_string.cc} +57 -57
  353. data/src/core/lib/json/{json_writer.c → json_writer.cc} +20 -20
  354. data/src/core/lib/json/json_writer.h +23 -15
  355. data/src/core/lib/profiling/{basic_timers.c → basic_timers.cc} +34 -34
  356. data/src/core/lib/profiling/{stap_timers.c → stap_timers.cc} +5 -5
  357. data/src/core/lib/profiling/timers.h +6 -6
  358. data/src/core/lib/security/context/{security_context.c → security_context.cc} +98 -95
  359. data/src/core/lib/security/context/security_context.h +27 -29
  360. data/src/core/lib/security/credentials/composite/{composite_credentials.c → composite_credentials.cc} +79 -73
  361. data/src/core/lib/security/credentials/composite/composite_credentials.h +17 -9
  362. data/src/core/lib/security/credentials/{credentials.c → credentials.cc} +97 -92
  363. data/src/core/lib/security/credentials/credentials.h +83 -75
  364. data/src/core/lib/security/credentials/{credentials_metadata.c → credentials_metadata.cc} +7 -6
  365. data/src/core/lib/security/credentials/fake/{fake_credentials.c → fake_credentials.cc} +39 -36
  366. data/src/core/lib/security/credentials/fake/fake_credentials.h +13 -5
  367. data/src/core/lib/security/credentials/google_default/{credentials_generic.c → credentials_generic.cc} +5 -5
  368. data/src/core/lib/security/credentials/google_default/{google_default_credentials.c → google_default_credentials.cc} +55 -55
  369. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +9 -1
  370. data/src/core/lib/security/credentials/iam/{iam_credentials.c → iam_credentials.cc} +19 -18
  371. data/src/core/lib/security/credentials/jwt/{json_token.c → json_token.cc} +80 -75
  372. data/src/core/lib/security/credentials/jwt/json_token.h +23 -15
  373. data/src/core/lib/security/credentials/jwt/{jwt_credentials.c → jwt_credentials.cc} +45 -41
  374. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +11 -3
  375. data/src/core/lib/security/credentials/jwt/{jwt_verifier.c → jwt_verifier.cc} +262 -252
  376. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +38 -30
  377. data/src/core/lib/security/credentials/oauth2/{oauth2_credentials.c → oauth2_credentials.cc} +138 -141
  378. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +30 -22
  379. data/src/core/lib/security/credentials/plugin/{plugin_credentials.c → plugin_credentials.cc} +52 -53
  380. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +7 -7
  381. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +344 -0
  382. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +27 -0
  383. data/src/core/lib/security/transport/auth_filters.h +16 -0
  384. data/src/core/lib/security/transport/{client_auth_filter.c → client_auth_filter.cc} +127 -115
  385. data/src/core/lib/security/transport/{lb_targets_info.c → lb_targets_info.cc} +16 -13
  386. data/src/core/lib/security/transport/lb_targets_info.h +11 -3
  387. data/src/core/lib/security/transport/{secure_endpoint.c → secure_endpoint.cc} +84 -76
  388. data/src/core/lib/security/transport/secure_endpoint.h +13 -5
  389. data/src/core/lib/security/transport/security_connector.cc +1121 -0
  390. data/src/core/lib/security/transport/security_connector.h +97 -79
  391. data/src/core/lib/security/transport/{security_handshaker.c → security_handshaker.cc} +139 -132
  392. data/src/core/lib/security/transport/security_handshaker.h +11 -3
  393. data/src/core/lib/security/transport/{server_auth_filter.c → server_auth_filter.cc} +68 -68
  394. data/src/core/lib/security/transport/{tsi_error.c → tsi_error.cc} +1 -1
  395. data/src/core/lib/security/transport/tsi_error.h +9 -1
  396. data/src/core/lib/security/util/{json_util.c → json_util.cc} +11 -11
  397. data/src/core/lib/security/util/json_util.h +12 -4
  398. data/src/core/lib/slice/{b64.c → b64.cc} +15 -15
  399. data/src/core/lib/slice/b64.h +12 -4
  400. data/src/core/lib/slice/{percent_encoding.c → percent_encoding.cc} +15 -15
  401. data/src/core/lib/slice/percent_encoding.h +11 -3
  402. data/src/core/lib/slice/{slice.c → slice.cc} +64 -64
  403. data/src/core/lib/slice/{slice_buffer.c → slice_buffer.cc} +38 -38
  404. data/src/core/lib/slice/{slice_hash_table.c → slice_hash_table.cc} +7 -7
  405. data/src/core/lib/slice/slice_hash_table.h +19 -11
  406. data/src/core/lib/slice/{slice_intern.c → slice_intern.cc} +35 -34
  407. data/src/core/lib/slice/slice_internal.h +17 -6
  408. data/src/core/lib/slice/{slice_string_helpers.c → slice_string_helpers.cc} +9 -9
  409. data/src/core/lib/slice/slice_string_helpers.h +3 -3
  410. data/src/core/lib/support/abstract.h +29 -0
  411. data/src/core/lib/support/{alloc.c → alloc.cc} +22 -22
  412. data/src/core/lib/support/{arena.c → arena.cc} +12 -12
  413. data/src/core/lib/support/arena.h +11 -3
  414. data/src/core/lib/support/{atm.c → atm.cc} +1 -1
  415. data/src/core/lib/support/{avl.c → avl.cc} +71 -70
  416. data/src/core/lib/support/{cmdline.c → cmdline.cc} +62 -62
  417. data/src/core/lib/support/{cpu_iphone.c → cpu_iphone.cc} +2 -0
  418. data/src/core/lib/support/{cpu_linux.c → cpu_linux.cc} +10 -0
  419. data/src/core/lib/support/{cpu_posix.c → cpu_posix.cc} +27 -4
  420. data/src/core/lib/support/{cpu_windows.c → cpu_windows.cc} +1 -0
  421. data/src/core/lib/support/env.h +3 -3
  422. data/src/core/lib/support/{env_linux.c → env_linux.cc} +11 -11
  423. data/src/core/lib/support/{env_posix.c → env_posix.cc} +4 -4
  424. data/src/core/lib/support/{env_windows.c → env_windows.cc} +5 -5
  425. data/src/core/lib/support/{fork.c → fork.cc} +2 -2
  426. data/src/core/lib/support/{histogram.c → histogram.cc} +25 -26
  427. data/src/core/lib/support/{host_port.c → host_port.cc} +16 -16
  428. data/src/core/lib/support/{log.c → log.cc} +8 -8
  429. data/src/core/lib/support/{log_android.c → log_android.cc} +7 -7
  430. data/src/core/lib/support/{log_linux.c → log_linux.cc} +8 -8
  431. data/src/core/lib/support/{log_posix.c → log_posix.cc} +9 -10
  432. data/src/core/lib/support/{log_windows.c → log_windows.cc} +7 -7
  433. data/src/core/lib/support/manual_constructor.h +211 -0
  434. data/src/core/lib/support/memory.h +41 -0
  435. data/src/core/lib/support/mpscq.cc +114 -0
  436. data/src/core/lib/support/mpscq.h +45 -7
  437. data/src/core/lib/support/{murmur_hash.c → murmur_hash.cc} +9 -12
  438. data/src/core/lib/support/murmur_hash.h +9 -1
  439. data/src/core/lib/support/spinlock.h +8 -1
  440. data/src/core/lib/support/{string.c → string.cc} +56 -55
  441. data/src/core/lib/support/string.h +21 -21
  442. data/src/core/lib/support/{string_posix.c → string_posix.cc} +5 -4
  443. data/src/core/lib/support/{string_util_windows.c → string_util_windows.cc} +9 -6
  444. data/src/core/lib/support/{string_windows.c → string_windows.cc} +3 -2
  445. data/src/core/lib/support/string_windows.h +8 -0
  446. data/src/core/lib/support/{subprocess_posix.c → subprocess_posix.cc} +13 -13
  447. data/src/core/lib/support/{subprocess_windows.c → subprocess_windows.cc} +9 -9
  448. data/src/core/lib/support/{sync.c → sync.cc} +22 -22
  449. data/src/core/lib/support/{sync_posix.c → sync_posix.cc} +6 -2
  450. data/src/core/lib/support/{sync_windows.c → sync_windows.cc} +14 -14
  451. data/src/core/lib/support/{thd.c → thd.cc} +0 -0
  452. data/src/core/lib/support/{thd_posix.c → thd_posix.cc} +10 -10
  453. data/src/core/lib/support/{thd_windows.c → thd_windows.cc} +10 -10
  454. data/src/core/lib/support/{time.c → time.cc} +0 -0
  455. data/src/core/lib/support/{time_posix.c → time_posix.cc} +5 -6
  456. data/src/core/lib/support/{time_precise.c → time_precise.cc} +6 -4
  457. data/src/core/lib/support/time_precise.h +9 -1
  458. data/src/core/lib/support/{time_windows.c → time_windows.cc} +2 -3
  459. data/src/core/lib/support/{tls_pthread.c → tls_pthread.cc} +2 -2
  460. data/src/core/lib/support/tmpfile.h +1 -1
  461. data/src/core/lib/support/{tmpfile_msys.c → tmpfile_msys.cc} +2 -2
  462. data/src/core/lib/support/{tmpfile_posix.c → tmpfile_posix.cc} +7 -7
  463. data/src/core/lib/support/{tmpfile_windows.c → tmpfile_windows.cc} +2 -2
  464. data/src/core/lib/support/{wrap_memcpy.c → wrap_memcpy.cc} +4 -2
  465. data/src/core/lib/surface/{alarm.c → alarm.cc} +32 -31
  466. data/src/core/lib/surface/alarm_internal.h +10 -2
  467. data/src/core/lib/surface/{api_trace.c → api_trace.cc} +1 -1
  468. data/src/core/lib/surface/api_trace.h +2 -2
  469. data/src/core/lib/surface/{byte_buffer.c → byte_buffer.cc} +13 -13
  470. data/src/core/lib/surface/{byte_buffer_reader.c → byte_buffer_reader.cc} +9 -9
  471. data/src/core/lib/surface/{call.c → call.cc} +379 -372
  472. data/src/core/lib/surface/call.h +37 -38
  473. data/src/core/lib/surface/{call_details.c → call_details.cc} +0 -0
  474. data/src/core/lib/surface/{call_log_batch.c → call_log_batch.cc} +13 -11
  475. data/src/core/lib/surface/call_test_only.h +5 -5
  476. data/src/core/lib/surface/{channel.c → channel.cc} +94 -95
  477. data/src/core/lib/surface/channel.h +29 -21
  478. data/src/core/lib/surface/{channel_init.c → channel_init.cc} +13 -13
  479. data/src/core/lib/surface/channel_init.h +6 -6
  480. data/src/core/lib/surface/{channel_ping.c → channel_ping.cc} +12 -12
  481. data/src/core/lib/surface/{channel_stack_type.c → channel_stack_type.cc} +1 -1
  482. data/src/core/lib/surface/channel_stack_type.h +9 -1
  483. data/src/core/lib/surface/{completion_queue.c → completion_queue.cc} +416 -379
  484. data/src/core/lib/surface/completion_queue.h +29 -29
  485. data/src/core/lib/surface/{completion_queue_factory.c → completion_queue_factory.cc} +1 -1
  486. data/src/core/lib/surface/completion_queue_factory.h +8 -0
  487. data/src/core/lib/surface/{event_string.c → event_string.cc} +9 -9
  488. data/src/core/lib/surface/event_string.h +9 -1
  489. data/src/core/lib/surface/{init.c → init.cc} +16 -39
  490. data/src/core/lib/surface/init.h +8 -0
  491. data/src/core/lib/surface/{init_secure.c → init_secure.cc} +12 -25
  492. data/src/core/lib/surface/lame_client.cc +38 -40
  493. data/src/core/lib/surface/lame_client.h +8 -0
  494. data/src/core/lib/surface/{metadata_array.c → metadata_array.cc} +0 -0
  495. data/src/core/lib/surface/{server.c → server.cc} +340 -404
  496. data/src/core/lib/surface/server.h +22 -14
  497. data/src/core/lib/surface/{validate_metadata.c → validate_metadata.cc} +10 -9
  498. data/src/core/lib/surface/validate_metadata.h +10 -2
  499. data/src/core/lib/surface/{version.c → version.cc} +2 -2
  500. data/src/core/lib/transport/bdp_estimator.cc +84 -0
  501. data/src/core/lib/transport/bdp_estimator.h +67 -42
  502. data/src/core/lib/transport/{byte_stream.c → byte_stream.cc} +51 -51
  503. data/src/core/lib/transport/byte_stream.h +41 -33
  504. data/src/core/lib/transport/{connectivity_state.c → connectivity_state.cc} +36 -40
  505. data/src/core/lib/transport/connectivity_state.h +29 -21
  506. data/src/core/lib/transport/{error_utils.c → error_utils.cc} +26 -22
  507. data/src/core/lib/transport/error_utils.h +18 -6
  508. data/src/core/lib/transport/{metadata.c → metadata.cc} +92 -88
  509. data/src/core/lib/transport/metadata.h +22 -20
  510. data/src/core/lib/transport/{metadata_batch.c → metadata_batch.cc} +78 -79
  511. data/src/core/lib/transport/metadata_batch.h +46 -45
  512. data/src/core/lib/transport/pid_controller.cc +48 -0
  513. data/src/core/lib/transport/pid_controller.h +84 -32
  514. data/src/core/lib/transport/{service_config.c → service_config.cc} +66 -48
  515. data/src/core/lib/transport/service_config.h +11 -2
  516. data/src/core/lib/transport/{static_metadata.c → static_metadata.cc} +2 -2
  517. data/src/core/lib/transport/static_metadata.h +30 -23
  518. data/src/core/lib/transport/{status_conversion.c → status_conversion.cc} +4 -3
  519. data/src/core/lib/transport/status_conversion.h +12 -2
  520. data/src/core/lib/transport/{timeout_encoding.c → timeout_encoding.cc} +28 -61
  521. data/src/core/lib/transport/timeout_encoding.h +11 -2
  522. data/src/core/lib/transport/{transport.c → transport.cc} +79 -79
  523. data/src/core/lib/transport/transport.h +78 -80
  524. data/src/core/lib/transport/transport_impl.h +27 -19
  525. data/src/core/lib/transport/{transport_op_string.c → transport_op_string.cc} +32 -30
  526. data/src/core/plugin_registry/{grpc_plugin_registry.c → grpc_plugin_registry.cc} +34 -38
  527. data/src/core/tsi/{fake_transport_security.c → fake_transport_security.cc} +141 -132
  528. data/src/core/tsi/fake_transport_security.h +5 -5
  529. data/src/core/tsi/{gts_transport_security.c → gts_transport_security.cc} +4 -4
  530. data/src/core/tsi/gts_transport_security.h +11 -3
  531. data/src/core/tsi/{ssl_transport_security.c → ssl_transport_security.cc} +309 -300
  532. data/src/core/tsi/ssl_transport_security.h +25 -25
  533. data/src/core/tsi/ssl_types.h +8 -0
  534. data/src/core/tsi/{transport_security.c → transport_security.cc} +94 -87
  535. data/src/core/tsi/transport_security.h +55 -55
  536. data/src/core/tsi/{transport_security_adapter.c → transport_security_adapter.cc} +58 -55
  537. data/src/core/tsi/transport_security_adapter.h +2 -2
  538. data/src/core/tsi/{transport_security_grpc.c → transport_security_grpc.cc} +21 -21
  539. data/src/core/tsi/transport_security_grpc.h +19 -19
  540. data/src/core/tsi/transport_security_interface.h +41 -41
  541. data/src/ruby/ext/grpc/extconf.rb +4 -2
  542. data/src/ruby/ext/grpc/rb_byte_buffer.c +5 -5
  543. data/src/ruby/ext/grpc/rb_byte_buffer.h +2 -2
  544. data/src/ruby/ext/grpc/rb_call.c +41 -42
  545. data/src/ruby/ext/grpc/rb_call.h +6 -6
  546. data/src/ruby/ext/grpc/rb_call_credentials.c +30 -30
  547. data/src/ruby/ext/grpc/rb_channel.c +87 -87
  548. data/src/ruby/ext/grpc/rb_channel_credentials.c +23 -23
  549. data/src/ruby/ext/grpc/rb_completion_queue.c +11 -11
  550. data/src/ruby/ext/grpc/rb_completion_queue.h +3 -3
  551. data/src/ruby/ext/grpc/rb_compression_options.c +20 -20
  552. data/src/ruby/ext/grpc/rb_event_thread.c +14 -14
  553. data/src/ruby/ext/grpc/rb_event_thread.h +1 -1
  554. data/src/ruby/ext/grpc/rb_grpc.c +8 -8
  555. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -58
  556. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +242 -306
  557. data/src/ruby/ext/grpc/rb_server.c +23 -23
  558. data/src/ruby/ext/grpc/rb_server_credentials.c +13 -13
  559. data/src/ruby/lib/grpc/generic/rpc_server.rb +25 -12
  560. data/src/ruby/lib/grpc/version.rb +1 -1
  561. data/src/ruby/pb/grpc/health/checker.rb +14 -0
  562. data/src/ruby/spec/pb/health/checker_spec.rb +29 -0
  563. data/third_party/cares/config_freebsd/ares_config.h +502 -0
  564. data/third_party/cares/config_openbsd/ares_config.h +502 -0
  565. metadata +302 -328
  566. data/src/core/ext/census/aggregation.h +0 -51
  567. data/src/core/ext/census/base_resources.c +0 -56
  568. data/src/core/ext/census/base_resources.h +0 -24
  569. data/src/core/ext/census/census_interface.h +0 -61
  570. data/src/core/ext/census/census_rpc_stats.h +0 -86
  571. data/src/core/ext/census/context.c +0 -496
  572. data/src/core/ext/census/gen/census.pb.c +0 -161
  573. data/src/core/ext/census/gen/census.pb.h +0 -280
  574. data/src/core/ext/census/gen/trace_context.pb.c +0 -39
  575. data/src/core/ext/census/gen/trace_context.pb.h +0 -78
  576. data/src/core/ext/census/grpc_filter.c +0 -196
  577. data/src/core/ext/census/grpc_plugin.c +0 -70
  578. data/src/core/ext/census/initialize.c +0 -51
  579. data/src/core/ext/census/intrusive_hash_map.c +0 -305
  580. data/src/core/ext/census/intrusive_hash_map.h +0 -152
  581. data/src/core/ext/census/intrusive_hash_map_internal.h +0 -48
  582. data/src/core/ext/census/mlog.c +0 -586
  583. data/src/core/ext/census/mlog.h +0 -80
  584. data/src/core/ext/census/operation.c +0 -48
  585. data/src/core/ext/census/placeholders.c +0 -49
  586. data/src/core/ext/census/resource.c +0 -303
  587. data/src/core/ext/census/resource.h +0 -48
  588. data/src/core/ext/census/rpc_metric_id.h +0 -36
  589. data/src/core/ext/census/trace_context.c +0 -71
  590. data/src/core/ext/census/trace_context.h +0 -56
  591. data/src/core/ext/census/trace_label.h +0 -46
  592. data/src/core/ext/census/trace_propagation.h +0 -48
  593. data/src/core/ext/census/trace_status.h +0 -30
  594. data/src/core/ext/census/trace_string.h +0 -35
  595. data/src/core/ext/census/tracing.c +0 -55
  596. data/src/core/ext/census/tracing.h +0 -109
  597. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +0 -714
  598. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +0 -924
  599. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c +0 -60
  600. data/src/core/ext/transport/chttp2/transport/flow_control.c +0 -502
  601. data/src/core/ext/transport/chttp2/transport/writing.c +0 -534
  602. data/src/core/lib/debug/trace.c +0 -146
  603. data/src/core/lib/iomgr/closure.c +0 -219
  604. data/src/core/lib/iomgr/ev_epollex_linux.c +0 -1461
  605. data/src/core/lib/iomgr/ev_posix.c +0 -266
  606. data/src/core/lib/iomgr/exec_ctx.c +0 -113
  607. data/src/core/lib/iomgr/tcp_uv.c +0 -381
  608. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +0 -194
  609. data/src/core/lib/security/transport/security_connector.c +0 -914
  610. data/src/core/lib/support/backoff.c +0 -72
  611. data/src/core/lib/support/backoff.h +0 -56
  612. data/src/core/lib/support/mpscq.c +0 -79
  613. data/src/core/lib/support/stack_lockfree.c +0 -137
  614. data/src/core/lib/support/stack_lockfree.h +0 -38
  615. data/src/core/lib/transport/bdp_estimator.c +0 -110
  616. data/src/core/lib/transport/pid_controller.c +0 -63
@@ -22,9 +22,13 @@
22
22
  #include <grpc/support/log.h>
23
23
  #include "src/core/lib/debug/trace.h"
24
24
 
25
- #ifndef NDEBUG
25
+ extern grpc_core::DebugOnlyTraceFlag grpc_trace_alarm_refcount;
26
+
27
+ #ifdef __cplusplus
28
+ extern "C" {
29
+ #endif
26
30
 
27
- extern grpc_tracer_flag grpc_trace_alarm_refcount;
31
+ #ifndef NDEBUG
28
32
 
29
33
  #define GRPC_ALARM_REF(a, reason) alarm_ref_dbg(a, reason, __FILE__, __LINE__)
30
34
  #define GRPC_ALARM_UNREF(a, reason) \
@@ -37,4 +41,8 @@ extern grpc_tracer_flag grpc_trace_alarm_refcount;
37
41
 
38
42
  #endif /* defined(NDEBUG) */
39
43
 
44
+ #ifdef __cplusplus
45
+ }
46
+ #endif
47
+
40
48
  #endif /* GRPC_CORE_LIB_SURFACE_ALARM_INTERNAL_H */
@@ -19,4 +19,4 @@
19
19
  #include "src/core/lib/surface/api_trace.h"
20
20
  #include "src/core/lib/debug/trace.h"
21
21
 
22
- grpc_tracer_flag grpc_api_trace = GRPC_TRACER_INITIALIZER(false, "api");
22
+ grpc_core::TraceFlag grpc_api_trace(false, "api");
@@ -22,7 +22,7 @@
22
22
  #include <grpc/support/log.h>
23
23
  #include "src/core/lib/debug/trace.h"
24
24
 
25
- extern grpc_tracer_flag grpc_api_trace;
25
+ extern grpc_core::TraceFlag grpc_api_trace;
26
26
 
27
27
  /* Provide unwrapping macros because we're in C89 and variadic macros weren't
28
28
  introduced until C99... */
@@ -43,7 +43,7 @@ extern grpc_tracer_flag grpc_api_trace;
43
43
  /* Due to the limitations of C89's preprocessor, the arity of the var-arg list
44
44
  'nargs' must be specified. */
45
45
  #define GRPC_API_TRACE(fmt, nargs, args) \
46
- if (GRPC_TRACER_ON(grpc_api_trace)) { \
46
+ if (grpc_api_trace.enabled()) { \
47
47
  gpr_log(GPR_INFO, fmt GRPC_API_TRACE_UNWRAP##nargs args); \
48
48
  }
49
49
 
@@ -22,18 +22,18 @@
22
22
 
23
23
  #include "src/core/lib/slice/slice_internal.h"
24
24
 
25
- grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices,
25
+ grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slices,
26
26
  size_t nslices) {
27
27
  return grpc_raw_compressed_byte_buffer_create(slices, nslices,
28
28
  GRPC_COMPRESS_NONE);
29
29
  }
30
30
 
31
- grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
32
- grpc_slice *slices, size_t nslices,
31
+ grpc_byte_buffer* grpc_raw_compressed_byte_buffer_create(
32
+ grpc_slice* slices, size_t nslices,
33
33
  grpc_compression_algorithm compression) {
34
34
  size_t i;
35
- grpc_byte_buffer *bb =
36
- (grpc_byte_buffer *)gpr_malloc(sizeof(grpc_byte_buffer));
35
+ grpc_byte_buffer* bb =
36
+ (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer));
37
37
  bb->type = GRPC_BB_RAW;
38
38
  bb->data.raw.compression = compression;
39
39
  grpc_slice_buffer_init(&bb->data.raw.slice_buffer);
@@ -44,10 +44,10 @@ grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
44
44
  return bb;
45
45
  }
46
46
 
47
- grpc_byte_buffer *grpc_raw_byte_buffer_from_reader(
48
- grpc_byte_buffer_reader *reader) {
49
- grpc_byte_buffer *bb =
50
- (grpc_byte_buffer *)gpr_malloc(sizeof(grpc_byte_buffer));
47
+ grpc_byte_buffer* grpc_raw_byte_buffer_from_reader(
48
+ grpc_byte_buffer_reader* reader) {
49
+ grpc_byte_buffer* bb =
50
+ (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer));
51
51
  grpc_slice slice;
52
52
  bb->type = GRPC_BB_RAW;
53
53
  bb->data.raw.compression = GRPC_COMPRESS_NONE;
@@ -59,17 +59,17 @@ grpc_byte_buffer *grpc_raw_byte_buffer_from_reader(
59
59
  return bb;
60
60
  }
61
61
 
62
- grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb) {
62
+ grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) {
63
63
  switch (bb->type) {
64
64
  case GRPC_BB_RAW:
65
65
  return grpc_raw_compressed_byte_buffer_create(
66
66
  bb->data.raw.slice_buffer.slices, bb->data.raw.slice_buffer.count,
67
67
  bb->data.raw.compression);
68
68
  }
69
- GPR_UNREACHABLE_CODE(return NULL);
69
+ GPR_UNREACHABLE_CODE(return nullptr);
70
70
  }
71
71
 
72
- void grpc_byte_buffer_destroy(grpc_byte_buffer *bb) {
72
+ void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) {
73
73
  if (!bb) return;
74
74
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
75
75
  switch (bb->type) {
@@ -81,7 +81,7 @@ void grpc_byte_buffer_destroy(grpc_byte_buffer *bb) {
81
81
  grpc_exec_ctx_finish(&exec_ctx);
82
82
  }
83
83
 
84
- size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) {
84
+ size_t grpc_byte_buffer_length(grpc_byte_buffer* bb) {
85
85
  switch (bb->type) {
86
86
  case GRPC_BB_RAW:
87
87
  return bb->data.raw.slice_buffer.length;
@@ -29,7 +29,7 @@
29
29
  #include "src/core/lib/compression/message_compress.h"
30
30
  #include "src/core/lib/slice/slice_internal.h"
31
31
 
32
- static int is_compressed(grpc_byte_buffer *buffer) {
32
+ static int is_compressed(grpc_byte_buffer* buffer) {
33
33
  switch (buffer->type) {
34
34
  case GRPC_BB_RAW:
35
35
  if (buffer->data.raw.compression == GRPC_COMPRESS_NONE) {
@@ -40,8 +40,8 @@ static int is_compressed(grpc_byte_buffer *buffer) {
40
40
  return 1 /* GPR_TRUE */;
41
41
  }
42
42
 
43
- int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
44
- grpc_byte_buffer *buffer) {
43
+ int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
44
+ grpc_byte_buffer* buffer) {
45
45
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
46
46
  grpc_slice_buffer decompressed_slices_buffer;
47
47
  reader->buffer_in = buffer;
@@ -76,7 +76,7 @@ int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
76
76
  return 1;
77
77
  }
78
78
 
79
- void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) {
79
+ void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader) {
80
80
  switch (reader->buffer_in->type) {
81
81
  case GRPC_BB_RAW:
82
82
  /* keeping the same if-else structure as in the init function */
@@ -87,11 +87,11 @@ void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) {
87
87
  }
88
88
  }
89
89
 
90
- int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
91
- grpc_slice *slice) {
90
+ int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
91
+ grpc_slice* slice) {
92
92
  switch (reader->buffer_in->type) {
93
93
  case GRPC_BB_RAW: {
94
- grpc_slice_buffer *slice_buffer;
94
+ grpc_slice_buffer* slice_buffer;
95
95
  slice_buffer = &reader->buffer_out->data.raw.slice_buffer;
96
96
  if (reader->current.index < slice_buffer->count) {
97
97
  *slice = grpc_slice_ref_internal(
@@ -105,12 +105,12 @@ int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
105
105
  return 0;
106
106
  }
107
107
 
108
- grpc_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader) {
108
+ grpc_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader* reader) {
109
109
  grpc_slice in_slice;
110
110
  size_t bytes_read = 0;
111
111
  const size_t input_size = grpc_byte_buffer_length(reader->buffer_out);
112
112
  grpc_slice out_slice = GRPC_SLICE_MALLOC(input_size);
113
- uint8_t *const outbuf = GRPC_SLICE_START_PTR(out_slice); /* just an alias */
113
+ uint8_t* const outbuf = GRPC_SLICE_START_PTR(out_slice); /* just an alias */
114
114
 
115
115
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
116
116
  while (grpc_byte_buffer_reader_next(reader, &in_slice) != 0) {
@@ -41,6 +41,7 @@
41
41
  #include "src/core/lib/support/string.h"
42
42
  #include "src/core/lib/surface/api_trace.h"
43
43
  #include "src/core/lib/surface/call.h"
44
+ #include "src/core/lib/surface/call_test_only.h"
44
45
  #include "src/core/lib/surface/channel.h"
45
46
  #include "src/core/lib/surface/completion_queue.h"
46
47
  #include "src/core/lib/surface/validate_metadata.h"
@@ -85,7 +86,7 @@ typedef enum {
85
86
 
86
87
  typedef struct {
87
88
  bool is_set;
88
- grpc_error *error;
89
+ grpc_error* error;
89
90
  } received_status;
90
91
 
91
92
  static gpr_atm pack_received_status(received_status r) {
@@ -93,16 +94,17 @@ static gpr_atm pack_received_status(received_status r) {
93
94
  }
94
95
 
95
96
  static received_status unpack_received_status(gpr_atm atm) {
96
- return (atm & 1) == 0
97
- ? (received_status){.is_set = false, .error = GRPC_ERROR_NONE}
98
- : (received_status){.is_set = true,
99
- .error = (grpc_error *)(atm & ~(gpr_atm)1)};
97
+ if ((atm & 1) == 0) {
98
+ return {false, GRPC_ERROR_NONE};
99
+ } else {
100
+ return {true, (grpc_error*)(atm & ~(gpr_atm)1)};
101
+ }
100
102
  }
101
103
 
102
104
  #define MAX_ERRORS_PER_BATCH 4
103
105
 
104
106
  typedef struct batch_control {
105
- grpc_call *call;
107
+ grpc_call* call;
106
108
  /* Share memory for cq_completion and notify_tag as they are never needed
107
109
  simultaneously. Each byte used in this data structure count as six bytes
108
110
  per call, so any savings we can make are worthwhile,
@@ -118,7 +120,7 @@ typedef struct batch_control {
118
120
  \a is_closure is true, \a tag indicates a closure to be invoked;
119
121
  otherwise, \a tag indicates the tag to be used in the notification to
120
122
  be sent to the completion queue. */
121
- void *tag;
123
+ void* tag;
122
124
  bool is_closure;
123
125
  } notify_tag;
124
126
  } completion_data;
@@ -126,7 +128,7 @@ typedef struct batch_control {
126
128
  grpc_closure finish_batch;
127
129
  gpr_refcount steps_to_complete;
128
130
 
129
- grpc_error *errors[MAX_ERRORS_PER_BATCH];
131
+ grpc_error* errors[MAX_ERRORS_PER_BATCH];
130
132
  gpr_atm num_errors;
131
133
 
132
134
  grpc_transport_stream_op_batch op;
@@ -134,16 +136,16 @@ typedef struct batch_control {
134
136
 
135
137
  typedef struct {
136
138
  gpr_mu child_list_mu;
137
- grpc_call *first_child;
139
+ grpc_call* first_child;
138
140
  } parent_call;
139
141
 
140
142
  typedef struct {
141
- grpc_call *parent;
143
+ grpc_call* parent;
142
144
  /** siblings: children of the same parent form a list, and this list is
143
145
  protected under
144
146
  parent->mu */
145
- grpc_call *sibling_next;
146
- grpc_call *sibling_prev;
147
+ grpc_call* sibling_next;
148
+ grpc_call* sibling_prev;
147
149
  } child_call;
148
150
 
149
151
  #define RECV_NONE ((gpr_atm)0)
@@ -151,14 +153,14 @@ typedef struct {
151
153
 
152
154
  struct grpc_call {
153
155
  gpr_refcount ext_ref;
154
- gpr_arena *arena;
156
+ gpr_arena* arena;
155
157
  grpc_call_combiner call_combiner;
156
- grpc_completion_queue *cq;
158
+ grpc_completion_queue* cq;
157
159
  grpc_polling_entity pollent;
158
- grpc_channel *channel;
160
+ grpc_channel* channel;
159
161
  gpr_timespec start_time;
160
162
  /* parent_call* */ gpr_atm parent_call_atm;
161
- child_call *child;
163
+ child_call* child;
162
164
 
163
165
  /* client or server call */
164
166
  bool is_client;
@@ -176,7 +178,7 @@ struct grpc_call {
176
178
  gpr_atm any_ops_sent_atm;
177
179
  gpr_atm received_final_op_atm;
178
180
 
179
- batch_control *active_batches[MAX_CONCURRENT_BATCHES];
181
+ batch_control* active_batches[MAX_CONCURRENT_BATCHES];
180
182
  grpc_transport_stream_op_batch_payload stream_op_payload;
181
183
 
182
184
  /* first idx: is_receiving, second idx: is_trailing */
@@ -184,7 +186,7 @@ struct grpc_call {
184
186
 
185
187
  /* Buffered read metadata waiting to be returned to the application.
186
188
  Element 0 is initial metadata, element 1 is trailing metadata. */
187
- grpc_metadata_array *buffered_metadata[2];
189
+ grpc_metadata_array* buffered_metadata[2];
188
190
 
189
191
  grpc_metadata compression_md;
190
192
 
@@ -214,12 +216,12 @@ struct grpc_call {
214
216
  server, it's trailing metadata */
215
217
  grpc_linked_mdelem send_extra_metadata[MAX_SEND_EXTRA_METADATA_COUNT];
216
218
  int send_extra_metadata_count;
217
- gpr_timespec send_deadline;
219
+ grpc_millis send_deadline;
218
220
 
219
221
  grpc_slice_buffer_stream sending_stream;
220
222
 
221
- grpc_byte_stream *receiving_stream;
222
- grpc_byte_buffer **receiving_buffer;
223
+ grpc_byte_stream* receiving_stream;
224
+ grpc_byte_buffer** receiving_buffer;
223
225
  grpc_slice receiving_slice;
224
226
  grpc_closure receiving_slice_ready;
225
227
  grpc_closure receiving_stream_ready;
@@ -230,11 +232,12 @@ struct grpc_call {
230
232
 
231
233
  union {
232
234
  struct {
233
- grpc_status_code *status;
234
- grpc_slice *status_details;
235
+ grpc_status_code* status;
236
+ grpc_slice* status_details;
237
+ const char** error_string;
235
238
  } client;
236
239
  struct {
237
- int *cancelled;
240
+ int* cancelled;
238
241
  } server;
239
242
  } final_op;
240
243
 
@@ -257,83 +260,82 @@ struct grpc_call {
257
260
  gpr_atm recv_state;
258
261
  };
259
262
 
260
- grpc_tracer_flag grpc_call_error_trace =
261
- GRPC_TRACER_INITIALIZER(false, "call_error");
262
- grpc_tracer_flag grpc_compression_trace =
263
- GRPC_TRACER_INITIALIZER(false, "compression");
263
+ grpc_core::TraceFlag grpc_call_error_trace(false, "call_error");
264
+ grpc_core::TraceFlag grpc_compression_trace(false, "compression");
264
265
 
265
- #define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1))
266
- #define CALL_FROM_CALL_STACK(call_stack) (((grpc_call *)(call_stack)) - 1)
266
+ #define CALL_STACK_FROM_CALL(call) ((grpc_call_stack*)((call) + 1))
267
+ #define CALL_FROM_CALL_STACK(call_stack) (((grpc_call*)(call_stack)) - 1)
267
268
  #define CALL_ELEM_FROM_CALL(call, idx) \
268
269
  grpc_call_stack_element(CALL_STACK_FROM_CALL(call), idx)
269
270
  #define CALL_FROM_TOP_ELEM(top_elem) \
270
271
  CALL_FROM_CALL_STACK(grpc_call_stack_from_top_element(top_elem))
271
272
 
272
- static void execute_batch(grpc_exec_ctx *exec_ctx, grpc_call *call,
273
- grpc_transport_stream_op_batch *op,
274
- grpc_closure *start_batch_closure);
275
- static void cancel_with_status(grpc_exec_ctx *exec_ctx, grpc_call *c,
273
+ static void execute_batch(grpc_exec_ctx* exec_ctx, grpc_call* call,
274
+ grpc_transport_stream_op_batch* op,
275
+ grpc_closure* start_batch_closure);
276
+ static void cancel_with_status(grpc_exec_ctx* exec_ctx, grpc_call* c,
276
277
  status_source source, grpc_status_code status,
277
- const char *description);
278
- static void cancel_with_error(grpc_exec_ctx *exec_ctx, grpc_call *c,
279
- status_source source, grpc_error *error);
280
- static void destroy_call(grpc_exec_ctx *exec_ctx, void *call_stack,
281
- grpc_error *error);
282
- static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
283
- grpc_error *error);
284
- static void get_final_status(grpc_call *call,
278
+ const char* description);
279
+ static void cancel_with_error(grpc_exec_ctx* exec_ctx, grpc_call* c,
280
+ status_source source, grpc_error* error);
281
+ static void destroy_call(grpc_exec_ctx* exec_ctx, void* call_stack,
282
+ grpc_error* error);
283
+ static void receiving_slice_ready(grpc_exec_ctx* exec_ctx, void* bctlp,
284
+ grpc_error* error);
285
+ static void get_final_status(grpc_exec_ctx* exec_ctx, grpc_call* call,
285
286
  void (*set_value)(grpc_status_code code,
286
- void *user_data),
287
- void *set_value_user_data, grpc_slice *details);
288
- static void set_status_value_directly(grpc_status_code status, void *dest);
289
- static void set_status_from_error(grpc_exec_ctx *exec_ctx, grpc_call *call,
290
- status_source source, grpc_error *error);
291
- static void process_data_after_md(grpc_exec_ctx *exec_ctx, batch_control *bctl);
292
- static void post_batch_completion(grpc_exec_ctx *exec_ctx, batch_control *bctl);
293
- static void add_batch_error(grpc_exec_ctx *exec_ctx, batch_control *bctl,
294
- grpc_error *error, bool has_cancelled);
295
-
296
- static void add_init_error(grpc_error **composite, grpc_error *new_err) {
287
+ void* user_data),
288
+ void* set_value_user_data, grpc_slice* details,
289
+ const char** error_string);
290
+ static void set_status_value_directly(grpc_status_code status, void* dest);
291
+ static void set_status_from_error(grpc_exec_ctx* exec_ctx, grpc_call* call,
292
+ status_source source, grpc_error* error);
293
+ static void process_data_after_md(grpc_exec_ctx* exec_ctx, batch_control* bctl);
294
+ static void post_batch_completion(grpc_exec_ctx* exec_ctx, batch_control* bctl);
295
+ static void add_batch_error(grpc_exec_ctx* exec_ctx, batch_control* bctl,
296
+ grpc_error* error, bool has_cancelled);
297
+
298
+ static void add_init_error(grpc_error** composite, grpc_error* new_err) {
297
299
  if (new_err == GRPC_ERROR_NONE) return;
298
300
  if (*composite == GRPC_ERROR_NONE)
299
301
  *composite = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Call creation failed");
300
302
  *composite = grpc_error_add_child(*composite, new_err);
301
303
  }
302
304
 
303
- void *grpc_call_arena_alloc(grpc_call *call, size_t size) {
305
+ void* grpc_call_arena_alloc(grpc_call* call, size_t size) {
304
306
  return gpr_arena_alloc(call->arena, size);
305
307
  }
306
308
 
307
- static parent_call *get_or_create_parent_call(grpc_call *call) {
308
- parent_call *p = (parent_call *)gpr_atm_acq_load(&call->parent_call_atm);
309
- if (p == NULL) {
310
- p = (parent_call *)gpr_arena_alloc(call->arena, sizeof(*p));
309
+ static parent_call* get_or_create_parent_call(grpc_call* call) {
310
+ parent_call* p = (parent_call*)gpr_atm_acq_load(&call->parent_call_atm);
311
+ if (p == nullptr) {
312
+ p = (parent_call*)gpr_arena_alloc(call->arena, sizeof(*p));
311
313
  gpr_mu_init(&p->child_list_mu);
312
314
  if (!gpr_atm_rel_cas(&call->parent_call_atm, (gpr_atm)NULL, (gpr_atm)p)) {
313
315
  gpr_mu_destroy(&p->child_list_mu);
314
- p = (parent_call *)gpr_atm_acq_load(&call->parent_call_atm);
316
+ p = (parent_call*)gpr_atm_acq_load(&call->parent_call_atm);
315
317
  }
316
318
  }
317
319
  return p;
318
320
  }
319
321
 
320
- static parent_call *get_parent_call(grpc_call *call) {
321
- return (parent_call *)gpr_atm_acq_load(&call->parent_call_atm);
322
+ static parent_call* get_parent_call(grpc_call* call) {
323
+ return (parent_call*)gpr_atm_acq_load(&call->parent_call_atm);
322
324
  }
323
325
 
324
- grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
325
- const grpc_call_create_args *args,
326
- grpc_call **out_call) {
326
+ grpc_error* grpc_call_create(grpc_exec_ctx* exec_ctx,
327
+ const grpc_call_create_args* args,
328
+ grpc_call** out_call) {
327
329
  size_t i, j;
328
- grpc_error *error = GRPC_ERROR_NONE;
329
- grpc_channel_stack *channel_stack =
330
+ grpc_error* error = GRPC_ERROR_NONE;
331
+ grpc_channel_stack* channel_stack =
330
332
  grpc_channel_get_channel_stack(args->channel);
331
- grpc_call *call;
333
+ grpc_call* call;
332
334
  GPR_TIMER_BEGIN("grpc_call_create", 0);
333
335
  size_t initial_size = grpc_channel_get_call_size_estimate(args->channel);
334
336
  GRPC_STATS_INC_CALL_INITIAL_SIZE(exec_ctx, initial_size);
335
- gpr_arena *arena = gpr_arena_create(initial_size);
336
- call = (grpc_call *)gpr_arena_alloc(
337
+ gpr_arena* arena = gpr_arena_create(initial_size);
338
+ call = (grpc_call*)gpr_arena_alloc(
337
339
  arena, sizeof(grpc_call) + channel_stack->call_stack_size);
338
340
  gpr_ref_init(&call->ext_ref, 1);
339
341
  call->arena = arena;
@@ -344,7 +346,7 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
344
346
  call->start_time = gpr_now(GPR_CLOCK_MONOTONIC);
345
347
  /* Always support no compression */
346
348
  GPR_BITSET(&call->encodings_accepted_by_peer, GRPC_COMPRESS_NONE);
347
- call->is_client = args->server_transport_data == NULL;
349
+ call->is_client = args->server_transport_data == nullptr;
348
350
  if (call->is_client) {
349
351
  GRPC_STATS_INC_CLIENT_CALLS_CREATED(exec_ctx);
350
352
  } else {
@@ -370,32 +372,28 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
370
372
  }
371
373
  for (i = 0; i < 2; i++) {
372
374
  for (j = 0; j < 2; j++) {
373
- call->metadata_batch[i][j].deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
375
+ call->metadata_batch[i][j].deadline = GRPC_MILLIS_INF_FUTURE;
374
376
  }
375
377
  }
376
- gpr_timespec send_deadline =
377
- gpr_convert_clock_type(args->send_deadline, GPR_CLOCK_MONOTONIC);
378
+ grpc_millis send_deadline = args->send_deadline;
378
379
 
379
380
  bool immediately_cancel = false;
380
381
 
381
- if (args->parent != NULL) {
382
- child_call *cc = call->child =
383
- (child_call *)gpr_arena_alloc(arena, sizeof(child_call));
382
+ if (args->parent != nullptr) {
383
+ child_call* cc = call->child =
384
+ (child_call*)gpr_arena_alloc(arena, sizeof(child_call));
384
385
  call->child->parent = args->parent;
385
386
 
386
387
  GRPC_CALL_INTERNAL_REF(args->parent, "child");
387
388
  GPR_ASSERT(call->is_client);
388
389
  GPR_ASSERT(!args->parent->is_client);
389
390
 
390
- parent_call *pc = get_or_create_parent_call(args->parent);
391
+ parent_call* pc = get_or_create_parent_call(args->parent);
391
392
 
392
393
  gpr_mu_lock(&pc->child_list_mu);
393
394
 
394
395
  if (args->propagation_mask & GRPC_PROPAGATE_DEADLINE) {
395
- send_deadline = gpr_time_min(
396
- gpr_convert_clock_type(send_deadline,
397
- args->parent->send_deadline.clock_type),
398
- args->parent->send_deadline);
396
+ send_deadline = GPR_MIN(send_deadline, args->parent->send_deadline);
399
397
  }
400
398
  /* for now GRPC_PROPAGATE_TRACING_CONTEXT *MUST* be passed with
401
399
  * GRPC_PROPAGATE_STATS_CONTEXT */
@@ -409,7 +407,7 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
409
407
  }
410
408
  grpc_call_context_set(call, GRPC_CONTEXT_TRACING,
411
409
  args->parent->context[GRPC_CONTEXT_TRACING].value,
412
- NULL);
410
+ nullptr);
413
411
  } else if (args->propagation_mask & GRPC_PROPAGATE_CENSUS_STATS_CONTEXT) {
414
412
  add_init_error(&error, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
415
413
  "Census context propagation requested "
@@ -422,7 +420,7 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
422
420
  }
423
421
  }
424
422
 
425
- if (pc->first_child == NULL) {
423
+ if (pc->first_child == nullptr) {
426
424
  pc->first_child = call;
427
425
  cc->sibling_next = cc->sibling_prev = call;
428
426
  } else {
@@ -439,15 +437,14 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
439
437
 
440
438
  GRPC_CHANNEL_INTERNAL_REF(args->channel, "call");
441
439
  /* initial refcount dropped by grpc_call_unref */
442
- grpc_call_element_args call_args = {
443
- .call_stack = CALL_STACK_FROM_CALL(call),
444
- .server_transport_data = args->server_transport_data,
445
- .context = call->context,
446
- .path = path,
447
- .start_time = call->start_time,
448
- .deadline = send_deadline,
449
- .arena = call->arena,
450
- .call_combiner = &call->call_combiner};
440
+ grpc_call_element_args call_args = {CALL_STACK_FROM_CALL(call),
441
+ args->server_transport_data,
442
+ call->context,
443
+ path,
444
+ call->start_time,
445
+ send_deadline,
446
+ call->arena,
447
+ &call->call_combiner};
451
448
  add_init_error(&error, grpc_call_stack_init(exec_ctx, channel_stack, 1,
452
449
  destroy_call, call, &call_args));
453
450
  if (error != GRPC_ERROR_NONE) {
@@ -458,15 +455,15 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
458
455
  cancel_with_error(exec_ctx, call, STATUS_FROM_API_OVERRIDE,
459
456
  GRPC_ERROR_CANCELLED);
460
457
  }
461
- if (args->cq != NULL) {
458
+ if (args->cq != nullptr) {
462
459
  GPR_ASSERT(
463
- args->pollset_set_alternative == NULL &&
460
+ args->pollset_set_alternative == nullptr &&
464
461
  "Only one of 'cq' and 'pollset_set_alternative' should be non-NULL.");
465
462
  GRPC_CQ_INTERNAL_REF(args->cq, "bind");
466
463
  call->pollent =
467
464
  grpc_polling_entity_create_from_pollset(grpc_cq_pollset(args->cq));
468
465
  }
469
- if (args->pollset_set_alternative != NULL) {
466
+ if (args->pollset_set_alternative != nullptr) {
470
467
  call->pollent = grpc_polling_entity_create_from_pollset_set(
471
468
  args->pollset_set_alternative);
472
469
  }
@@ -481,11 +478,11 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
481
478
  return error;
482
479
  }
483
480
 
484
- void grpc_call_set_completion_queue(grpc_exec_ctx *exec_ctx, grpc_call *call,
485
- grpc_completion_queue *cq) {
481
+ void grpc_call_set_completion_queue(grpc_exec_ctx* exec_ctx, grpc_call* call,
482
+ grpc_completion_queue* cq) {
486
483
  GPR_ASSERT(cq);
487
484
 
488
- if (grpc_polling_entity_pollset_set(&call->pollent) != NULL) {
485
+ if (grpc_polling_entity_pollset_set(&call->pollent) != nullptr) {
489
486
  gpr_log(GPR_ERROR, "A pollset_set is already registered for this call.");
490
487
  abort();
491
488
  }
@@ -498,44 +495,44 @@ void grpc_call_set_completion_queue(grpc_exec_ctx *exec_ctx, grpc_call *call,
498
495
 
499
496
  #ifndef NDEBUG
500
497
  #define REF_REASON reason
501
- #define REF_ARG , const char *reason
498
+ #define REF_ARG , const char* reason
502
499
  #else
503
500
  #define REF_REASON ""
504
501
  #define REF_ARG
505
502
  #endif
506
- void grpc_call_internal_ref(grpc_call *c REF_ARG) {
503
+ void grpc_call_internal_ref(grpc_call* c REF_ARG) {
507
504
  GRPC_CALL_STACK_REF(CALL_STACK_FROM_CALL(c), REF_REASON);
508
505
  }
509
- void grpc_call_internal_unref(grpc_exec_ctx *exec_ctx, grpc_call *c REF_ARG) {
506
+ void grpc_call_internal_unref(grpc_exec_ctx* exec_ctx, grpc_call* c REF_ARG) {
510
507
  GRPC_CALL_STACK_UNREF(exec_ctx, CALL_STACK_FROM_CALL(c), REF_REASON);
511
508
  }
512
509
 
513
- static void release_call(grpc_exec_ctx *exec_ctx, void *call,
514
- grpc_error *error) {
515
- grpc_call *c = (grpc_call *)call;
516
- grpc_channel *channel = c->channel;
510
+ static void release_call(grpc_exec_ctx* exec_ctx, void* call,
511
+ grpc_error* error) {
512
+ grpc_call* c = (grpc_call*)call;
513
+ grpc_channel* channel = c->channel;
517
514
  grpc_call_combiner_destroy(&c->call_combiner);
518
- gpr_free((char *)c->peer_string);
515
+ gpr_free((char*)c->peer_string);
519
516
  grpc_channel_update_call_size_estimate(channel, gpr_arena_destroy(c->arena));
520
517
  GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, channel, "call");
521
518
  }
522
519
 
523
- static void set_status_value_directly(grpc_status_code status, void *dest);
524
- static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
525
- grpc_error *error) {
520
+ static void set_status_value_directly(grpc_status_code status, void* dest);
521
+ static void destroy_call(grpc_exec_ctx* exec_ctx, void* call,
522
+ grpc_error* error) {
526
523
  size_t i;
527
524
  int ii;
528
- grpc_call *c = (grpc_call *)call;
525
+ grpc_call* c = (grpc_call*)call;
529
526
  GPR_TIMER_BEGIN("destroy_call", 0);
530
527
  for (i = 0; i < 2; i++) {
531
528
  grpc_metadata_batch_destroy(
532
529
  exec_ctx, &c->metadata_batch[1 /* is_receiving */][i /* is_initial */]);
533
530
  }
534
- if (c->receiving_stream != NULL) {
531
+ if (c->receiving_stream != nullptr) {
535
532
  grpc_byte_stream_destroy(exec_ctx, c->receiving_stream);
536
533
  }
537
- parent_call *pc = get_parent_call(c);
538
- if (pc != NULL) {
534
+ parent_call* pc = get_parent_call(c);
535
+ if (pc != nullptr) {
539
536
  gpr_mu_destroy(&pc->child_list_mu);
540
537
  }
541
538
  for (ii = 0; ii < c->send_extra_metadata_count; ii++) {
@@ -550,8 +547,9 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
550
547
  GRPC_CQ_INTERNAL_UNREF(exec_ctx, c->cq, "bind");
551
548
  }
552
549
 
553
- get_final_status(c, set_status_value_directly, &c->final_info.final_status,
554
- NULL);
550
+ get_final_status(exec_ctx, c, set_status_value_directly,
551
+ &c->final_info.final_status, nullptr,
552
+ c->final_info.error_string);
555
553
  c->final_info.stats.latency =
556
554
  gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), c->start_time);
557
555
 
@@ -566,24 +564,24 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
566
564
  GPR_TIMER_END("destroy_call", 0);
567
565
  }
568
566
 
569
- void grpc_call_ref(grpc_call *c) { gpr_ref(&c->ext_ref); }
567
+ void grpc_call_ref(grpc_call* c) { gpr_ref(&c->ext_ref); }
570
568
 
571
- void grpc_call_unref(grpc_call *c) {
569
+ void grpc_call_unref(grpc_call* c) {
572
570
  if (!gpr_unref(&c->ext_ref)) return;
573
571
 
574
- child_call *cc = c->child;
572
+ child_call* cc = c->child;
575
573
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
576
574
 
577
575
  GPR_TIMER_BEGIN("grpc_call_unref", 0);
578
576
  GRPC_API_TRACE("grpc_call_unref(c=%p)", 1, (c));
579
577
 
580
578
  if (cc) {
581
- parent_call *pc = get_parent_call(cc->parent);
579
+ parent_call* pc = get_parent_call(cc->parent);
582
580
  gpr_mu_lock(&pc->child_list_mu);
583
581
  if (c == pc->first_child) {
584
582
  pc->first_child = cc->sibling_next;
585
583
  if (c == pc->first_child) {
586
- pc->first_child = NULL;
584
+ pc->first_child = nullptr;
587
585
  }
588
586
  }
589
587
  cc->sibling_prev->child->sibling_next = cc->sibling_next;
@@ -604,14 +602,15 @@ void grpc_call_unref(grpc_call *c) {
604
602
  // effect of scheduling the previously set cancellation closure, if
605
603
  // any, so that it can release any internal references it may be
606
604
  // holding to the call stack.
607
- grpc_call_combiner_set_notify_on_cancel(&exec_ctx, &c->call_combiner, NULL);
605
+ grpc_call_combiner_set_notify_on_cancel(&exec_ctx, &c->call_combiner,
606
+ nullptr);
608
607
  }
609
608
  GRPC_CALL_INTERNAL_UNREF(&exec_ctx, c, "destroy");
610
609
  grpc_exec_ctx_finish(&exec_ctx);
611
610
  GPR_TIMER_END("grpc_call_unref", 0);
612
611
  }
613
612
 
614
- grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved) {
613
+ grpc_call_error grpc_call_cancel(grpc_call* call, void* reserved) {
615
614
  GRPC_API_TRACE("grpc_call_cancel(call=%p, reserved=%p)", 2, (call, reserved));
616
615
  GPR_ASSERT(!reserved);
617
616
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@@ -623,12 +622,12 @@ grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved) {
623
622
 
624
623
  // This is called via the call combiner to start sending a batch down
625
624
  // the filter stack.
626
- static void execute_batch_in_call_combiner(grpc_exec_ctx *exec_ctx, void *arg,
627
- grpc_error *ignored) {
628
- grpc_transport_stream_op_batch *batch = (grpc_transport_stream_op_batch *)arg;
629
- grpc_call *call = (grpc_call *)batch->handler_private.extra_arg;
625
+ static void execute_batch_in_call_combiner(grpc_exec_ctx* exec_ctx, void* arg,
626
+ grpc_error* ignored) {
627
+ grpc_transport_stream_op_batch* batch = (grpc_transport_stream_op_batch*)arg;
628
+ grpc_call* call = (grpc_call*)batch->handler_private.extra_arg;
630
629
  GPR_TIMER_BEGIN("execute_batch", 0);
631
- grpc_call_element *elem = CALL_ELEM_FROM_CALL(call, 0);
630
+ grpc_call_element* elem = CALL_ELEM_FROM_CALL(call, 0);
632
631
  GRPC_CALL_LOG_OP(GPR_INFO, elem, batch);
633
632
  elem->filter->start_transport_stream_op_batch(exec_ctx, elem, batch);
634
633
  GPR_TIMER_END("execute_batch", 0);
@@ -636,9 +635,9 @@ static void execute_batch_in_call_combiner(grpc_exec_ctx *exec_ctx, void *arg,
636
635
 
637
636
  // start_batch_closure points to a caller-allocated closure to be used
638
637
  // for entering the call combiner.
639
- static void execute_batch(grpc_exec_ctx *exec_ctx, grpc_call *call,
640
- grpc_transport_stream_op_batch *batch,
641
- grpc_closure *start_batch_closure) {
638
+ static void execute_batch(grpc_exec_ctx* exec_ctx, grpc_call* call,
639
+ grpc_transport_stream_op_batch* batch,
640
+ grpc_closure* start_batch_closure) {
642
641
  batch->handler_private.extra_arg = call;
643
642
  GRPC_CLOSURE_INIT(start_batch_closure, execute_batch_in_call_combiner, batch,
644
643
  grpc_schedule_on_exec_ctx);
@@ -646,15 +645,15 @@ static void execute_batch(grpc_exec_ctx *exec_ctx, grpc_call *call,
646
645
  GRPC_ERROR_NONE, "executing batch");
647
646
  }
648
647
 
649
- char *grpc_call_get_peer(grpc_call *call) {
650
- char *peer_string = (char *)gpr_atm_acq_load(&call->peer_string);
651
- if (peer_string != NULL) return gpr_strdup(peer_string);
648
+ char* grpc_call_get_peer(grpc_call* call) {
649
+ char* peer_string = (char*)gpr_atm_acq_load(&call->peer_string);
650
+ if (peer_string != nullptr) return gpr_strdup(peer_string);
652
651
  peer_string = grpc_channel_get_target(call->channel);
653
- if (peer_string != NULL) return peer_string;
652
+ if (peer_string != nullptr) return peer_string;
654
653
  return gpr_strdup("unknown");
655
654
  }
656
655
 
657
- grpc_call *grpc_call_from_top_element(grpc_call_element *elem) {
656
+ grpc_call* grpc_call_from_top_element(grpc_call_element* elem) {
658
657
  return CALL_FROM_TOP_ELEM(elem);
659
658
  }
660
659
 
@@ -662,16 +661,16 @@ grpc_call *grpc_call_from_top_element(grpc_call_element *elem) {
662
661
  * CANCELLATION
663
662
  */
664
663
 
665
- grpc_call_error grpc_call_cancel_with_status(grpc_call *c,
664
+ grpc_call_error grpc_call_cancel_with_status(grpc_call* c,
666
665
  grpc_status_code status,
667
- const char *description,
668
- void *reserved) {
666
+ const char* description,
667
+ void* reserved) {
669
668
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
670
669
  GRPC_API_TRACE(
671
670
  "grpc_call_cancel_with_status("
672
671
  "c=%p, status=%d, description=%s, reserved=%p)",
673
672
  4, (c, (int)status, description, reserved));
674
- GPR_ASSERT(reserved == NULL);
673
+ GPR_ASSERT(reserved == nullptr);
675
674
  cancel_with_status(&exec_ctx, c, STATUS_FROM_API_OVERRIDE, status,
676
675
  description);
677
676
  grpc_exec_ctx_finish(&exec_ctx);
@@ -679,24 +678,24 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call *c,
679
678
  }
680
679
 
681
680
  typedef struct {
682
- grpc_call *call;
681
+ grpc_call* call;
683
682
  grpc_closure start_batch;
684
683
  grpc_closure finish_batch;
685
684
  } cancel_state;
686
685
 
687
686
  // The on_complete callback used when sending a cancel_stream batch down
688
687
  // the filter stack. Yields the call combiner when the batch is done.
689
- static void done_termination(grpc_exec_ctx *exec_ctx, void *arg,
690
- grpc_error *error) {
691
- cancel_state *state = (cancel_state *)arg;
688
+ static void done_termination(grpc_exec_ctx* exec_ctx, void* arg,
689
+ grpc_error* error) {
690
+ cancel_state* state = (cancel_state*)arg;
692
691
  GRPC_CALL_COMBINER_STOP(exec_ctx, &state->call->call_combiner,
693
692
  "on_complete for cancel_stream op");
694
693
  GRPC_CALL_INTERNAL_UNREF(exec_ctx, state->call, "termination");
695
694
  gpr_free(state);
696
695
  }
697
696
 
698
- static void cancel_with_error(grpc_exec_ctx *exec_ctx, grpc_call *c,
699
- status_source source, grpc_error *error) {
697
+ static void cancel_with_error(grpc_exec_ctx* exec_ctx, grpc_call* c,
698
+ status_source source, grpc_error* error) {
700
699
  GRPC_CALL_INTERNAL_REF(c, "termination");
701
700
  // Inform the call combiner of the cancellation, so that it can cancel
702
701
  // any in-flight asynchronous actions that may be holding the call
@@ -704,19 +703,19 @@ static void cancel_with_error(grpc_exec_ctx *exec_ctx, grpc_call *c,
704
703
  // down the filter stack in a timely manner.
705
704
  grpc_call_combiner_cancel(exec_ctx, &c->call_combiner, GRPC_ERROR_REF(error));
706
705
  set_status_from_error(exec_ctx, c, source, GRPC_ERROR_REF(error));
707
- cancel_state *state = (cancel_state *)gpr_malloc(sizeof(*state));
706
+ cancel_state* state = (cancel_state*)gpr_malloc(sizeof(*state));
708
707
  state->call = c;
709
708
  GRPC_CLOSURE_INIT(&state->finish_batch, done_termination, state,
710
709
  grpc_schedule_on_exec_ctx);
711
- grpc_transport_stream_op_batch *op =
710
+ grpc_transport_stream_op_batch* op =
712
711
  grpc_make_transport_stream_op(&state->finish_batch);
713
712
  op->cancel_stream = true;
714
713
  op->payload->cancel_stream.cancel_error = error;
715
714
  execute_batch(exec_ctx, c, op, &state->start_batch);
716
715
  }
717
716
 
718
- static grpc_error *error_from_status(grpc_status_code status,
719
- const char *description) {
717
+ static grpc_error* error_from_status(grpc_status_code status,
718
+ const char* description) {
720
719
  // copying 'description' is needed to ensure the grpc_call_cancel_with_status
721
720
  // guarantee that can be short-lived.
722
721
  return grpc_error_set_int(
@@ -726,9 +725,9 @@ static grpc_error *error_from_status(grpc_status_code status,
726
725
  GRPC_ERROR_INT_GRPC_STATUS, status);
727
726
  }
728
727
 
729
- static void cancel_with_status(grpc_exec_ctx *exec_ctx, grpc_call *c,
728
+ static void cancel_with_status(grpc_exec_ctx* exec_ctx, grpc_call* c,
730
729
  status_source source, grpc_status_code status,
731
- const char *description) {
730
+ const char* description) {
732
731
  cancel_with_error(exec_ctx, c, source,
733
732
  error_from_status(status, description));
734
733
  }
@@ -738,33 +737,36 @@ static void cancel_with_status(grpc_exec_ctx *exec_ctx, grpc_call *c,
738
737
  */
739
738
 
740
739
  static bool get_final_status_from(
741
- grpc_call *call, grpc_error *error, bool allow_ok_status,
742
- void (*set_value)(grpc_status_code code, void *user_data),
743
- void *set_value_user_data, grpc_slice *details) {
740
+ grpc_exec_ctx* exec_ctx, grpc_call* call, grpc_error* error,
741
+ bool allow_ok_status,
742
+ void (*set_value)(grpc_status_code code, void* user_data),
743
+ void* set_value_user_data, grpc_slice* details, const char** error_string) {
744
744
  grpc_status_code code;
745
745
  grpc_slice slice = grpc_empty_slice();
746
- grpc_error_get_status(error, call->send_deadline, &code, &slice, NULL);
746
+ grpc_error_get_status(exec_ctx, error, call->send_deadline, &code, &slice,
747
+ nullptr, error_string);
747
748
  if (code == GRPC_STATUS_OK && !allow_ok_status) {
748
749
  return false;
749
750
  }
750
751
 
751
752
  set_value(code, set_value_user_data);
752
- if (details != NULL) {
753
+ if (details != nullptr) {
753
754
  *details = grpc_slice_ref_internal(slice);
754
755
  }
755
756
  return true;
756
757
  }
757
758
 
758
- static void get_final_status(grpc_call *call,
759
+ static void get_final_status(grpc_exec_ctx* exec_ctx, grpc_call* call,
759
760
  void (*set_value)(grpc_status_code code,
760
- void *user_data),
761
- void *set_value_user_data, grpc_slice *details) {
761
+ void* user_data),
762
+ void* set_value_user_data, grpc_slice* details,
763
+ const char** error_string) {
762
764
  int i;
763
765
  received_status status[STATUS_SOURCE_COUNT];
764
766
  for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
765
767
  status[i] = unpack_received_status(gpr_atm_acq_load(&call->status[i]));
766
768
  }
767
- if (GRPC_TRACER_ON(grpc_call_error_trace)) {
769
+ if (grpc_call_error_trace.enabled()) {
768
770
  gpr_log(GPR_DEBUG, "get_final_status %s", call->is_client ? "CLI" : "SVR");
769
771
  for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
770
772
  if (status[i].is_set) {
@@ -780,8 +782,9 @@ static void get_final_status(grpc_call *call,
780
782
  for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
781
783
  if (status[i].is_set &&
782
784
  grpc_error_has_clear_grpc_status(status[i].error)) {
783
- if (get_final_status_from(call, status[i].error, allow_ok_status != 0,
784
- set_value, set_value_user_data, details)) {
785
+ if (get_final_status_from(exec_ctx, call, status[i].error,
786
+ allow_ok_status != 0, set_value,
787
+ set_value_user_data, details, error_string)) {
785
788
  return;
786
789
  }
787
790
  }
@@ -789,8 +792,9 @@ static void get_final_status(grpc_call *call,
789
792
  /* If no clearly defined status exists, search for 'anything' */
790
793
  for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
791
794
  if (status[i].is_set) {
792
- if (get_final_status_from(call, status[i].error, allow_ok_status != 0,
793
- set_value, set_value_user_data, details)) {
795
+ if (get_final_status_from(exec_ctx, call, status[i].error,
796
+ allow_ok_status != 0, set_value,
797
+ set_value_user_data, details, error_string)) {
794
798
  return;
795
799
  }
796
800
  }
@@ -804,13 +808,11 @@ static void get_final_status(grpc_call *call,
804
808
  }
805
809
  }
806
810
 
807
- static void set_status_from_error(grpc_exec_ctx *exec_ctx, grpc_call *call,
808
- status_source source, grpc_error *error) {
811
+ static void set_status_from_error(grpc_exec_ctx* exec_ctx, grpc_call* call,
812
+ status_source source, grpc_error* error) {
809
813
  if (!gpr_atm_rel_cas(&call->status[source],
810
- pack_received_status((received_status){
811
- .is_set = false, .error = GRPC_ERROR_NONE}),
812
- pack_received_status((received_status){
813
- .is_set = true, .error = error}))) {
814
+ pack_received_status({false, GRPC_ERROR_NONE}),
815
+ pack_received_status({true, error}))) {
814
816
  GRPC_ERROR_UNREF(error);
815
817
  }
816
818
  }
@@ -820,56 +822,56 @@ static void set_status_from_error(grpc_exec_ctx *exec_ctx, grpc_call *call,
820
822
  */
821
823
 
822
824
  static void set_incoming_compression_algorithm(
823
- grpc_call *call, grpc_compression_algorithm algo) {
825
+ grpc_call* call, grpc_compression_algorithm algo) {
824
826
  GPR_ASSERT(algo < GRPC_COMPRESS_ALGORITHMS_COUNT);
825
827
  call->incoming_compression_algorithm = algo;
826
828
  }
827
829
 
828
830
  static void set_incoming_stream_compression_algorithm(
829
- grpc_call *call, grpc_stream_compression_algorithm algo) {
831
+ grpc_call* call, grpc_stream_compression_algorithm algo) {
830
832
  GPR_ASSERT(algo < GRPC_STREAM_COMPRESS_ALGORITHMS_COUNT);
831
833
  call->incoming_stream_compression_algorithm = algo;
832
834
  }
833
835
 
834
836
  grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm(
835
- grpc_call *call) {
837
+ grpc_call* call) {
836
838
  grpc_compression_algorithm algorithm;
837
839
  algorithm = call->incoming_compression_algorithm;
838
840
  return algorithm;
839
841
  }
840
842
 
841
843
  static grpc_compression_algorithm compression_algorithm_for_level_locked(
842
- grpc_call *call, grpc_compression_level level) {
844
+ grpc_call* call, grpc_compression_level level) {
843
845
  return grpc_compression_algorithm_for_level(level,
844
846
  call->encodings_accepted_by_peer);
845
847
  }
846
848
 
847
849
  static grpc_stream_compression_algorithm
848
850
  stream_compression_algorithm_for_level_locked(
849
- grpc_call *call, grpc_stream_compression_level level) {
851
+ grpc_call* call, grpc_stream_compression_level level) {
850
852
  return grpc_stream_compression_algorithm_for_level(
851
853
  level, call->stream_encodings_accepted_by_peer);
852
854
  }
853
855
 
854
- uint32_t grpc_call_test_only_get_message_flags(grpc_call *call) {
856
+ uint32_t grpc_call_test_only_get_message_flags(grpc_call* call) {
855
857
  uint32_t flags;
856
858
  flags = call->test_only_last_message_flags;
857
859
  return flags;
858
860
  }
859
861
 
860
- static void destroy_encodings_accepted_by_peer(void *p) { return; }
862
+ static void destroy_encodings_accepted_by_peer(void* p) { return; }
861
863
 
862
- static void set_encodings_accepted_by_peer(grpc_exec_ctx *exec_ctx,
863
- grpc_call *call, grpc_mdelem mdel) {
864
+ static void set_encodings_accepted_by_peer(grpc_exec_ctx* exec_ctx,
865
+ grpc_call* call, grpc_mdelem mdel) {
864
866
  size_t i;
865
867
  grpc_compression_algorithm algorithm;
866
868
  grpc_slice_buffer accept_encoding_parts;
867
869
  grpc_slice accept_encoding_slice;
868
- void *accepted_user_data;
870
+ void* accepted_user_data;
869
871
 
870
872
  accepted_user_data =
871
873
  grpc_mdelem_get_user_data(mdel, destroy_encodings_accepted_by_peer);
872
- if (accepted_user_data != NULL) {
874
+ if (accepted_user_data != nullptr) {
873
875
  call->encodings_accepted_by_peer =
874
876
  (uint32_t)(((uintptr_t)accepted_user_data) - 1);
875
877
  return;
@@ -889,7 +891,7 @@ static void set_encodings_accepted_by_peer(grpc_exec_ctx *exec_ctx,
889
891
  &algorithm)) {
890
892
  GPR_BITSET(&call->encodings_accepted_by_peer, algorithm);
891
893
  } else {
892
- char *accept_encoding_entry_str =
894
+ char* accept_encoding_entry_str =
893
895
  grpc_slice_to_c_string(accept_encoding_entry_slice);
894
896
  gpr_log(GPR_ERROR,
895
897
  "Invalid entry in accept encoding metadata: '%s'. Ignoring.",
@@ -902,21 +904,21 @@ static void set_encodings_accepted_by_peer(grpc_exec_ctx *exec_ctx,
902
904
 
903
905
  grpc_mdelem_set_user_data(
904
906
  mdel, destroy_encodings_accepted_by_peer,
905
- (void *)(((uintptr_t)call->encodings_accepted_by_peer) + 1));
907
+ (void*)(((uintptr_t)call->encodings_accepted_by_peer) + 1));
906
908
  }
907
909
 
908
- static void set_stream_encodings_accepted_by_peer(grpc_exec_ctx *exec_ctx,
909
- grpc_call *call,
910
+ static void set_stream_encodings_accepted_by_peer(grpc_exec_ctx* exec_ctx,
911
+ grpc_call* call,
910
912
  grpc_mdelem mdel) {
911
913
  size_t i;
912
914
  grpc_stream_compression_algorithm algorithm;
913
915
  grpc_slice_buffer accept_encoding_parts;
914
916
  grpc_slice accept_encoding_slice;
915
- void *accepted_user_data;
917
+ void* accepted_user_data;
916
918
 
917
919
  accepted_user_data =
918
920
  grpc_mdelem_get_user_data(mdel, destroy_encodings_accepted_by_peer);
919
- if (accepted_user_data != NULL) {
921
+ if (accepted_user_data != nullptr) {
920
922
  call->stream_encodings_accepted_by_peer =
921
923
  (uint32_t)(((uintptr_t)accepted_user_data) - 1);
922
924
  return;
@@ -935,7 +937,7 @@ static void set_stream_encodings_accepted_by_peer(grpc_exec_ctx *exec_ctx,
935
937
  &algorithm)) {
936
938
  GPR_BITSET(&call->stream_encodings_accepted_by_peer, algorithm);
937
939
  } else {
938
- char *accept_encoding_entry_str =
940
+ char* accept_encoding_entry_str =
939
941
  grpc_slice_to_c_string(accept_encoding_entry_slice);
940
942
  gpr_log(GPR_ERROR,
941
943
  "Invalid entry in accept encoding metadata: '%s'. Ignoring.",
@@ -948,52 +950,52 @@ static void set_stream_encodings_accepted_by_peer(grpc_exec_ctx *exec_ctx,
948
950
 
949
951
  grpc_mdelem_set_user_data(
950
952
  mdel, destroy_encodings_accepted_by_peer,
951
- (void *)(((uintptr_t)call->stream_encodings_accepted_by_peer) + 1));
953
+ (void*)(((uintptr_t)call->stream_encodings_accepted_by_peer) + 1));
952
954
  }
953
955
 
954
- uint32_t grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call *call) {
956
+ uint32_t grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call* call) {
955
957
  uint32_t encodings_accepted_by_peer;
956
958
  encodings_accepted_by_peer = call->encodings_accepted_by_peer;
957
959
  return encodings_accepted_by_peer;
958
960
  }
959
961
 
960
962
  uint32_t grpc_call_test_only_get_stream_encodings_accepted_by_peer(
961
- grpc_call *call) {
963
+ grpc_call* call) {
962
964
  uint32_t stream_encodings_accepted_by_peer;
963
965
  stream_encodings_accepted_by_peer = call->stream_encodings_accepted_by_peer;
964
966
  return stream_encodings_accepted_by_peer;
965
967
  }
966
968
 
967
969
  grpc_stream_compression_algorithm
968
- grpc_call_test_only_get_incoming_stream_encodings(grpc_call *call) {
970
+ grpc_call_test_only_get_incoming_stream_encodings(grpc_call* call) {
969
971
  return call->incoming_stream_compression_algorithm;
970
972
  }
971
973
 
972
- static grpc_linked_mdelem *linked_from_md(const grpc_metadata *md) {
973
- return (grpc_linked_mdelem *)&md->internal_data;
974
+ static grpc_linked_mdelem* linked_from_md(const grpc_metadata* md) {
975
+ return (grpc_linked_mdelem*)&md->internal_data;
974
976
  }
975
977
 
976
- static grpc_metadata *get_md_elem(grpc_metadata *metadata,
977
- grpc_metadata *additional_metadata, int i,
978
+ static grpc_metadata* get_md_elem(grpc_metadata* metadata,
979
+ grpc_metadata* additional_metadata, int i,
978
980
  int count) {
979
- grpc_metadata *res =
981
+ grpc_metadata* res =
980
982
  i < count ? &metadata[i] : &additional_metadata[i - count];
981
983
  GPR_ASSERT(res);
982
984
  return res;
983
985
  }
984
986
 
985
987
  static int prepare_application_metadata(
986
- grpc_exec_ctx *exec_ctx, grpc_call *call, int count,
987
- grpc_metadata *metadata, int is_trailing, int prepend_extra_metadata,
988
- grpc_metadata *additional_metadata, int additional_metadata_count) {
988
+ grpc_exec_ctx* exec_ctx, grpc_call* call, int count,
989
+ grpc_metadata* metadata, int is_trailing, int prepend_extra_metadata,
990
+ grpc_metadata* additional_metadata, int additional_metadata_count) {
989
991
  int total_count = count + additional_metadata_count;
990
992
  int i;
991
- grpc_metadata_batch *batch =
993
+ grpc_metadata_batch* batch =
992
994
  &call->metadata_batch[0 /* is_receiving */][is_trailing];
993
995
  for (i = 0; i < total_count; i++) {
994
- const grpc_metadata *md =
996
+ const grpc_metadata* md =
995
997
  get_md_elem(metadata, additional_metadata, i, count);
996
- grpc_linked_mdelem *l = linked_from_md(md);
998
+ grpc_linked_mdelem* l = linked_from_md(md);
997
999
  GPR_ASSERT(sizeof(grpc_linked_mdelem) == sizeof(md->internal_data));
998
1000
  if (!GRPC_LOG_IF_ERROR("validate_metadata",
999
1001
  grpc_validate_header_key_is_legal(md->key))) {
@@ -1004,13 +1006,13 @@ static int prepare_application_metadata(
1004
1006
  grpc_validate_header_nonbin_value_is_legal(md->value))) {
1005
1007
  break;
1006
1008
  }
1007
- l->md = grpc_mdelem_from_grpc_metadata(exec_ctx, (grpc_metadata *)md);
1009
+ l->md = grpc_mdelem_from_grpc_metadata(exec_ctx, (grpc_metadata*)md);
1008
1010
  }
1009
1011
  if (i != total_count) {
1010
1012
  for (int j = 0; j < i; j++) {
1011
- const grpc_metadata *md =
1013
+ const grpc_metadata* md =
1012
1014
  get_md_elem(metadata, additional_metadata, j, count);
1013
- grpc_linked_mdelem *l = linked_from_md(md);
1015
+ grpc_linked_mdelem* l = linked_from_md(md);
1014
1016
  GRPC_MDELEM_UNREF(exec_ctx, l->md);
1015
1017
  }
1016
1018
  return 0;
@@ -1027,9 +1029,9 @@ static int prepare_application_metadata(
1027
1029
  }
1028
1030
  }
1029
1031
  for (i = 0; i < total_count; i++) {
1030
- grpc_metadata *md = get_md_elem(metadata, additional_metadata, i, count);
1031
- grpc_linked_mdelem *l = linked_from_md(md);
1032
- grpc_error *error = grpc_metadata_batch_link_tail(exec_ctx, batch, l);
1032
+ grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count);
1033
+ grpc_linked_mdelem* l = linked_from_md(md);
1034
+ grpc_error* error = grpc_metadata_batch_link_tail(exec_ctx, batch, l);
1033
1035
  if (error != GRPC_ERROR_NONE) {
1034
1036
  GRPC_MDELEM_UNREF(exec_ctx, l->md);
1035
1037
  }
@@ -1044,23 +1046,23 @@ static int prepare_application_metadata(
1044
1046
  as metadata cannot store a 0 value (which is used as OK for grpc_status_codes
1045
1047
  */
1046
1048
  #define STATUS_OFFSET 1
1047
- static void destroy_status(void *ignored) {}
1049
+ static void destroy_status(void* ignored) {}
1048
1050
 
1049
1051
  static uint32_t decode_status(grpc_mdelem md) {
1050
1052
  uint32_t status;
1051
- void *user_data;
1053
+ void* user_data;
1052
1054
  if (grpc_mdelem_eq(md, GRPC_MDELEM_GRPC_STATUS_0)) return 0;
1053
1055
  if (grpc_mdelem_eq(md, GRPC_MDELEM_GRPC_STATUS_1)) return 1;
1054
1056
  if (grpc_mdelem_eq(md, GRPC_MDELEM_GRPC_STATUS_2)) return 2;
1055
1057
  user_data = grpc_mdelem_get_user_data(md, destroy_status);
1056
- if (user_data != NULL) {
1058
+ if (user_data != nullptr) {
1057
1059
  status = ((uint32_t)(intptr_t)user_data) - STATUS_OFFSET;
1058
1060
  } else {
1059
1061
  if (!grpc_parse_slice_to_uint32(GRPC_MDVALUE(md), &status)) {
1060
1062
  status = GRPC_STATUS_UNKNOWN; /* could not parse status code */
1061
1063
  }
1062
1064
  grpc_mdelem_set_user_data(md, destroy_status,
1063
- (void *)(intptr_t)(status + STATUS_OFFSET));
1065
+ (void*)(intptr_t)(status + STATUS_OFFSET));
1064
1066
  }
1065
1067
  return status;
1066
1068
  }
@@ -1069,7 +1071,7 @@ static grpc_compression_algorithm decode_compression(grpc_mdelem md) {
1069
1071
  grpc_compression_algorithm algorithm =
1070
1072
  grpc_compression_algorithm_from_slice(GRPC_MDVALUE(md));
1071
1073
  if (algorithm == GRPC_COMPRESS_ALGORITHMS_COUNT) {
1072
- char *md_c_str = grpc_slice_to_c_string(GRPC_MDVALUE(md));
1074
+ char* md_c_str = grpc_slice_to_c_string(GRPC_MDVALUE(md));
1073
1075
  gpr_log(GPR_ERROR,
1074
1076
  "Invalid incoming compression algorithm: '%s'. Interpreting "
1075
1077
  "incoming data as uncompressed.",
@@ -1085,7 +1087,7 @@ static grpc_stream_compression_algorithm decode_stream_compression(
1085
1087
  grpc_stream_compression_algorithm algorithm =
1086
1088
  grpc_stream_compression_algorithm_from_slice(GRPC_MDVALUE(md));
1087
1089
  if (algorithm == GRPC_STREAM_COMPRESS_ALGORITHMS_COUNT) {
1088
- char *md_c_str = grpc_slice_to_c_string(GRPC_MDVALUE(md));
1090
+ char* md_c_str = grpc_slice_to_c_string(GRPC_MDVALUE(md));
1089
1091
  gpr_log(GPR_ERROR,
1090
1092
  "Invalid incoming stream compression algorithm: '%s'. Interpreting "
1091
1093
  "incoming data as uncompressed.",
@@ -1096,20 +1098,20 @@ static grpc_stream_compression_algorithm decode_stream_compression(
1096
1098
  return algorithm;
1097
1099
  }
1098
1100
 
1099
- static void publish_app_metadata(grpc_call *call, grpc_metadata_batch *b,
1101
+ static void publish_app_metadata(grpc_call* call, grpc_metadata_batch* b,
1100
1102
  int is_trailing) {
1101
1103
  if (b->list.count == 0) return;
1102
1104
  GPR_TIMER_BEGIN("publish_app_metadata", 0);
1103
- grpc_metadata_array *dest;
1104
- grpc_metadata *mdusr;
1105
+ grpc_metadata_array* dest;
1106
+ grpc_metadata* mdusr;
1105
1107
  dest = call->buffered_metadata[is_trailing];
1106
1108
  if (dest->count + b->list.count > dest->capacity) {
1107
1109
  dest->capacity =
1108
1110
  GPR_MAX(dest->capacity + b->list.count, dest->capacity * 3 / 2);
1109
- dest->metadata = (grpc_metadata *)gpr_realloc(
1111
+ dest->metadata = (grpc_metadata*)gpr_realloc(
1110
1112
  dest->metadata, sizeof(grpc_metadata) * dest->capacity);
1111
1113
  }
1112
- for (grpc_linked_mdelem *l = b->list.head; l != NULL; l = l->next) {
1114
+ for (grpc_linked_mdelem* l = b->list.head; l != nullptr; l = l->next) {
1113
1115
  mdusr = &dest->metadata[dest->count++];
1114
1116
  /* we pass back borrowed slices that are valid whilst the call is valid */
1115
1117
  mdusr->key = GRPC_MDKEY(l->md);
@@ -1118,10 +1120,10 @@ static void publish_app_metadata(grpc_call *call, grpc_metadata_batch *b,
1118
1120
  GPR_TIMER_END("publish_app_metadata", 0);
1119
1121
  }
1120
1122
 
1121
- static void recv_initial_filter(grpc_exec_ctx *exec_ctx, grpc_call *call,
1122
- grpc_metadata_batch *b) {
1123
- if (b->idx.named.content_encoding != NULL) {
1124
- if (b->idx.named.grpc_encoding != NULL) {
1123
+ static void recv_initial_filter(grpc_exec_ctx* exec_ctx, grpc_call* call,
1124
+ grpc_metadata_batch* b) {
1125
+ if (b->idx.named.content_encoding != nullptr) {
1126
+ if (b->idx.named.grpc_encoding != nullptr) {
1125
1127
  gpr_log(GPR_ERROR,
1126
1128
  "Received both content-encoding and grpc-encoding header. "
1127
1129
  "Ignoring grpc-encoding.");
@@ -1132,21 +1134,21 @@ static void recv_initial_filter(grpc_exec_ctx *exec_ctx, grpc_call *call,
1132
1134
  call, decode_stream_compression(b->idx.named.content_encoding->md));
1133
1135
  GPR_TIMER_END("incoming_stream_compression_algorithm", 0);
1134
1136
  grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.content_encoding);
1135
- } else if (b->idx.named.grpc_encoding != NULL) {
1137
+ } else if (b->idx.named.grpc_encoding != nullptr) {
1136
1138
  GPR_TIMER_BEGIN("incoming_compression_algorithm", 0);
1137
1139
  set_incoming_compression_algorithm(
1138
1140
  call, decode_compression(b->idx.named.grpc_encoding->md));
1139
1141
  GPR_TIMER_END("incoming_compression_algorithm", 0);
1140
1142
  grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_encoding);
1141
1143
  }
1142
- if (b->idx.named.grpc_accept_encoding != NULL) {
1144
+ if (b->idx.named.grpc_accept_encoding != nullptr) {
1143
1145
  GPR_TIMER_BEGIN("encodings_accepted_by_peer", 0);
1144
1146
  set_encodings_accepted_by_peer(exec_ctx, call,
1145
1147
  b->idx.named.grpc_accept_encoding->md);
1146
1148
  grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.grpc_accept_encoding);
1147
1149
  GPR_TIMER_END("encodings_accepted_by_peer", 0);
1148
1150
  }
1149
- if (b->idx.named.accept_encoding != NULL) {
1151
+ if (b->idx.named.accept_encoding != nullptr) {
1150
1152
  GPR_TIMER_BEGIN("stream_encodings_accepted_by_peer", 0);
1151
1153
  set_stream_encodings_accepted_by_peer(exec_ctx, call,
1152
1154
  b->idx.named.accept_encoding->md);
@@ -1156,19 +1158,19 @@ static void recv_initial_filter(grpc_exec_ctx *exec_ctx, grpc_call *call,
1156
1158
  publish_app_metadata(call, b, false);
1157
1159
  }
1158
1160
 
1159
- static void recv_trailing_filter(grpc_exec_ctx *exec_ctx, void *args,
1160
- grpc_metadata_batch *b) {
1161
- grpc_call *call = (grpc_call *)args;
1162
- if (b->idx.named.grpc_status != NULL) {
1161
+ static void recv_trailing_filter(grpc_exec_ctx* exec_ctx, void* args,
1162
+ grpc_metadata_batch* b) {
1163
+ grpc_call* call = (grpc_call*)args;
1164
+ if (b->idx.named.grpc_status != nullptr) {
1163
1165
  uint32_t status_code = decode_status(b->idx.named.grpc_status->md);
1164
- grpc_error *error =
1166
+ grpc_error* error =
1165
1167
  status_code == GRPC_STATUS_OK
1166
1168
  ? GRPC_ERROR_NONE
1167
1169
  : grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1168
1170
  "Error received from peer"),
1169
1171
  GRPC_ERROR_INT_GRPC_STATUS,
1170
1172
  (intptr_t)status_code);
1171
- if (b->idx.named.grpc_message != NULL) {
1173
+ if (b->idx.named.grpc_message != nullptr) {
1172
1174
  error = grpc_error_set_str(
1173
1175
  error, GRPC_ERROR_STR_GRPC_MESSAGE,
1174
1176
  grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_message->md)));
@@ -1183,7 +1185,7 @@ static void recv_trailing_filter(grpc_exec_ctx *exec_ctx, void *args,
1183
1185
  publish_app_metadata(call, b, true);
1184
1186
  }
1185
1187
 
1186
- grpc_call_stack *grpc_call_get_call_stack(grpc_call *call) {
1188
+ grpc_call_stack* grpc_call_get_call_stack(grpc_call* call) {
1187
1189
  return CALL_STACK_FROM_CALL(call);
1188
1190
  }
1189
1191
 
@@ -1191,12 +1193,12 @@ grpc_call_stack *grpc_call_get_call_stack(grpc_call *call) {
1191
1193
  * BATCH API IMPLEMENTATION
1192
1194
  */
1193
1195
 
1194
- static void set_status_value_directly(grpc_status_code status, void *dest) {
1195
- *(grpc_status_code *)dest = status;
1196
+ static void set_status_value_directly(grpc_status_code status, void* dest) {
1197
+ *(grpc_status_code*)dest = status;
1196
1198
  }
1197
1199
 
1198
- static void set_cancelled_value(grpc_status_code status, void *dest) {
1199
- *(int *)dest = (status != GRPC_STATUS_OK);
1200
+ static void set_cancelled_value(grpc_status_code status, void* dest) {
1201
+ *(int*)dest = (status != GRPC_STATUS_OK);
1200
1202
  }
1201
1203
 
1202
1204
  static bool are_write_flags_valid(uint32_t flags) {
@@ -1236,18 +1238,18 @@ static int batch_slot_for_op(grpc_op_type type) {
1236
1238
  GPR_UNREACHABLE_CODE(return 123456789);
1237
1239
  }
1238
1240
 
1239
- static batch_control *allocate_batch_control(grpc_call *call,
1240
- const grpc_op *ops,
1241
+ static batch_control* allocate_batch_control(grpc_call* call,
1242
+ const grpc_op* ops,
1241
1243
  size_t num_ops) {
1242
1244
  int slot = batch_slot_for_op(ops[0].op);
1243
- batch_control **pslot = &call->active_batches[slot];
1244
- if (*pslot == NULL) {
1245
+ batch_control** pslot = &call->active_batches[slot];
1246
+ if (*pslot == nullptr) {
1245
1247
  *pslot =
1246
- (batch_control *)gpr_arena_alloc(call->arena, sizeof(batch_control));
1248
+ (batch_control*)gpr_arena_alloc(call->arena, sizeof(batch_control));
1247
1249
  }
1248
- batch_control *bctl = *pslot;
1249
- if (bctl->call != NULL) {
1250
- return NULL;
1250
+ batch_control* bctl = *pslot;
1251
+ if (bctl->call != nullptr) {
1252
+ return nullptr;
1251
1253
  }
1252
1254
  memset(bctl, 0, sizeof(*bctl));
1253
1255
  bctl->call = call;
@@ -1255,40 +1257,40 @@ static batch_control *allocate_batch_control(grpc_call *call,
1255
1257
  return bctl;
1256
1258
  }
1257
1259
 
1258
- static void finish_batch_completion(grpc_exec_ctx *exec_ctx, void *user_data,
1259
- grpc_cq_completion *storage) {
1260
- batch_control *bctl = (batch_control *)user_data;
1261
- grpc_call *call = bctl->call;
1262
- bctl->call = NULL;
1260
+ static void finish_batch_completion(grpc_exec_ctx* exec_ctx, void* user_data,
1261
+ grpc_cq_completion* storage) {
1262
+ batch_control* bctl = (batch_control*)user_data;
1263
+ grpc_call* call = bctl->call;
1264
+ bctl->call = nullptr;
1263
1265
  GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, "completion");
1264
1266
  }
1265
1267
 
1266
- static grpc_error *consolidate_batch_errors(batch_control *bctl) {
1268
+ static grpc_error* consolidate_batch_errors(batch_control* bctl) {
1267
1269
  size_t n = (size_t)gpr_atm_acq_load(&bctl->num_errors);
1268
1270
  if (n == 0) {
1269
1271
  return GRPC_ERROR_NONE;
1270
1272
  } else if (n == 1) {
1271
1273
  /* Skip creating a composite error in the case that only one error was
1272
1274
  logged */
1273
- grpc_error *e = bctl->errors[0];
1274
- bctl->errors[0] = NULL;
1275
+ grpc_error* e = bctl->errors[0];
1276
+ bctl->errors[0] = nullptr;
1275
1277
  return e;
1276
1278
  } else {
1277
- grpc_error *error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
1279
+ grpc_error* error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
1278
1280
  "Call batch failed", bctl->errors, n);
1279
1281
  for (size_t i = 0; i < n; i++) {
1280
1282
  GRPC_ERROR_UNREF(bctl->errors[i]);
1281
- bctl->errors[i] = NULL;
1283
+ bctl->errors[i] = nullptr;
1282
1284
  }
1283
1285
  return error;
1284
1286
  }
1285
1287
  }
1286
1288
 
1287
- static void post_batch_completion(grpc_exec_ctx *exec_ctx,
1288
- batch_control *bctl) {
1289
- grpc_call *next_child_call;
1290
- grpc_call *call = bctl->call;
1291
- grpc_error *error = consolidate_batch_errors(bctl);
1289
+ static void post_batch_completion(grpc_exec_ctx* exec_ctx,
1290
+ batch_control* bctl) {
1291
+ grpc_call* next_child_call;
1292
+ grpc_call* call = bctl->call;
1293
+ grpc_error* error = consolidate_batch_errors(bctl);
1292
1294
 
1293
1295
  if (bctl->op.send_initial_metadata) {
1294
1296
  grpc_metadata_batch_destroy(
@@ -1304,18 +1306,18 @@ static void post_batch_completion(grpc_exec_ctx *exec_ctx,
1304
1306
  &call->metadata_batch[0 /* is_receiving */][1 /* is_trailing */]);
1305
1307
  }
1306
1308
  if (bctl->op.recv_trailing_metadata) {
1307
- grpc_metadata_batch *md =
1309
+ grpc_metadata_batch* md =
1308
1310
  &call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */];
1309
1311
  recv_trailing_filter(exec_ctx, call, md);
1310
1312
 
1311
1313
  /* propagate cancellation to any interested children */
1312
1314
  gpr_atm_rel_store(&call->received_final_op_atm, 1);
1313
- parent_call *pc = get_parent_call(call);
1314
- if (pc != NULL) {
1315
- grpc_call *child;
1315
+ parent_call* pc = get_parent_call(call);
1316
+ if (pc != nullptr) {
1317
+ grpc_call* child;
1316
1318
  gpr_mu_lock(&pc->child_list_mu);
1317
1319
  child = pc->first_child;
1318
- if (child != NULL) {
1320
+ if (child != nullptr) {
1319
1321
  do {
1320
1322
  next_child_call = child->child->sibling_next;
1321
1323
  if (child->cancellation_is_inherited) {
@@ -1331,23 +1333,29 @@ static void post_batch_completion(grpc_exec_ctx *exec_ctx,
1331
1333
  }
1332
1334
 
1333
1335
  if (call->is_client) {
1334
- get_final_status(call, set_status_value_directly,
1336
+ get_final_status(exec_ctx, call, set_status_value_directly,
1335
1337
  call->final_op.client.status,
1336
- call->final_op.client.status_details);
1338
+ call->final_op.client.status_details,
1339
+ call->final_op.client.error_string);
1337
1340
  } else {
1338
- get_final_status(call, set_cancelled_value,
1339
- call->final_op.server.cancelled, NULL);
1341
+ get_final_status(exec_ctx, call, set_cancelled_value,
1342
+ call->final_op.server.cancelled, nullptr, nullptr);
1340
1343
  }
1341
1344
 
1342
1345
  GRPC_ERROR_UNREF(error);
1343
1346
  error = GRPC_ERROR_NONE;
1344
1347
  }
1348
+ if (error != GRPC_ERROR_NONE && bctl->op.recv_message &&
1349
+ *call->receiving_buffer != nullptr) {
1350
+ grpc_byte_buffer_destroy(*call->receiving_buffer);
1351
+ *call->receiving_buffer = nullptr;
1352
+ }
1345
1353
 
1346
1354
  if (bctl->completion_data.notify_tag.is_closure) {
1347
1355
  /* unrefs bctl->error */
1348
- bctl->call = NULL;
1356
+ bctl->call = nullptr;
1349
1357
  GRPC_CLOSURE_RUN(
1350
- exec_ctx, (grpc_closure *)bctl->completion_data.notify_tag.tag, error);
1358
+ exec_ctx, (grpc_closure*)bctl->completion_data.notify_tag.tag, error);
1351
1359
  GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, "completion");
1352
1360
  } else {
1353
1361
  /* unrefs bctl->error */
@@ -1357,23 +1365,23 @@ static void post_batch_completion(grpc_exec_ctx *exec_ctx,
1357
1365
  }
1358
1366
  }
1359
1367
 
1360
- static void finish_batch_step(grpc_exec_ctx *exec_ctx, batch_control *bctl) {
1368
+ static void finish_batch_step(grpc_exec_ctx* exec_ctx, batch_control* bctl) {
1361
1369
  if (gpr_unref(&bctl->steps_to_complete)) {
1362
1370
  post_batch_completion(exec_ctx, bctl);
1363
1371
  }
1364
1372
  }
1365
1373
 
1366
- static void continue_receiving_slices(grpc_exec_ctx *exec_ctx,
1367
- batch_control *bctl) {
1368
- grpc_error *error;
1369
- grpc_call *call = bctl->call;
1374
+ static void continue_receiving_slices(grpc_exec_ctx* exec_ctx,
1375
+ batch_control* bctl) {
1376
+ grpc_error* error;
1377
+ grpc_call* call = bctl->call;
1370
1378
  for (;;) {
1371
1379
  size_t remaining = call->receiving_stream->length -
1372
1380
  (*call->receiving_buffer)->data.raw.slice_buffer.length;
1373
1381
  if (remaining == 0) {
1374
1382
  call->receiving_message = 0;
1375
1383
  grpc_byte_stream_destroy(exec_ctx, call->receiving_stream);
1376
- call->receiving_stream = NULL;
1384
+ call->receiving_stream = nullptr;
1377
1385
  finish_batch_step(exec_ctx, bctl);
1378
1386
  return;
1379
1387
  }
@@ -1386,9 +1394,9 @@ static void continue_receiving_slices(grpc_exec_ctx *exec_ctx,
1386
1394
  call->receiving_slice);
1387
1395
  } else {
1388
1396
  grpc_byte_stream_destroy(exec_ctx, call->receiving_stream);
1389
- call->receiving_stream = NULL;
1397
+ call->receiving_stream = nullptr;
1390
1398
  grpc_byte_buffer_destroy(*call->receiving_buffer);
1391
- *call->receiving_buffer = NULL;
1399
+ *call->receiving_buffer = nullptr;
1392
1400
  call->receiving_message = 0;
1393
1401
  finish_batch_step(exec_ctx, bctl);
1394
1402
  return;
@@ -1399,11 +1407,11 @@ static void continue_receiving_slices(grpc_exec_ctx *exec_ctx,
1399
1407
  }
1400
1408
  }
1401
1409
 
1402
- static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
1403
- grpc_error *error) {
1404
- batch_control *bctl = (batch_control *)bctlp;
1405
- grpc_call *call = bctl->call;
1406
- grpc_byte_stream *bs = call->receiving_stream;
1410
+ static void receiving_slice_ready(grpc_exec_ctx* exec_ctx, void* bctlp,
1411
+ grpc_error* error) {
1412
+ batch_control* bctl = (batch_control*)bctlp;
1413
+ grpc_call* call = bctl->call;
1414
+ grpc_byte_stream* bs = call->receiving_stream;
1407
1415
  bool release_error = false;
1408
1416
 
1409
1417
  if (error == GRPC_ERROR_NONE) {
@@ -1421,13 +1429,13 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
1421
1429
  }
1422
1430
 
1423
1431
  if (error != GRPC_ERROR_NONE) {
1424
- if (GRPC_TRACER_ON(grpc_trace_operation_failures)) {
1432
+ if (grpc_trace_operation_failures.enabled()) {
1425
1433
  GRPC_LOG_IF_ERROR("receiving_slice_ready", GRPC_ERROR_REF(error));
1426
1434
  }
1427
1435
  grpc_byte_stream_destroy(exec_ctx, call->receiving_stream);
1428
- call->receiving_stream = NULL;
1436
+ call->receiving_stream = nullptr;
1429
1437
  grpc_byte_buffer_destroy(*call->receiving_buffer);
1430
- *call->receiving_buffer = NULL;
1438
+ *call->receiving_buffer = nullptr;
1431
1439
  call->receiving_message = 0;
1432
1440
  finish_batch_step(exec_ctx, bctl);
1433
1441
  if (release_error) {
@@ -1436,11 +1444,11 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
1436
1444
  }
1437
1445
  }
1438
1446
 
1439
- static void process_data_after_md(grpc_exec_ctx *exec_ctx,
1440
- batch_control *bctl) {
1441
- grpc_call *call = bctl->call;
1442
- if (call->receiving_stream == NULL) {
1443
- *call->receiving_buffer = NULL;
1447
+ static void process_data_after_md(grpc_exec_ctx* exec_ctx,
1448
+ batch_control* bctl) {
1449
+ grpc_call* call = bctl->call;
1450
+ if (call->receiving_stream == nullptr) {
1451
+ *call->receiving_buffer = nullptr;
1444
1452
  call->receiving_message = 0;
1445
1453
  finish_batch_step(exec_ctx, bctl);
1446
1454
  } else {
@@ -1448,9 +1456,9 @@ static void process_data_after_md(grpc_exec_ctx *exec_ctx,
1448
1456
  if ((call->receiving_stream->flags & GRPC_WRITE_INTERNAL_COMPRESS) &&
1449
1457
  (call->incoming_compression_algorithm > GRPC_COMPRESS_NONE)) {
1450
1458
  *call->receiving_buffer = grpc_raw_compressed_byte_buffer_create(
1451
- NULL, 0, call->incoming_compression_algorithm);
1459
+ nullptr, 0, call->incoming_compression_algorithm);
1452
1460
  } else {
1453
- *call->receiving_buffer = grpc_raw_byte_buffer_create(NULL, 0);
1461
+ *call->receiving_buffer = grpc_raw_byte_buffer_create(nullptr, 0);
1454
1462
  }
1455
1463
  GRPC_CLOSURE_INIT(&call->receiving_slice_ready, receiving_slice_ready, bctl,
1456
1464
  grpc_schedule_on_exec_ctx);
@@ -1458,14 +1466,14 @@ static void process_data_after_md(grpc_exec_ctx *exec_ctx,
1458
1466
  }
1459
1467
  }
1460
1468
 
1461
- static void receiving_stream_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
1462
- grpc_error *error) {
1463
- batch_control *bctl = (batch_control *)bctlp;
1464
- grpc_call *call = bctl->call;
1469
+ static void receiving_stream_ready(grpc_exec_ctx* exec_ctx, void* bctlp,
1470
+ grpc_error* error) {
1471
+ batch_control* bctl = (batch_control*)bctlp;
1472
+ grpc_call* call = bctl->call;
1465
1473
  if (error != GRPC_ERROR_NONE) {
1466
- if (call->receiving_stream != NULL) {
1474
+ if (call->receiving_stream != nullptr) {
1467
1475
  grpc_byte_stream_destroy(exec_ctx, call->receiving_stream);
1468
- call->receiving_stream = NULL;
1476
+ call->receiving_stream = nullptr;
1469
1477
  }
1470
1478
  add_batch_error(exec_ctx, bctl, GRPC_ERROR_REF(error), true);
1471
1479
  cancel_with_error(exec_ctx, call, STATUS_FROM_SURFACE,
@@ -1474,7 +1482,7 @@ static void receiving_stream_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
1474
1482
  /* If recv_state is RECV_NONE, we will save the batch_control
1475
1483
  * object with rel_cas, and will not use it after the cas. Its corresponding
1476
1484
  * acq_load is in receiving_initial_metadata_ready() */
1477
- if (error != GRPC_ERROR_NONE || call->receiving_stream == NULL ||
1485
+ if (error != GRPC_ERROR_NONE || call->receiving_stream == nullptr ||
1478
1486
  !gpr_atm_rel_cas(&call->recv_state, RECV_NONE, (gpr_atm)bctlp)) {
1479
1487
  process_data_after_md(exec_ctx, bctl);
1480
1488
  }
@@ -1483,24 +1491,24 @@ static void receiving_stream_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
1483
1491
  // The recv_message_ready callback used when sending a batch containing
1484
1492
  // a recv_message op down the filter stack. Yields the call combiner
1485
1493
  // before processing the received message.
1486
- static void receiving_stream_ready_in_call_combiner(grpc_exec_ctx *exec_ctx,
1487
- void *bctlp,
1488
- grpc_error *error) {
1489
- batch_control *bctl = (batch_control *)bctlp;
1490
- grpc_call *call = bctl->call;
1494
+ static void receiving_stream_ready_in_call_combiner(grpc_exec_ctx* exec_ctx,
1495
+ void* bctlp,
1496
+ grpc_error* error) {
1497
+ batch_control* bctl = (batch_control*)bctlp;
1498
+ grpc_call* call = bctl->call;
1491
1499
  GRPC_CALL_COMBINER_STOP(exec_ctx, &call->call_combiner, "recv_message_ready");
1492
1500
  receiving_stream_ready(exec_ctx, bctlp, error);
1493
1501
  }
1494
1502
 
1495
- static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
1496
- batch_control *bctl) {
1497
- grpc_call *call = bctl->call;
1503
+ static void validate_filtered_metadata(grpc_exec_ctx* exec_ctx,
1504
+ batch_control* bctl) {
1505
+ grpc_call* call = bctl->call;
1498
1506
  /* validate compression algorithms */
1499
1507
  if (call->incoming_stream_compression_algorithm !=
1500
1508
  GRPC_STREAM_COMPRESS_NONE) {
1501
1509
  const grpc_stream_compression_algorithm algo =
1502
1510
  call->incoming_stream_compression_algorithm;
1503
- char *error_msg = NULL;
1511
+ char* error_msg = nullptr;
1504
1512
  const grpc_compression_options compression_options =
1505
1513
  grpc_channel_compression_options(call->channel);
1506
1514
  if (algo >= GRPC_STREAM_COMPRESS_ALGORITHMS_COUNT) {
@@ -1512,7 +1520,7 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
1512
1520
  } else if (grpc_compression_options_is_stream_compression_algorithm_enabled(
1513
1521
  &compression_options, algo) == 0) {
1514
1522
  /* check if algorithm is supported by current channel config */
1515
- const char *algo_name = NULL;
1523
+ const char* algo_name = nullptr;
1516
1524
  grpc_stream_compression_algorithm_name(algo, &algo_name);
1517
1525
  gpr_asprintf(&error_msg, "Stream compression algorithm '%s' is disabled.",
1518
1526
  algo_name);
@@ -1525,8 +1533,8 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
1525
1533
  GPR_ASSERT(call->stream_encodings_accepted_by_peer != 0);
1526
1534
  if (!GPR_BITGET(call->stream_encodings_accepted_by_peer,
1527
1535
  call->incoming_stream_compression_algorithm)) {
1528
- if (GRPC_TRACER_ON(grpc_compression_trace)) {
1529
- const char *algo_name = NULL;
1536
+ if (grpc_compression_trace.enabled()) {
1537
+ const char* algo_name = nullptr;
1530
1538
  grpc_stream_compression_algorithm_name(
1531
1539
  call->incoming_stream_compression_algorithm, &algo_name);
1532
1540
  gpr_log(
@@ -1540,7 +1548,7 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
1540
1548
  } else if (call->incoming_compression_algorithm != GRPC_COMPRESS_NONE) {
1541
1549
  const grpc_compression_algorithm algo =
1542
1550
  call->incoming_compression_algorithm;
1543
- char *error_msg = NULL;
1551
+ char* error_msg = nullptr;
1544
1552
  const grpc_compression_options compression_options =
1545
1553
  grpc_channel_compression_options(call->channel);
1546
1554
  /* check if algorithm is known */
@@ -1553,7 +1561,7 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
1553
1561
  } else if (grpc_compression_options_is_algorithm_enabled(
1554
1562
  &compression_options, algo) == 0) {
1555
1563
  /* check if algorithm is supported by current channel config */
1556
- const char *algo_name = NULL;
1564
+ const char* algo_name = nullptr;
1557
1565
  grpc_compression_algorithm_name(algo, &algo_name);
1558
1566
  gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.",
1559
1567
  algo_name);
@@ -1568,8 +1576,8 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
1568
1576
  GPR_ASSERT(call->encodings_accepted_by_peer != 0);
1569
1577
  if (!GPR_BITGET(call->encodings_accepted_by_peer,
1570
1578
  call->incoming_compression_algorithm)) {
1571
- if (GRPC_TRACER_ON(grpc_compression_trace)) {
1572
- const char *algo_name = NULL;
1579
+ if (grpc_compression_trace.enabled()) {
1580
+ const char* algo_name = nullptr;
1573
1581
  grpc_compression_algorithm_name(call->incoming_compression_algorithm,
1574
1582
  &algo_name);
1575
1583
  gpr_log(GPR_ERROR,
@@ -1582,8 +1590,8 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
1582
1590
  }
1583
1591
  }
1584
1592
 
1585
- static void add_batch_error(grpc_exec_ctx *exec_ctx, batch_control *bctl,
1586
- grpc_error *error, bool has_cancelled) {
1593
+ static void add_batch_error(grpc_exec_ctx* exec_ctx, batch_control* bctl,
1594
+ grpc_error* error, bool has_cancelled) {
1587
1595
  if (error == GRPC_ERROR_NONE) return;
1588
1596
  int idx = (int)gpr_atm_full_fetch_add(&bctl->num_errors, 1);
1589
1597
  if (idx == 0 && !has_cancelled) {
@@ -1593,17 +1601,17 @@ static void add_batch_error(grpc_exec_ctx *exec_ctx, batch_control *bctl,
1593
1601
  bctl->errors[idx] = error;
1594
1602
  }
1595
1603
 
1596
- static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx,
1597
- void *bctlp, grpc_error *error) {
1598
- batch_control *bctl = (batch_control *)bctlp;
1599
- grpc_call *call = bctl->call;
1604
+ static void receiving_initial_metadata_ready(grpc_exec_ctx* exec_ctx,
1605
+ void* bctlp, grpc_error* error) {
1606
+ batch_control* bctl = (batch_control*)bctlp;
1607
+ grpc_call* call = bctl->call;
1600
1608
 
1601
1609
  GRPC_CALL_COMBINER_STOP(exec_ctx, &call->call_combiner,
1602
1610
  "recv_initial_metadata_ready");
1603
1611
 
1604
1612
  add_batch_error(exec_ctx, bctl, GRPC_ERROR_REF(error), false);
1605
1613
  if (error == GRPC_ERROR_NONE) {
1606
- grpc_metadata_batch *md =
1614
+ grpc_metadata_batch* md =
1607
1615
  &call->metadata_batch[1 /* is_receiving */][0 /* is_trailing */];
1608
1616
  recv_initial_filter(exec_ctx, call, md);
1609
1617
 
@@ -1612,15 +1620,12 @@ static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx,
1612
1620
  validate_filtered_metadata(exec_ctx, bctl);
1613
1621
  GPR_TIMER_END("validate_filtered_metadata", 0);
1614
1622
 
1615
- if (gpr_time_cmp(md->deadline, gpr_inf_future(md->deadline.clock_type)) !=
1616
- 0 &&
1617
- !call->is_client) {
1618
- call->send_deadline =
1619
- gpr_convert_clock_type(md->deadline, GPR_CLOCK_MONOTONIC);
1623
+ if (md->deadline != GRPC_MILLIS_INF_FUTURE && !call->is_client) {
1624
+ call->send_deadline = md->deadline;
1620
1625
  }
1621
1626
  }
1622
1627
 
1623
- grpc_closure *saved_rsr_closure = NULL;
1628
+ grpc_closure* saved_rsr_closure = nullptr;
1624
1629
  while (true) {
1625
1630
  gpr_atm rsr_bctlp = gpr_atm_acq_load(&call->recv_state);
1626
1631
  /* Should only receive initial metadata once */
@@ -1637,45 +1642,45 @@ static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx,
1637
1642
  }
1638
1643
  } else {
1639
1644
  /* Already received messages */
1640
- saved_rsr_closure = GRPC_CLOSURE_CREATE(receiving_stream_ready,
1641
- (batch_control *)rsr_bctlp,
1642
- grpc_schedule_on_exec_ctx);
1645
+ saved_rsr_closure =
1646
+ GRPC_CLOSURE_CREATE(receiving_stream_ready, (batch_control*)rsr_bctlp,
1647
+ grpc_schedule_on_exec_ctx);
1643
1648
  /* No need to modify recv_state */
1644
1649
  break;
1645
1650
  }
1646
1651
  }
1647
- if (saved_rsr_closure != NULL) {
1652
+ if (saved_rsr_closure != nullptr) {
1648
1653
  GRPC_CLOSURE_RUN(exec_ctx, saved_rsr_closure, GRPC_ERROR_REF(error));
1649
1654
  }
1650
1655
 
1651
1656
  finish_batch_step(exec_ctx, bctl);
1652
1657
  }
1653
1658
 
1654
- static void finish_batch(grpc_exec_ctx *exec_ctx, void *bctlp,
1655
- grpc_error *error) {
1656
- batch_control *bctl = (batch_control *)bctlp;
1657
- grpc_call *call = bctl->call;
1659
+ static void finish_batch(grpc_exec_ctx* exec_ctx, void* bctlp,
1660
+ grpc_error* error) {
1661
+ batch_control* bctl = (batch_control*)bctlp;
1662
+ grpc_call* call = bctl->call;
1658
1663
  GRPC_CALL_COMBINER_STOP(exec_ctx, &call->call_combiner, "on_complete");
1659
1664
  add_batch_error(exec_ctx, bctl, GRPC_ERROR_REF(error), false);
1660
1665
  finish_batch_step(exec_ctx, bctl);
1661
1666
  }
1662
1667
 
1663
- static void free_no_op_completion(grpc_exec_ctx *exec_ctx, void *p,
1664
- grpc_cq_completion *completion) {
1668
+ static void free_no_op_completion(grpc_exec_ctx* exec_ctx, void* p,
1669
+ grpc_cq_completion* completion) {
1665
1670
  gpr_free(completion);
1666
1671
  }
1667
1672
 
1668
- static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
1669
- grpc_call *call, const grpc_op *ops,
1670
- size_t nops, void *notify_tag,
1673
+ static grpc_call_error call_start_batch(grpc_exec_ctx* exec_ctx,
1674
+ grpc_call* call, const grpc_op* ops,
1675
+ size_t nops, void* notify_tag,
1671
1676
  int is_notify_tag_closure) {
1672
1677
  size_t i;
1673
- const grpc_op *op;
1674
- batch_control *bctl;
1678
+ const grpc_op* op;
1679
+ batch_control* bctl;
1675
1680
  int num_completion_callbacks_needed = 1;
1676
1681
  grpc_call_error error = GRPC_CALL_OK;
1677
- grpc_transport_stream_op_batch *stream_op;
1678
- grpc_transport_stream_op_batch_payload *stream_op_payload;
1682
+ grpc_transport_stream_op_batch* stream_op;
1683
+ grpc_transport_stream_op_batch_payload* stream_op_payload;
1679
1684
 
1680
1685
  GPR_TIMER_BEGIN("grpc_call_start_batch", 0);
1681
1686
  GRPC_CALL_LOG_BATCH(GPR_INFO, call, ops, nops, notify_tag);
@@ -1685,17 +1690,17 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
1685
1690
  GPR_ASSERT(grpc_cq_begin_op(call->cq, notify_tag));
1686
1691
  grpc_cq_end_op(
1687
1692
  exec_ctx, call->cq, notify_tag, GRPC_ERROR_NONE,
1688
- free_no_op_completion, NULL,
1689
- (grpc_cq_completion *)gpr_malloc(sizeof(grpc_cq_completion)));
1693
+ free_no_op_completion, nullptr,
1694
+ (grpc_cq_completion*)gpr_malloc(sizeof(grpc_cq_completion)));
1690
1695
  } else {
1691
- GRPC_CLOSURE_SCHED(exec_ctx, (grpc_closure *)notify_tag, GRPC_ERROR_NONE);
1696
+ GRPC_CLOSURE_SCHED(exec_ctx, (grpc_closure*)notify_tag, GRPC_ERROR_NONE);
1692
1697
  }
1693
1698
  error = GRPC_CALL_OK;
1694
1699
  goto done;
1695
1700
  }
1696
1701
 
1697
1702
  bctl = allocate_batch_control(call, ops, nops);
1698
- if (bctl == NULL) {
1703
+ if (bctl == nullptr) {
1699
1704
  return GRPC_CALL_ERROR_TOO_MANY_OPERATIONS;
1700
1705
  }
1701
1706
  bctl->completion_data.notify_tag.tag = notify_tag;
@@ -1708,7 +1713,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
1708
1713
  /* rewrite batch ops into a transport op */
1709
1714
  for (i = 0; i < nops; i++) {
1710
1715
  op = &ops[i];
1711
- if (op->reserved != NULL) {
1716
+ if (op->reserved != nullptr) {
1712
1717
  error = GRPC_CALL_ERROR;
1713
1718
  goto done_with_error;
1714
1719
  }
@@ -1813,7 +1818,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
1813
1818
  error = GRPC_CALL_ERROR_INVALID_FLAGS;
1814
1819
  goto done_with_error;
1815
1820
  }
1816
- if (op->data.send_message.send_message == NULL) {
1821
+ if (op->data.send_message.send_message == nullptr) {
1817
1822
  error = GRPC_CALL_ERROR_INVALID_MESSAGE;
1818
1823
  goto done_with_error;
1819
1824
  }
@@ -1884,18 +1889,18 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
1884
1889
  call->send_extra_metadata[0].md = grpc_channel_get_reffed_status_elem(
1885
1890
  exec_ctx, call->channel, op->data.send_status_from_server.status);
1886
1891
  {
1887
- grpc_error *override_error = GRPC_ERROR_NONE;
1892
+ grpc_error* override_error = GRPC_ERROR_NONE;
1888
1893
  if (op->data.send_status_from_server.status != GRPC_STATUS_OK) {
1889
1894
  override_error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1890
1895
  "Error from server send status");
1891
1896
  }
1892
- if (op->data.send_status_from_server.status_details != NULL) {
1897
+ if (op->data.send_status_from_server.status_details != nullptr) {
1893
1898
  call->send_extra_metadata[1].md = grpc_mdelem_from_slices(
1894
1899
  exec_ctx, GRPC_MDSTR_GRPC_MESSAGE,
1895
1900
  grpc_slice_ref_internal(
1896
1901
  *op->data.send_status_from_server.status_details));
1897
1902
  call->send_extra_metadata_count++;
1898
- char *msg = grpc_slice_to_c_string(
1903
+ char* msg = grpc_slice_to_c_string(
1899
1904
  GRPC_MDVALUE(call->send_extra_metadata[1].md));
1900
1905
  override_error =
1901
1906
  grpc_error_set_str(override_error, GRPC_ERROR_STR_GRPC_MESSAGE,
@@ -1908,8 +1913,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
1908
1913
  if (!prepare_application_metadata(
1909
1914
  exec_ctx, call,
1910
1915
  (int)op->data.send_status_from_server.trailing_metadata_count,
1911
- op->data.send_status_from_server.trailing_metadata, 1, 1, NULL,
1912
- 0)) {
1916
+ op->data.send_status_from_server.trailing_metadata, 1, 1,
1917
+ nullptr, 0)) {
1913
1918
  for (int n = 0; n < call->send_extra_metadata_count; n++) {
1914
1919
  GRPC_MDELEM_UNREF(exec_ctx, call->send_extra_metadata[n].md);
1915
1920
  }
@@ -1991,6 +1996,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
1991
1996
  call->final_op.client.status = op->data.recv_status_on_client.status;
1992
1997
  call->final_op.client.status_details =
1993
1998
  op->data.recv_status_on_client.status_details;
1999
+ call->final_op.client.error_string =
2000
+ op->data.recv_status_on_client.error_string;
1994
2001
  stream_op->recv_trailing_metadata = true;
1995
2002
  stream_op->collect_stats = true;
1996
2003
  stream_op_payload->recv_trailing_metadata.recv_trailing_metadata =
@@ -2070,8 +2077,8 @@ done_with_error:
2070
2077
  goto done;
2071
2078
  }
2072
2079
 
2073
- grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
2074
- size_t nops, void *tag, void *reserved) {
2080
+ grpc_call_error grpc_call_start_batch(grpc_call* call, const grpc_op* ops,
2081
+ size_t nops, void* tag, void* reserved) {
2075
2082
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
2076
2083
  grpc_call_error err;
2077
2084
 
@@ -2080,7 +2087,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
2080
2087
  "reserved=%p)",
2081
2088
  5, (call, ops, (unsigned long)nops, tag, reserved));
2082
2089
 
2083
- if (reserved != NULL) {
2090
+ if (reserved != nullptr) {
2084
2091
  err = GRPC_CALL_ERROR;
2085
2092
  } else {
2086
2093
  err = call_start_batch(&exec_ctx, call, ops, nops, tag, 0);
@@ -2090,16 +2097,16 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
2090
2097
  return err;
2091
2098
  }
2092
2099
 
2093
- grpc_call_error grpc_call_start_batch_and_execute(grpc_exec_ctx *exec_ctx,
2094
- grpc_call *call,
2095
- const grpc_op *ops,
2100
+ grpc_call_error grpc_call_start_batch_and_execute(grpc_exec_ctx* exec_ctx,
2101
+ grpc_call* call,
2102
+ const grpc_op* ops,
2096
2103
  size_t nops,
2097
- grpc_closure *closure) {
2104
+ grpc_closure* closure) {
2098
2105
  return call_start_batch(exec_ctx, call, ops, nops, closure, 1);
2099
2106
  }
2100
2107
 
2101
- void grpc_call_context_set(grpc_call *call, grpc_context_index elem,
2102
- void *value, void (*destroy)(void *value)) {
2108
+ void grpc_call_context_set(grpc_call* call, grpc_context_index elem,
2109
+ void* value, void (*destroy)(void* value)) {
2103
2110
  if (call->context[elem].destroy) {
2104
2111
  call->context[elem].destroy(call->context[elem].value);
2105
2112
  }
@@ -2107,20 +2114,20 @@ void grpc_call_context_set(grpc_call *call, grpc_context_index elem,
2107
2114
  call->context[elem].destroy = destroy;
2108
2115
  }
2109
2116
 
2110
- void *grpc_call_context_get(grpc_call *call, grpc_context_index elem) {
2117
+ void* grpc_call_context_get(grpc_call* call, grpc_context_index elem) {
2111
2118
  return call->context[elem].value;
2112
2119
  }
2113
2120
 
2114
- uint8_t grpc_call_is_client(grpc_call *call) { return call->is_client; }
2121
+ uint8_t grpc_call_is_client(grpc_call* call) { return call->is_client; }
2115
2122
 
2116
2123
  grpc_compression_algorithm grpc_call_compression_for_level(
2117
- grpc_call *call, grpc_compression_level level) {
2124
+ grpc_call* call, grpc_compression_level level) {
2118
2125
  grpc_compression_algorithm algo =
2119
2126
  compression_algorithm_for_level_locked(call, level);
2120
2127
  return algo;
2121
2128
  }
2122
2129
 
2123
- const char *grpc_call_error_to_string(grpc_call_error error) {
2130
+ const char* grpc_call_error_to_string(grpc_call_error error) {
2124
2131
  switch (error) {
2125
2132
  case GRPC_CALL_ERROR:
2126
2133
  return "GRPC_CALL_ERROR";