grpc 0.14.1 → 0.15.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 (277) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1398 -817
  3. data/include/grpc/compression.h +2 -1
  4. data/include/grpc/grpc.h +10 -1
  5. data/include/grpc/grpc_cronet.h +51 -0
  6. data/include/grpc/grpc_posix.h +70 -0
  7. data/include/grpc/impl/codegen/atm.h +2 -2
  8. data/include/grpc/impl/codegen/{atm_win32.h → atm_windows.h} +3 -3
  9. data/include/grpc/impl/codegen/compression_types.h +39 -5
  10. data/include/grpc/impl/codegen/connectivity_state.h +1 -1
  11. data/include/grpc/impl/codegen/grpc_types.h +10 -0
  12. data/include/grpc/impl/codegen/log.h +2 -1
  13. data/include/grpc/impl/codegen/port_platform.h +30 -12
  14. data/include/grpc/impl/codegen/slice_buffer.h +2 -3
  15. data/include/grpc/impl/codegen/sync.h +2 -2
  16. data/include/grpc/impl/codegen/{sync_win32.h → sync_windows.h} +3 -3
  17. data/include/grpc/support/{sync_win32.h → atm_windows.h} +4 -4
  18. data/include/grpc/support/avl.h +5 -0
  19. data/include/grpc/support/{log_win32.h → log_windows.h} +3 -3
  20. data/include/grpc/support/string_util.h +2 -1
  21. data/include/grpc/support/{atm_win32.h → sync_windows.h} +4 -4
  22. data/src/core/ext/census/gen/census.pb.c +179 -0
  23. data/src/core/ext/census/gen/census.pb.h +294 -0
  24. data/src/core/ext/census/grpc_filter.c +11 -7
  25. data/src/core/ext/client_config/channel_connectivity.c +28 -14
  26. data/src/core/ext/client_config/client_channel.c +77 -53
  27. data/src/core/ext/client_config/connector.h +1 -1
  28. data/src/core/ext/client_config/lb_policy.c +9 -6
  29. data/src/core/ext/client_config/lb_policy.h +9 -5
  30. data/src/core/ext/client_config/subchannel.c +58 -39
  31. data/src/core/ext/client_config/subchannel.h +3 -2
  32. data/src/core/ext/client_config/subchannel_call_holder.c +34 -19
  33. data/src/core/ext/client_config/subchannel_call_holder.h +2 -1
  34. data/src/core/ext/client_config/subchannel_index.c +20 -9
  35. data/src/core/ext/lb_policy/grpclb/load_balancer_api.c +7 -7
  36. data/src/core/ext/lb_policy/grpclb/load_balancer_api.h +5 -5
  37. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/{v0 → v1}/load_balancer.pb.c +29 -30
  38. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +178 -0
  39. data/src/core/ext/lb_policy/pick_first/pick_first.c +65 -45
  40. data/src/core/ext/lb_policy/round_robin/round_robin.c +84 -43
  41. data/src/core/ext/load_reporting/load_reporting.c +133 -0
  42. data/src/core/ext/load_reporting/load_reporting.h +75 -0
  43. data/src/core/ext/load_reporting/load_reporting_filter.c +151 -0
  44. data/src/core/ext/load_reporting/load_reporting_filter.h +41 -0
  45. data/src/core/ext/resolver/dns/native/dns_resolver.c +22 -8
  46. data/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +2 -2
  47. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +4 -4
  48. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +95 -0
  49. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +14 -18
  50. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +49 -24
  51. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +82 -0
  52. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +104 -60
  53. data/src/core/ext/transport/chttp2/transport/bin_decoder.c +232 -0
  54. data/src/{ruby/ext/grpc/rb_signal.c → core/ext/transport/chttp2/transport/bin_decoder.h} +27 -31
  55. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +481 -260
  56. data/src/core/ext/transport/chttp2/transport/frame.h +1 -7
  57. data/src/core/ext/transport/chttp2/transport/frame_data.c +44 -27
  58. data/src/core/ext/transport/chttp2/transport/frame_data.h +6 -5
  59. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +23 -17
  60. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -2
  61. data/src/core/ext/transport/chttp2/transport/frame_ping.c +12 -7
  62. data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -3
  63. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +25 -12
  64. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -2
  65. data/src/core/ext/transport/chttp2/transport/frame_settings.c +23 -21
  66. data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -2
  67. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +17 -9
  68. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -2
  69. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +365 -287
  70. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +8 -6
  71. data/src/core/ext/transport/chttp2/transport/hpack_table.c +24 -20
  72. data/src/core/ext/transport/chttp2/transport/hpack_table.h +5 -4
  73. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +1 -0
  74. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +1 -0
  75. data/src/core/ext/transport/chttp2/transport/internal.h +34 -32
  76. data/src/core/ext/transport/chttp2/transport/parsing.c +296 -212
  77. data/src/core/ext/transport/chttp2/transport/writing.c +12 -9
  78. data/src/core/lib/channel/channel_args.c +26 -12
  79. data/src/core/lib/channel/channel_args.h +1 -1
  80. data/src/core/lib/channel/channel_stack.c +12 -8
  81. data/src/core/lib/channel/channel_stack.h +27 -11
  82. data/src/core/lib/channel/channel_stack_builder.c +2 -2
  83. data/src/core/lib/channel/compress_filter.c +26 -31
  84. data/src/core/lib/channel/compress_filter.h +4 -4
  85. data/src/core/lib/channel/connected_channel.c +7 -5
  86. data/src/core/lib/channel/http_client_filter.c +34 -8
  87. data/src/core/lib/channel/http_client_filter.h +1 -1
  88. data/src/core/lib/channel/http_server_filter.c +21 -12
  89. data/src/core/lib/compression/{compression_algorithm.c → compression.c} +22 -21
  90. data/src/core/lib/http/httpcli.c +81 -59
  91. data/src/core/lib/http/httpcli.h +11 -15
  92. data/src/core/lib/http/httpcli_security_connector.c +5 -3
  93. data/src/core/lib/http/parser.c +127 -118
  94. data/src/core/lib/http/parser.h +11 -6
  95. data/src/core/lib/iomgr/closure.c +20 -16
  96. data/src/core/lib/iomgr/closure.h +19 -15
  97. data/src/core/lib/iomgr/endpoint.h +1 -1
  98. data/src/core/lib/iomgr/endpoint_pair_posix.c +2 -2
  99. data/src/core/lib/iomgr/error.c +535 -0
  100. data/src/core/lib/iomgr/error.h +192 -0
  101. data/src/core/lib/iomgr/ev_poll_and_epoll_posix.c +190 -83
  102. data/src/core/lib/iomgr/ev_poll_posix.c +1267 -0
  103. data/src/{ruby/ext/grpc/rb_signal.h → core/lib/iomgr/ev_poll_posix.h} +7 -5
  104. data/src/core/lib/iomgr/ev_posix.c +104 -14
  105. data/src/core/lib/iomgr/ev_posix.h +17 -7
  106. data/src/core/lib/iomgr/exec_ctx.c +25 -7
  107. data/src/core/lib/iomgr/exec_ctx.h +27 -8
  108. data/src/core/lib/iomgr/executor.c +2 -2
  109. data/src/core/lib/iomgr/executor.h +1 -1
  110. data/src/core/lib/iomgr/iocp_windows.c +2 -41
  111. data/src/core/lib/iomgr/iocp_windows.h +0 -8
  112. data/src/core/lib/iomgr/iomgr.c +5 -4
  113. data/src/core/lib/iomgr/iomgr_posix.c +5 -1
  114. data/src/core/lib/iomgr/iomgr_windows.c +1 -1
  115. data/src/core/lib/{support → iomgr}/load_file.c +15 -17
  116. data/src/core/lib/{support → iomgr}/load_file.h +8 -7
  117. data/src/core/lib/iomgr/polling_entity.c +104 -0
  118. data/src/core/lib/iomgr/polling_entity.h +81 -0
  119. data/src/core/lib/iomgr/pollset.h +6 -5
  120. data/src/core/lib/iomgr/pollset_set_windows.c +4 -1
  121. data/src/core/lib/iomgr/pollset_windows.c +10 -6
  122. data/src/core/lib/iomgr/resolve_address.h +5 -9
  123. data/src/core/lib/iomgr/resolve_address_posix.c +55 -38
  124. data/src/core/lib/iomgr/resolve_address_windows.c +51 -37
  125. data/src/core/lib/iomgr/sockaddr.h +2 -2
  126. data/src/core/lib/iomgr/{sockaddr_win32.h → sockaddr_windows.h} +3 -3
  127. data/src/core/lib/iomgr/socket_utils_common_posix.c +92 -45
  128. data/src/core/lib/iomgr/socket_utils_posix.h +19 -12
  129. data/src/core/lib/iomgr/socket_windows.c +61 -2
  130. data/src/core/lib/iomgr/socket_windows.h +13 -0
  131. data/src/core/lib/iomgr/tcp_client_posix.c +54 -39
  132. data/src/core/lib/iomgr/tcp_client_windows.c +34 -34
  133. data/src/core/lib/iomgr/tcp_posix.c +43 -39
  134. data/src/core/lib/iomgr/tcp_server.h +5 -3
  135. data/src/core/lib/iomgr/tcp_server_posix.c +103 -64
  136. data/src/core/lib/iomgr/tcp_server_windows.c +114 -101
  137. data/src/core/lib/iomgr/tcp_windows.c +45 -50
  138. data/src/core/lib/iomgr/tcp_windows.h +1 -1
  139. data/src/core/lib/iomgr/timer.c +26 -13
  140. data/src/core/lib/iomgr/udp_server.c +28 -4
  141. data/src/core/lib/iomgr/udp_server.h +5 -1
  142. data/src/core/lib/iomgr/unix_sockets_posix.c +8 -7
  143. data/src/core/lib/iomgr/unix_sockets_posix.h +2 -1
  144. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +4 -2
  145. data/src/core/lib/iomgr/wakeup_fd_eventfd.c +15 -5
  146. data/src/core/lib/iomgr/wakeup_fd_pipe.c +13 -9
  147. data/src/core/lib/iomgr/wakeup_fd_posix.c +6 -6
  148. data/src/core/lib/iomgr/wakeup_fd_posix.h +9 -6
  149. data/src/core/lib/iomgr/workqueue.h +5 -4
  150. data/src/core/lib/iomgr/workqueue_posix.c +40 -26
  151. data/src/core/lib/iomgr/workqueue_windows.c +2 -2
  152. data/src/core/lib/profiling/basic_timers.c +2 -2
  153. data/src/core/lib/security/{security_context.c → context/security_context.c} +1 -1
  154. data/src/core/lib/security/{security_context.h → context/security_context.h} +4 -4
  155. data/src/core/lib/security/credentials/composite/composite_credentials.c +263 -0
  156. data/src/core/lib/security/credentials/composite/composite_credentials.h +72 -0
  157. data/src/core/lib/security/credentials/credentials.c +233 -0
  158. data/src/core/lib/security/{credentials.h → credentials/credentials.h} +19 -157
  159. data/src/core/lib/security/{credentials_metadata.c → credentials/credentials_metadata.c} +1 -1
  160. data/src/core/lib/security/credentials/fake/fake_credentials.c +139 -0
  161. data/src/core/lib/security/credentials/fake/fake_credentials.h +56 -0
  162. data/src/core/lib/security/{credentials_posix.c → credentials/google_default/credentials_posix.c} +1 -1
  163. data/src/core/lib/security/{credentials_win32.c → credentials/google_default/credentials_windows.c} +3 -3
  164. data/src/core/lib/security/{google_default_credentials.c → credentials/google_default/google_default_credentials.c} +93 -35
  165. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +46 -0
  166. data/src/core/lib/security/credentials/iam/iam_credentials.c +85 -0
  167. data/src/core/lib/security/credentials/iam/iam_credentials.h +44 -0
  168. data/src/core/lib/security/{json_token.c → credentials/jwt/json_token.c} +10 -101
  169. data/src/core/lib/security/{json_token.h → credentials/jwt/json_token.h} +3 -33
  170. data/src/core/lib/security/credentials/jwt/jwt_credentials.c +160 -0
  171. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +62 -0
  172. data/src/core/lib/security/{jwt_verifier.c → credentials/jwt/jwt_verifier.c} +35 -15
  173. data/src/core/lib/security/{jwt_verifier.h → credentials/jwt/jwt_verifier.h} +3 -3
  174. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +433 -0
  175. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +109 -0
  176. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +129 -0
  177. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +45 -0
  178. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +240 -0
  179. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +48 -0
  180. data/src/core/lib/security/{auth_filters.h → transport/auth_filters.h} +3 -3
  181. data/src/core/lib/security/{client_auth_filter.c → transport/client_auth_filter.c} +27 -20
  182. data/src/core/lib/security/{handshake.c → transport/handshake.c} +77 -45
  183. data/src/core/lib/security/{handshake.h → transport/handshake.h} +9 -11
  184. data/src/core/lib/security/{secure_endpoint.c → transport/secure_endpoint.c} +19 -12
  185. data/src/core/lib/security/{secure_endpoint.h → transport/secure_endpoint.h} +3 -3
  186. data/src/core/lib/security/{security_connector.c → transport/security_connector.c} +26 -17
  187. data/src/core/lib/security/{security_connector.h → transport/security_connector.h} +8 -8
  188. data/src/core/lib/security/{server_auth_filter.c → transport/server_auth_filter.c} +24 -16
  189. data/src/core/lib/security/transport/tsi_error.c +40 -0
  190. data/src/core/lib/security/transport/tsi_error.h +42 -0
  191. data/src/core/lib/security/{b64.c → util/b64.c} +1 -1
  192. data/src/core/lib/security/{b64.h → util/b64.h} +3 -3
  193. data/src/core/lib/security/util/json_util.c +61 -0
  194. data/src/core/lib/security/util/json_util.h +55 -0
  195. data/src/core/lib/support/avl.c +11 -0
  196. data/src/core/lib/support/cpu_windows.c +2 -2
  197. data/src/core/lib/support/{env_win32.c → env_windows.c} +3 -3
  198. data/src/core/lib/support/log.c +3 -1
  199. data/src/core/lib/support/log_linux.c +2 -2
  200. data/src/core/lib/support/{log_win32.c → log_windows.c} +4 -4
  201. data/src/core/lib/support/murmur_hash.c +3 -5
  202. data/src/core/lib/support/string.c +10 -0
  203. data/src/core/lib/support/string.h +4 -0
  204. data/src/core/lib/support/{string_util_win32.c → string_util_windows.c} +3 -3
  205. data/src/core/lib/support/{string_win32.c → string_windows.c} +2 -2
  206. data/src/core/lib/support/{string_win32.h → string_windows.h} +5 -5
  207. data/src/core/lib/support/subprocess_windows.c +1 -1
  208. data/src/core/lib/support/{sync_win32.c → sync_windows.c} +2 -2
  209. data/src/core/lib/support/{thd_win32.c → thd_windows.c} +2 -2
  210. data/src/core/lib/support/{time_win32.c → time_windows.c} +2 -2
  211. data/src/core/lib/support/tmpfile_msys.c +1 -1
  212. data/src/core/lib/support/{tmpfile_win32.c → tmpfile_windows.c} +3 -3
  213. data/src/core/lib/surface/alarm.c +2 -2
  214. data/src/core/lib/surface/byte_buffer_reader.c +13 -6
  215. data/src/core/lib/surface/call.c +323 -123
  216. data/src/core/lib/surface/call.h +2 -0
  217. data/src/core/lib/surface/call_log_batch.c +1 -1
  218. data/src/core/lib/surface/channel.c +64 -15
  219. data/src/core/lib/surface/channel.h +9 -0
  220. data/src/core/lib/surface/channel_ping.c +3 -3
  221. data/src/core/lib/surface/completion_queue.c +75 -19
  222. data/src/core/lib/surface/completion_queue.h +7 -2
  223. data/src/core/lib/surface/init.c +2 -1
  224. data/src/core/lib/surface/init_secure.c +4 -4
  225. data/src/core/lib/surface/lame_client.c +12 -8
  226. data/src/core/lib/surface/server.c +213 -120
  227. data/src/core/lib/surface/server.h +1 -0
  228. data/src/core/lib/surface/version.c +1 -1
  229. data/src/core/lib/transport/connectivity_state.c +40 -18
  230. data/src/core/lib/transport/connectivity_state.h +4 -1
  231. data/src/core/lib/transport/metadata.c +23 -23
  232. data/src/core/lib/transport/metadata.h +4 -0
  233. data/src/core/lib/transport/metadata_batch.c +9 -0
  234. data/src/core/lib/transport/metadata_batch.h +3 -0
  235. data/src/core/lib/transport/static_metadata.c +6 -5
  236. data/src/core/lib/transport/static_metadata.h +64 -60
  237. data/src/core/lib/transport/transport.c +24 -12
  238. data/src/core/lib/transport/transport.h +6 -5
  239. data/src/core/lib/transport/transport_impl.h +4 -0
  240. data/src/core/lib/transport/transport_op_string.c +2 -2
  241. data/src/core/plugin_registry/grpc_plugin_registry.c +4 -0
  242. data/src/ruby/bin/math_services.rb +41 -2
  243. data/src/ruby/ext/grpc/rb_call.c +42 -40
  244. data/src/ruby/ext/grpc/rb_channel.c +1 -1
  245. data/src/ruby/ext/grpc/rb_completion_queue.c +59 -6
  246. data/src/ruby/ext/grpc/rb_completion_queue.h +1 -1
  247. data/src/ruby/ext/grpc/rb_grpc.c +1 -3
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -2
  249. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +21 -5
  250. data/src/ruby/ext/grpc/rb_loader.c +1 -1
  251. data/src/ruby/ext/grpc/rb_server.c +5 -3
  252. data/src/ruby/lib/grpc.rb +0 -3
  253. data/src/ruby/lib/grpc/errors.rb +3 -2
  254. data/src/ruby/lib/grpc/generic/active_call.rb +32 -42
  255. data/src/ruby/lib/grpc/generic/bidi_call.rb +20 -0
  256. data/src/ruby/lib/grpc/generic/client_stub.rb +31 -54
  257. data/src/ruby/lib/grpc/generic/rpc_desc.rb +4 -4
  258. data/src/ruby/lib/grpc/generic/rpc_server.rb +12 -23
  259. data/src/ruby/lib/grpc/generic/service.rb +8 -8
  260. data/src/ruby/lib/grpc/version.rb +1 -1
  261. data/src/ruby/pb/grpc/health/v1/health_services.rb +30 -2
  262. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services.rb +34 -4
  263. data/src/ruby/pb/grpc/testing/metrics_services.rb +39 -2
  264. data/src/ruby/pb/src/proto/grpc/testing/empty.rb +15 -0
  265. data/src/ruby/pb/src/proto/grpc/testing/messages.rb +84 -0
  266. data/src/ruby/pb/src/proto/grpc/testing/test.rb +14 -0
  267. data/src/ruby/pb/src/proto/grpc/testing/test_services.rb +110 -0
  268. data/src/ruby/pb/test/client.rb +5 -2
  269. data/src/ruby/spec/generic/active_call_spec.rb +3 -2
  270. data/src/ruby/spec/generic/client_stub_spec.rb +27 -24
  271. data/src/ruby/spec/generic/rpc_desc_spec.rb +11 -11
  272. data/src/ruby/spec/generic/rpc_server_spec.rb +42 -61
  273. data/src/ruby/spec/pb/health/checker_spec.rb +3 -5
  274. metadata +86 -48
  275. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h +0 -182
  276. data/src/core/lib/security/credentials.c +0 -1296
  277. data/src/ruby/lib/grpc/signals.rb +0 -69
@@ -64,7 +64,7 @@ typedef struct {
64
64
  grpc_transport *transport;
65
65
 
66
66
  /** channel arguments (to be passed to the filters) */
67
- const grpc_channel_args *channel_args;
67
+ grpc_channel_args *channel_args;
68
68
  } grpc_connect_out_args;
69
69
 
70
70
  struct grpc_connector_vtable {
@@ -60,8 +60,9 @@ static gpr_atm ref_mutate(grpc_lb_policy *c, gpr_atm delta,
60
60
  : gpr_atm_no_barrier_fetch_add(&c->ref_pair, delta);
61
61
  #ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG
62
62
  gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
63
- "LB_POLICY: %p % 12s 0x%08x -> 0x%08x [%s]", c, purpose, old_val,
64
- old_val + delta, reason);
63
+ "LB_POLICY: 0x%" PRIxPTR " %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR
64
+ " [%s]",
65
+ (intptr_t)c, purpose, old_val, old_val + delta, reason);
65
66
  #endif
66
67
  return old_val;
67
68
  }
@@ -99,12 +100,12 @@ void grpc_lb_policy_weak_unref(grpc_exec_ctx *exec_ctx,
99
100
  }
100
101
 
101
102
  int grpc_lb_policy_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
102
- grpc_pollset *pollset,
103
+ grpc_polling_entity *pollent,
103
104
  grpc_metadata_batch *initial_metadata,
104
105
  uint32_t initial_metadata_flags,
105
106
  grpc_connected_subchannel **target,
106
107
  grpc_closure *on_complete) {
107
- return policy->vtable->pick(exec_ctx, policy, pollset, initial_metadata,
108
+ return policy->vtable->pick(exec_ctx, policy, pollent, initial_metadata,
108
109
  initial_metadata_flags, target, on_complete);
109
110
  }
110
111
 
@@ -138,6 +139,8 @@ void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
138
139
  }
139
140
 
140
141
  grpc_connectivity_state grpc_lb_policy_check_connectivity(
141
- grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy) {
142
- return policy->vtable->check_connectivity(exec_ctx, policy);
142
+ grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
143
+ grpc_error **connectivity_error) {
144
+ return policy->vtable->check_connectivity(exec_ctx, policy,
145
+ connectivity_error);
143
146
  }
@@ -35,6 +35,7 @@
35
35
  #define GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_H
36
36
 
37
37
  #include "src/core/ext/client_config/subchannel.h"
38
+ #include "src/core/lib/iomgr/polling_entity.h"
38
39
  #include "src/core/lib/transport/connectivity_state.h"
39
40
 
40
41
  /** A load balancing policy: specified by a vtable and a struct (which
@@ -59,7 +60,8 @@ struct grpc_lb_policy_vtable {
59
60
 
60
61
  /** implement grpc_lb_policy_pick */
61
62
  int (*pick)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
62
- grpc_pollset *pollset, grpc_metadata_batch *initial_metadata,
63
+ grpc_polling_entity *pollent,
64
+ grpc_metadata_batch *initial_metadata,
63
65
  uint32_t initial_metadata_flags,
64
66
  grpc_connected_subchannel **target, grpc_closure *on_complete);
65
67
  void (*cancel_pick)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
@@ -75,8 +77,9 @@ struct grpc_lb_policy_vtable {
75
77
  void (*exit_idle)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
76
78
 
77
79
  /** check the current connectivity of the lb_policy */
78
- grpc_connectivity_state (*check_connectivity)(grpc_exec_ctx *exec_ctx,
79
- grpc_lb_policy *policy);
80
+ grpc_connectivity_state (*check_connectivity)(
81
+ grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
82
+ grpc_error **connectivity_error);
80
83
 
81
84
  /** call notify when the connectivity state of a channel changes from *state.
82
85
  Updates *state with the new state of the policy */
@@ -124,7 +127,7 @@ void grpc_lb_policy_init(grpc_lb_policy *policy,
124
127
  \a target.
125
128
  Picking can be asynchronous. Any IO should be done under \a pollset. */
126
129
  int grpc_lb_policy_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
127
- grpc_pollset *pollset,
130
+ grpc_polling_entity *pollent,
128
131
  grpc_metadata_batch *initial_metadata,
129
132
  uint32_t initial_metadata_flags,
130
133
  grpc_connected_subchannel **target,
@@ -152,6 +155,7 @@ void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
152
155
  grpc_closure *closure);
153
156
 
154
157
  grpc_connectivity_state grpc_lb_policy_check_connectivity(
155
- grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
158
+ grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
159
+ grpc_error **connectivity_error);
156
160
 
157
161
  #endif /* GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_H */
@@ -54,7 +54,7 @@
54
54
  #define STRONG_REF_MASK (~(gpr_atm)((1 << INTERNAL_REF_BITS) - 1))
55
55
 
56
56
  #define GRPC_SUBCHANNEL_MIN_CONNECT_TIMEOUT_SECONDS 20
57
- #define GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS 2
57
+ #define GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS 1
58
58
  #define GRPC_SUBCHANNEL_RECONNECT_BACKOFF_MULTIPLIER 1.6
59
59
  #define GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS 120
60
60
  #define GRPC_SUBCHANNEL_RECONNECT_JITTER 0.2
@@ -147,7 +147,7 @@ struct grpc_subchannel_call {
147
147
  (((grpc_subchannel_call *)(callstack)) - 1)
148
148
 
149
149
  static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel,
150
- bool iomgr_success);
150
+ grpc_error *error);
151
151
 
152
152
  #ifdef GRPC_STREAM_REFCOUNT_DEBUG
153
153
  #define REF_REASON reason
@@ -177,7 +177,7 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel,
177
177
  */
178
178
 
179
179
  static void connection_destroy(grpc_exec_ctx *exec_ctx, void *arg,
180
- bool success) {
180
+ grpc_error *error) {
181
181
  grpc_connected_subchannel *c = arg;
182
182
  grpc_channel_stack_destroy(exec_ctx, CHANNEL_STACK_FROM_CONNECTION(c));
183
183
  gpr_free(c);
@@ -200,7 +200,7 @@ void grpc_connected_subchannel_unref(grpc_exec_ctx *exec_ctx,
200
200
  */
201
201
 
202
202
  static void subchannel_destroy(grpc_exec_ctx *exec_ctx, void *arg,
203
- bool success) {
203
+ grpc_error *error) {
204
204
  grpc_subchannel *c = arg;
205
205
  gpr_free((void *)c->filters);
206
206
  grpc_channel_args_destroy(c->args);
@@ -290,8 +290,8 @@ void grpc_subchannel_weak_unref(grpc_exec_ctx *exec_ctx,
290
290
  gpr_atm old_refs;
291
291
  old_refs = ref_mutate(c, -(gpr_atm)1, 1 REF_MUTATE_PURPOSE("WEAK_UNREF"));
292
292
  if (old_refs == 1) {
293
- grpc_exec_ctx_enqueue(exec_ctx, grpc_closure_create(subchannel_destroy, c),
294
- true, NULL);
293
+ grpc_exec_ctx_sched(exec_ctx, grpc_closure_create(subchannel_destroy, c),
294
+ GRPC_ERROR_NONE, NULL);
295
295
  }
296
296
  }
297
297
 
@@ -320,7 +320,7 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
320
320
  c->filters = NULL;
321
321
  }
322
322
  c->addr = gpr_malloc(args->addr_len);
323
- memcpy(c->addr, args->addr, args->addr_len);
323
+ if (args->addr_len) memcpy(c->addr, args->addr, args->addr_len);
324
324
  c->pollset_set = grpc_pollset_set_create();
325
325
  c->addr_len = args->addr_len;
326
326
  grpc_set_initial_connect_string(&c->addr, &c->addr_len,
@@ -382,7 +382,8 @@ static void continue_connect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
382
382
  args.initial_connect_string = c->initial_connect_string;
383
383
 
384
384
  grpc_connectivity_state_set(exec_ctx, &c->state_tracker,
385
- GRPC_CHANNEL_CONNECTING, "state_change");
385
+ GRPC_CHANNEL_CONNECTING, GRPC_ERROR_NONE,
386
+ "state_change");
386
387
  grpc_connector_connect(exec_ctx, c->connector, &args, &c->connecting_result,
387
388
  &c->connected);
388
389
  }
@@ -393,16 +394,17 @@ static void start_connect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
393
394
  continue_connect(exec_ctx, c);
394
395
  }
395
396
 
396
- grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel *c) {
397
+ grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel *c,
398
+ grpc_error **error) {
397
399
  grpc_connectivity_state state;
398
400
  gpr_mu_lock(&c->mu);
399
- state = grpc_connectivity_state_check(&c->state_tracker);
401
+ state = grpc_connectivity_state_check(&c->state_tracker, error);
400
402
  gpr_mu_unlock(&c->mu);
401
403
  return state;
402
404
  }
403
405
 
404
406
  static void on_external_state_watcher_done(grpc_exec_ctx *exec_ctx, void *arg,
405
- bool success) {
407
+ grpc_error *error) {
406
408
  external_state_watcher *w = arg;
407
409
  grpc_closure *follow_up = w->notify;
408
410
  if (w->pollset_set != NULL) {
@@ -415,7 +417,7 @@ static void on_external_state_watcher_done(grpc_exec_ctx *exec_ctx, void *arg,
415
417
  gpr_mu_unlock(&w->subchannel->mu);
416
418
  GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, w->subchannel, "external_state_watcher");
417
419
  gpr_free(w);
418
- follow_up->cb(exec_ctx, follow_up->cb_arg, success);
420
+ follow_up->cb(exec_ctx, follow_up->cb_arg, error);
419
421
  }
420
422
 
421
423
  void grpc_subchannel_notify_on_state_change(
@@ -469,7 +471,7 @@ void grpc_connected_subchannel_process_transport_op(
469
471
  }
470
472
 
471
473
  static void subchannel_on_child_state_changed(grpc_exec_ctx *exec_ctx, void *p,
472
- bool iomgr_success) {
474
+ grpc_error *error) {
473
475
  state_watcher *sw = p;
474
476
  grpc_subchannel *c = sw->subchannel;
475
477
  gpr_mu *mu = &c->mu;
@@ -477,20 +479,19 @@ static void subchannel_on_child_state_changed(grpc_exec_ctx *exec_ctx, void *p,
477
479
  gpr_mu_lock(mu);
478
480
 
479
481
  /* if we failed just leave this closure */
480
- if (iomgr_success) {
481
- if (sw->connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
482
- /* any errors on a subchannel ==> we're done, create a new one */
483
- sw->connectivity_state = GRPC_CHANNEL_FATAL_FAILURE;
484
- }
485
- grpc_connectivity_state_set(exec_ctx, &c->state_tracker,
486
- sw->connectivity_state, "reflect_child");
487
- if (sw->connectivity_state != GRPC_CHANNEL_FATAL_FAILURE) {
488
- grpc_connected_subchannel_notify_on_state_change(
489
- exec_ctx, GET_CONNECTED_SUBCHANNEL(c, no_barrier), NULL,
490
- &sw->connectivity_state, &sw->closure);
491
- GRPC_SUBCHANNEL_WEAK_REF(c, "state_watcher");
492
- sw = NULL;
493
- }
482
+ if (sw->connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
483
+ /* any errors on a subchannel ==> we're done, create a new one */
484
+ sw->connectivity_state = GRPC_CHANNEL_SHUTDOWN;
485
+ }
486
+ grpc_connectivity_state_set(exec_ctx, &c->state_tracker,
487
+ sw->connectivity_state, GRPC_ERROR_REF(error),
488
+ "reflect_child");
489
+ if (sw->connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
490
+ grpc_connected_subchannel_notify_on_state_change(
491
+ exec_ctx, GET_CONNECTED_SUBCHANNEL(c, no_barrier), NULL,
492
+ &sw->connectivity_state, &sw->closure);
493
+ GRPC_SUBCHANNEL_WEAK_REF(c, "state_watcher");
494
+ sw = NULL;
494
495
  }
495
496
 
496
497
  gpr_mu_unlock(mu);
@@ -592,17 +593,20 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx,
592
593
 
593
594
  /* signal completion */
594
595
  grpc_connectivity_state_set(exec_ctx, &c->state_tracker, GRPC_CHANNEL_READY,
595
- "connected");
596
+ GRPC_ERROR_NONE, "connected");
596
597
  }
597
598
 
598
- static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, bool iomgr_success) {
599
+ static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
599
600
  grpc_subchannel *c = arg;
600
601
  gpr_mu_lock(&c->mu);
601
602
  c->have_alarm = 0;
602
603
  if (c->disconnected) {
603
- iomgr_success = 0;
604
+ error = GRPC_ERROR_CREATE_REFERENCING("Disconnected", &error, 1);
605
+ } else {
606
+ GRPC_ERROR_REF(error);
604
607
  }
605
- if (iomgr_success) {
608
+ if (error == GRPC_ERROR_NONE) {
609
+ gpr_log(GPR_INFO, "Failed to connect to channel, retrying");
606
610
  c->next_attempt =
607
611
  gpr_backoff_step(&c->backoff_state, gpr_now(GPR_CLOCK_MONOTONIC));
608
612
  continue_connect(exec_ctx, c);
@@ -611,11 +615,13 @@ static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, bool iomgr_success) {
611
615
  gpr_mu_unlock(&c->mu);
612
616
  GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
613
617
  }
618
+ GRPC_ERROR_UNREF(error);
614
619
  }
615
620
 
616
621
  static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
617
- bool iomgr_success) {
622
+ grpc_error *error) {
618
623
  grpc_subchannel *c = arg;
624
+ grpc_channel_args *delete_channel_args = c->connecting_result.channel_args;
619
625
 
620
626
  GRPC_SUBCHANNEL_WEAK_REF(c, "connected");
621
627
  gpr_mu_lock(&c->mu);
@@ -627,13 +633,26 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
627
633
  gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
628
634
  GPR_ASSERT(!c->have_alarm);
629
635
  c->have_alarm = 1;
630
- grpc_connectivity_state_set(exec_ctx, &c->state_tracker,
631
- GRPC_CHANNEL_TRANSIENT_FAILURE,
632
- "connect_failed");
636
+ grpc_connectivity_state_set(
637
+ exec_ctx, &c->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
638
+ GRPC_ERROR_CREATE_REFERENCING("Connect Failed", &error, 1),
639
+ "connect_failed");
640
+ gpr_timespec time_til_next = gpr_time_sub(c->next_attempt, now);
641
+ const char *errmsg = grpc_error_string(error);
642
+ gpr_log(GPR_INFO, "Connect failed: %s", errmsg);
643
+ if (gpr_time_cmp(time_til_next, gpr_time_0(time_til_next.clock_type)) <=
644
+ 0) {
645
+ gpr_log(GPR_INFO, "Retry immediately");
646
+ } else {
647
+ gpr_log(GPR_INFO, "Retry in %" PRId64 ".%09d seconds",
648
+ time_til_next.tv_sec, time_til_next.tv_nsec);
649
+ }
633
650
  grpc_timer_init(exec_ctx, &c->alarm, c->next_attempt, on_alarm, c, now);
651
+ grpc_error_free_string(errmsg);
634
652
  }
635
653
  gpr_mu_unlock(&c->mu);
636
654
  GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
655
+ grpc_channel_args_destroy(delete_channel_args);
637
656
  }
638
657
 
639
658
  /*
@@ -641,11 +660,11 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
641
660
  */
642
661
 
643
662
  static void subchannel_call_destroy(grpc_exec_ctx *exec_ctx, void *call,
644
- bool success) {
663
+ grpc_error *error) {
645
664
  grpc_subchannel_call *c = call;
646
665
  GPR_TIMER_BEGIN("grpc_subchannel_call_unref.destroy", 0);
647
666
  grpc_connected_subchannel *connection = c->connection;
648
- grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), c);
667
+ grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), NULL, c);
649
668
  GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, connection, "subchannel_call");
650
669
  GPR_TIMER_END("grpc_subchannel_call_unref.destroy", 0);
651
670
  }
@@ -683,7 +702,7 @@ grpc_connected_subchannel *grpc_subchannel_get_connected_subchannel(
683
702
 
684
703
  grpc_subchannel_call *grpc_connected_subchannel_create_call(
685
704
  grpc_exec_ctx *exec_ctx, grpc_connected_subchannel *con,
686
- grpc_pollset *pollset) {
705
+ grpc_polling_entity *pollent) {
687
706
  grpc_channel_stack *chanstk = CHANNEL_STACK_FROM_CONNECTION(con);
688
707
  grpc_subchannel_call *call =
689
708
  gpr_malloc(sizeof(grpc_subchannel_call) + chanstk->call_stack_size);
@@ -692,7 +711,7 @@ grpc_subchannel_call *grpc_connected_subchannel_create_call(
692
711
  GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call");
693
712
  grpc_call_stack_init(exec_ctx, chanstk, 1, subchannel_call_destroy, call,
694
713
  NULL, NULL, callstk);
695
- grpc_call_stack_set_pollset(exec_ctx, callstk, pollset);
714
+ grpc_call_stack_set_pollset_or_pollset_set(exec_ctx, callstk, pollent);
696
715
  return call;
697
716
  }
698
717
 
@@ -36,6 +36,7 @@
36
36
 
37
37
  #include "src/core/ext/client_config/connector.h"
38
38
  #include "src/core/lib/channel/channel_stack.h"
39
+ #include "src/core/lib/iomgr/polling_entity.h"
39
40
  #include "src/core/lib/transport/connectivity_state.h"
40
41
 
41
42
  /** A (sub-)channel that knows how to connect to exactly one target
@@ -109,7 +110,7 @@ void grpc_subchannel_call_unref(grpc_exec_ctx *exec_ctx,
109
110
  /** construct a subchannel call */
110
111
  grpc_subchannel_call *grpc_connected_subchannel_create_call(
111
112
  grpc_exec_ctx *exec_ctx, grpc_connected_subchannel *connected_subchannel,
112
- grpc_pollset *pollset);
113
+ grpc_polling_entity *pollent);
113
114
 
114
115
  /** process a transport level op */
115
116
  void grpc_connected_subchannel_process_transport_op(
@@ -118,7 +119,7 @@ void grpc_connected_subchannel_process_transport_op(
118
119
 
119
120
  /** poll the current connectivity state of a channel */
120
121
  grpc_connectivity_state grpc_subchannel_check_connectivity(
121
- grpc_subchannel *channel);
122
+ grpc_subchannel *channel, grpc_error **error);
122
123
 
123
124
  /** call notify when the connectivity state of a channel changes from *state.
124
125
  Updates *state with the new state of the channel */
@@ -43,14 +43,14 @@
43
43
  #define CANCELLED_CALL ((grpc_subchannel_call *)1)
44
44
 
45
45
  static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *holder,
46
- bool success);
46
+ grpc_error *error);
47
47
  static void retry_ops(grpc_exec_ctx *exec_ctx, void *retry_ops_args,
48
- bool success);
48
+ grpc_error *error);
49
49
 
50
50
  static void add_waiting_locked(grpc_subchannel_call_holder *holder,
51
51
  grpc_transport_stream_op *op);
52
52
  static void fail_locked(grpc_exec_ctx *exec_ctx,
53
- grpc_subchannel_call_holder *holder);
53
+ grpc_subchannel_call_holder *holder, grpc_error *error);
54
54
  static void retry_waiting_locked(grpc_exec_ctx *exec_ctx,
55
55
  grpc_subchannel_call_holder *holder);
56
56
 
@@ -68,6 +68,7 @@ void grpc_subchannel_call_holder_init(
68
68
  holder->waiting_ops_capacity = 0;
69
69
  holder->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING;
70
70
  holder->owning_call = owning_call;
71
+ holder->pollent = NULL;
71
72
  }
72
73
 
73
74
  void grpc_subchannel_call_holder_destroy(grpc_exec_ctx *exec_ctx,
@@ -90,7 +91,8 @@ void grpc_subchannel_call_holder_perform_op(grpc_exec_ctx *exec_ctx,
90
91
  grpc_subchannel_call *call = GET_CALL(holder);
91
92
  GPR_TIMER_BEGIN("grpc_subchannel_call_holder_perform_op", 0);
92
93
  if (call == CANCELLED_CALL) {
93
- grpc_transport_stream_op_finish_with_failure(exec_ctx, op);
94
+ grpc_transport_stream_op_finish_with_failure(exec_ctx, op,
95
+ GRPC_ERROR_CANCELLED);
94
96
  GPR_TIMER_END("grpc_subchannel_call_holder_perform_op", 0);
95
97
  return;
96
98
  }
@@ -106,7 +108,8 @@ retry:
106
108
  call = GET_CALL(holder);
107
109
  if (call == CANCELLED_CALL) {
108
110
  gpr_mu_unlock(&holder->mu);
109
- grpc_transport_stream_op_finish_with_failure(exec_ctx, op);
111
+ grpc_transport_stream_op_finish_with_failure(exec_ctx, op,
112
+ GRPC_ERROR_CANCELLED);
110
113
  GPR_TIMER_END("grpc_subchannel_call_holder_perform_op", 0);
111
114
  return;
112
115
  }
@@ -123,7 +126,10 @@ retry:
123
126
  } else {
124
127
  switch (holder->creation_phase) {
125
128
  case GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING:
126
- fail_locked(exec_ctx, holder);
129
+ fail_locked(exec_ctx, holder,
130
+ grpc_error_set_int(GRPC_ERROR_CREATE("Cancelled"),
131
+ GRPC_ERROR_INT_GRPC_STATUS,
132
+ op->cancel_with_status));
127
133
  break;
128
134
  case GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL:
129
135
  holder->pick_subchannel(exec_ctx, holder->pick_subchannel_arg, NULL,
@@ -131,7 +137,8 @@ retry:
131
137
  break;
132
138
  }
133
139
  gpr_mu_unlock(&holder->mu);
134
- grpc_transport_stream_op_finish_with_failure(exec_ctx, op);
140
+ grpc_transport_stream_op_finish_with_failure(exec_ctx, op,
141
+ GRPC_ERROR_CANCELLED);
135
142
  GPR_TIMER_END("grpc_subchannel_call_holder_perform_op", 0);
136
143
  return;
137
144
  }
@@ -157,7 +164,7 @@ retry:
157
164
  gpr_atm_rel_store(
158
165
  &holder->subchannel_call,
159
166
  (gpr_atm)(uintptr_t)grpc_connected_subchannel_create_call(
160
- exec_ctx, holder->connected_subchannel, holder->pollset));
167
+ exec_ctx, holder->connected_subchannel, holder->pollent));
161
168
  retry_waiting_locked(exec_ctx, holder);
162
169
  goto retry;
163
170
  }
@@ -167,22 +174,28 @@ retry:
167
174
  GPR_TIMER_END("grpc_subchannel_call_holder_perform_op", 0);
168
175
  }
169
176
 
170
- static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
177
+ static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *arg,
178
+ grpc_error *error) {
171
179
  grpc_subchannel_call_holder *holder = arg;
172
180
  gpr_mu_lock(&holder->mu);
173
181
  GPR_ASSERT(holder->creation_phase ==
174
182
  GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL);
175
183
  holder->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING;
176
184
  if (holder->connected_subchannel == NULL) {
177
- fail_locked(exec_ctx, holder);
185
+ gpr_atm_no_barrier_store(&holder->subchannel_call, 1);
186
+ fail_locked(exec_ctx, holder,
187
+ GRPC_ERROR_CREATE_REFERENCING("Failed to create subchannel",
188
+ &error, 1));
178
189
  } else if (1 == gpr_atm_acq_load(&holder->subchannel_call)) {
179
190
  /* already cancelled before subchannel became ready */
180
- fail_locked(exec_ctx, holder);
191
+ fail_locked(exec_ctx, holder,
192
+ GRPC_ERROR_CREATE_REFERENCING(
193
+ "Cancelled before creating subchannel", &error, 1));
181
194
  } else {
182
195
  gpr_atm_rel_store(
183
196
  &holder->subchannel_call,
184
197
  (gpr_atm)(uintptr_t)grpc_connected_subchannel_create_call(
185
- exec_ctx, holder->connected_subchannel, holder->pollset));
198
+ exec_ctx, holder->connected_subchannel, holder->pollent));
186
199
  retry_waiting_locked(exec_ctx, holder);
187
200
  }
188
201
  gpr_mu_unlock(&holder->mu);
@@ -203,18 +216,18 @@ static void retry_waiting_locked(grpc_exec_ctx *exec_ctx,
203
216
  a->call = GET_CALL(holder);
204
217
  if (a->call == CANCELLED_CALL) {
205
218
  gpr_free(a);
206
- fail_locked(exec_ctx, holder);
219
+ fail_locked(exec_ctx, holder, GRPC_ERROR_CANCELLED);
207
220
  return;
208
221
  }
209
222
  holder->waiting_ops = NULL;
210
223
  holder->waiting_ops_count = 0;
211
224
  holder->waiting_ops_capacity = 0;
212
225
  GRPC_SUBCHANNEL_CALL_REF(a->call, "retry_ops");
213
- grpc_exec_ctx_enqueue(exec_ctx, grpc_closure_create(retry_ops, a), true,
214
- NULL);
226
+ grpc_exec_ctx_sched(exec_ctx, grpc_closure_create(retry_ops, a),
227
+ GRPC_ERROR_NONE, NULL);
215
228
  }
216
229
 
217
- static void retry_ops(grpc_exec_ctx *exec_ctx, void *args, bool success) {
230
+ static void retry_ops(grpc_exec_ctx *exec_ctx, void *args, grpc_error *error) {
218
231
  retry_ops_args *a = args;
219
232
  size_t i;
220
233
  for (i = 0; i < a->nops; i++) {
@@ -239,13 +252,15 @@ static void add_waiting_locked(grpc_subchannel_call_holder *holder,
239
252
  }
240
253
 
241
254
  static void fail_locked(grpc_exec_ctx *exec_ctx,
242
- grpc_subchannel_call_holder *holder) {
255
+ grpc_subchannel_call_holder *holder,
256
+ grpc_error *error) {
243
257
  size_t i;
244
258
  for (i = 0; i < holder->waiting_ops_count; i++) {
245
- grpc_transport_stream_op_finish_with_failure(exec_ctx,
246
- &holder->waiting_ops[i]);
259
+ grpc_transport_stream_op_finish_with_failure(
260
+ exec_ctx, &holder->waiting_ops[i], GRPC_ERROR_REF(error));
247
261
  }
248
262
  holder->waiting_ops_count = 0;
263
+ GRPC_ERROR_UNREF(error);
249
264
  }
250
265
 
251
266
  char *grpc_subchannel_call_holder_get_peer(